summaryrefslogtreecommitdiffstats
path: root/sound/firewire/motu/motu-pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-03-22 13:30:24 +0100
committerTakashi Iwai <tiwai@suse.de>2017-03-28 12:34:02 +0200
commit71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1 (patch)
treeb64eeb67394492017bb55b3123ad11a13e7de202 /sound/firewire/motu/motu-pcm.c
parentALSA: firewire-motu: add MIDI functionality (diff)
downloadlinux-71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1.tar.xz
linux-71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1.zip
ALSA: firewire-motu: 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/motu/motu-pcm.c')
-rw-r--r--sound/firewire/motu/motu-pcm.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index a50bcd6f4a63..94558f3d218b 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -159,15 +159,19 @@ static int pcm_open(struct snd_pcm_substream *substream)
unsigned int rate;
int err;
+ err = snd_motu_stream_lock_try(motu);
+ if (err < 0)
+ return err;
+
mutex_lock(&motu->mutex);
err = protocol->cache_packet_formats(motu);
if (err < 0)
- return err;
+ goto err_locked;
err = init_hw_info(motu, substream);
if (err < 0)
- return err;
+ goto err_locked;
/*
* When source of clock is not internal or any PCM streams are running,
@@ -175,13 +179,13 @@ static int pcm_open(struct snd_pcm_substream *substream)
*/
err = protocol->get_clock_source(motu, &src);
if (err < 0)
- return err;
+ goto err_locked;
if (src != SND_MOTU_CLOCK_SOURCE_INTERNAL ||
amdtp_stream_pcm_running(&motu->tx_stream) ||
amdtp_stream_pcm_running(&motu->rx_stream)) {
err = protocol->get_clock_rate(motu, &rate);
if (err < 0)
- return err;
+ goto err_locked;
substream->runtime->hw.rate_min = rate;
substream->runtime->hw.rate_max = rate;
}
@@ -191,10 +195,18 @@ static int pcm_open(struct snd_pcm_substream *substream)
mutex_unlock(&motu->mutex);
return err;
+err_locked:
+ mutex_unlock(&motu->mutex);
+ snd_motu_stream_lock_release(motu);
+ return err;
}
static int pcm_close(struct snd_pcm_substream *substream)
{
+ struct snd_motu *motu = substream->private_data;
+
+ snd_motu_stream_lock_release(motu);
+
return 0;
}