summaryrefslogtreecommitdiff
path: root/sound/firewire/motu/motu-midi.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-03-22 21:30:24 +0900
committerTakashi Iwai <tiwai@suse.de>2017-03-28 12:34:02 +0200
commit71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1 (patch)
treeb64eeb67394492017bb55b3123ad11a13e7de202 /sound/firewire/motu/motu-midi.c
parent9e796e7d59e71f8a556cfbdc2ffa3aff0555dd0e (diff)
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-midi.c')
-rw-r--r--sound/firewire/motu/motu-midi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/firewire/motu/motu-midi.c b/sound/firewire/motu/motu-midi.c
index f232f29589d0..e3acfcc53f4e 100644
--- a/sound/firewire/motu/motu-midi.c
+++ b/sound/firewire/motu/motu-midi.c
@@ -12,6 +12,10 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
struct snd_motu *motu = substream->rmidi->private_data;
int err;
+ err = snd_motu_stream_lock_try(motu);
+ if (err < 0)
+ return err;
+
mutex_lock(&motu->mutex);
motu->capture_substreams++;
@@ -19,6 +23,9 @@ static int midi_capture_open(struct snd_rawmidi_substream *substream)
mutex_unlock(&motu->mutex);
+ if (err < 0)
+ snd_motu_stream_lock_release(motu);
+
return err;
}
@@ -27,6 +34,10 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
struct snd_motu *motu = substream->rmidi->private_data;
int err;
+ err = snd_motu_stream_lock_try(motu);
+ if (err < 0)
+ return err;
+
mutex_lock(&motu->mutex);
motu->playback_substreams++;
@@ -34,6 +45,9 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
mutex_unlock(&motu->mutex);
+ if (err < 0)
+ snd_motu_stream_lock_release(motu);
+
return err;
}
@@ -48,6 +62,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
mutex_unlock(&motu->mutex);
+ snd_motu_stream_lock_release(motu);
return 0;
}
@@ -62,6 +77,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
mutex_unlock(&motu->mutex);
+ snd_motu_stream_lock_release(motu);
return 0;
}