aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/firewire/digi00x/digi00x-pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2015-09-30 09:39:21 +0900
committerTakashi Iwai <tiwai@suse.de>2015-09-30 15:36:56 +0200
commit660dd3d52ead45b8e60dcf966daf304de2121a28 (patch)
tree0c2a7adb65ad0651a1a890b1c0e7653da9470f2f /sound/firewire/digi00x/digi00x-pcm.c
parentALSA: firewire-digi00x: add PCM functionality (diff)
downloadwireguard-linux-660dd3d52ead45b8e60dcf966daf304de2121a28.tar.xz
wireguard-linux-660dd3d52ead45b8e60dcf966daf304de2121a28.zip
ALSA: firewire-digi00x: add hwdep interface
This commit adds hwdep interface so as the other sound drivers for units on IEEE 1394 bus have. This interface is designed for mixer/control applications. By using this interface, an application can get information about firewire node, can lock/unlock kernel streaming and can get notification at starting/stopping kernel streaming. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/digi00x/digi00x-pcm.c')
-rw-r--r--sound/firewire/digi00x/digi00x-pcm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sound/firewire/digi00x/digi00x-pcm.c b/sound/firewire/digi00x/digi00x-pcm.c
index 87c9aa234890..cac28f70aef7 100644
--- a/sound/firewire/digi00x/digi00x-pcm.c
+++ b/sound/firewire/digi00x/digi00x-pcm.c
@@ -118,21 +118,25 @@ static int pcm_open(struct snd_pcm_substream *substream)
unsigned int rate;
int err;
+ err = snd_dg00x_stream_lock_try(dg00x);
+ if (err < 0)
+ goto end;
+
err = pcm_init_hw_params(dg00x, substream);
if (err < 0)
- return err;
+ goto err_locked;
/* Check current clock source. */
err = snd_dg00x_stream_get_clock(dg00x, &clock);
if (err < 0)
- return err;
+ goto err_locked;
if (clock != SND_DG00X_CLOCK_INTERNAL) {
err = snd_dg00x_stream_check_external_clock(dg00x, &detect);
if (err < 0)
- return err;
+ goto err_locked;
if (!detect) {
err = -EBUSY;
- return err;
+ goto err_locked;
}
}
@@ -141,18 +145,25 @@ static int pcm_open(struct snd_pcm_substream *substream)
amdtp_stream_pcm_running(&dg00x->tx_stream)) {
err = snd_dg00x_stream_get_external_rate(dg00x, &rate);
if (err < 0)
- return err;
+ goto err_locked;
substream->runtime->hw.rate_min = rate;
substream->runtime->hw.rate_max = rate;
}
snd_pcm_set_sync(substream);
-
+end:
+ return err;
+err_locked:
+ snd_dg00x_stream_lock_release(dg00x);
return err;
}
static int pcm_close(struct snd_pcm_substream *substream)
{
+ struct snd_dg00x *dg00x = substream->private_data;
+
+ snd_dg00x_stream_lock_release(dg00x);
+
return 0;
}