summaryrefslogtreecommitdiffstats
path: root/sound/firewire/oxfw/oxfw-stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-12-09 00:10:49 +0900
committerTakashi Iwai <tiwai@suse.de>2014-12-10 10:50:00 +0100
commit8985f4ac1c42bd25799f294f4e87fa73064673c7 (patch)
tree04f57545162b29abfc8a6b0c2d2833721b4bcc78 /sound/firewire/oxfw/oxfw-stream.c
parent05588d340a128ff5c7b768c517150e31842a78aa (diff)
downloadop-kernel-dev-8985f4ac1c42bd25799f294f4e87fa73064673c7.zip
op-kernel-dev-8985f4ac1c42bd25799f294f4e87fa73064673c7.tar.gz
ALSA: oxfw: Add hwdep interface
This interface is designed for mixer/control application. 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> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/oxfw/oxfw-stream.c')
-rw-r--r--sound/firewire/oxfw/oxfw-stream.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
index a38b3c3..b77cf80 100644
--- a/sound/firewire/oxfw/oxfw-stream.c
+++ b/sound/firewire/oxfw/oxfw-stream.c
@@ -644,3 +644,42 @@ int snd_oxfw_stream_discover(struct snd_oxfw *oxfw)
end:
return err;
}
+
+void snd_oxfw_stream_lock_changed(struct snd_oxfw *oxfw)
+{
+ oxfw->dev_lock_changed = true;
+ wake_up(&oxfw->hwdep_wait);
+}
+
+int snd_oxfw_stream_lock_try(struct snd_oxfw *oxfw)
+{
+ int err;
+
+ spin_lock_irq(&oxfw->lock);
+
+ /* user land lock this */
+ if (oxfw->dev_lock_count < 0) {
+ err = -EBUSY;
+ goto end;
+ }
+
+ /* this is the first time */
+ if (oxfw->dev_lock_count++ == 0)
+ snd_oxfw_stream_lock_changed(oxfw);
+ err = 0;
+end:
+ spin_unlock_irq(&oxfw->lock);
+ return err;
+}
+
+void snd_oxfw_stream_lock_release(struct snd_oxfw *oxfw)
+{
+ spin_lock_irq(&oxfw->lock);
+
+ if (WARN_ON(oxfw->dev_lock_count <= 0))
+ goto end;
+ if (--oxfw->dev_lock_count == 0)
+ snd_oxfw_stream_lock_changed(oxfw);
+end:
+ spin_unlock_irq(&oxfw->lock);
+}
OpenPOWER on IntegriCloud