summaryrefslogtreecommitdiff
path: root/sound/firewire/fireworks/fireworks_midi.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 17:45:12 +0400
committerTakashi Iwai <tiwai@suse.de>2014-05-26 16:28:41 +0400
commit594ddced821dee39a548efe46d7f834bae013505 (patch)
treec0abaae51d84ef71127c3db3797130eb61701001 /sound/firewire/fireworks/fireworks_midi.c
parentaa02bb6e60783938d61eefe38346781a646800a6 (diff)
downloadlinux-594ddced821dee39a548efe46d7f834bae013505.tar.xz
ALSA: fireworks: Add hwdep interface
This interface is designed for mixer/control application. To use hwdep interface, the 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/fireworks/fireworks_midi.c')
-rw-r--r--sound/firewire/fireworks/fireworks_midi.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sound/firewire/fireworks/fireworks_midi.c b/sound/firewire/fireworks/fireworks_midi.c
index cbf34e99237f..4a600d235ec5 100644
--- a/sound/firewire/fireworks/fireworks_midi.c
+++ b/sound/firewire/fireworks/fireworks_midi.c
@@ -11,17 +11,36 @@
static int midi_capture_open(struct snd_rawmidi_substream *substream)
{
struct snd_efw *efw = substream->rmidi->private_data;
+ int err;
+
+ err = snd_efw_stream_lock_try(efw);
+ if (err < 0)
+ goto end;
atomic_inc(&efw->capture_substreams);
- return snd_efw_stream_start_duplex(efw, 0);
+ err = snd_efw_stream_start_duplex(efw, 0);
+ if (err < 0)
+ snd_efw_stream_lock_release(efw);
+
+end:
+ return err;
}
static int midi_playback_open(struct snd_rawmidi_substream *substream)
{
struct snd_efw *efw = substream->rmidi->private_data;
+ int err;
+
+ err = snd_efw_stream_lock_try(efw);
+ if (err < 0)
+ goto end;
atomic_inc(&efw->playback_substreams);
- return snd_efw_stream_start_duplex(efw, 0);
+ err = snd_efw_stream_start_duplex(efw, 0);
+ if (err < 0)
+ snd_efw_stream_lock_release(efw);
+end:
+ return err;
}
static int midi_capture_close(struct snd_rawmidi_substream *substream)
@@ -31,6 +50,7 @@ static int midi_capture_close(struct snd_rawmidi_substream *substream)
atomic_dec(&efw->capture_substreams);
snd_efw_stream_stop_duplex(efw);
+ snd_efw_stream_lock_release(efw);
return 0;
}
@@ -41,6 +61,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
atomic_dec(&efw->playback_substreams);
snd_efw_stream_stop_duplex(efw);
+ snd_efw_stream_lock_release(efw);
return 0;
}