aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob_pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 22:45:20 +0900
committerTakashi Iwai <tiwai@suse.de>2014-05-26 14:31:03 +0200
commit618eabeae711c56d376daa147c6a684116d68705 (patch)
tree5c3aae69f57c84a57437645d40bcd7c0f1b18e67 /sound/firewire/bebob/bebob_pcm.c
parentALSA: bebob: Add PCM interface (diff)
downloadlinux-dev-618eabeae711c56d376daa147c6a684116d68705.tar.xz
linux-dev-618eabeae711c56d376daa147c6a684116d68705.zip
ALSA: bebob: Add hwdep interface
This interface is designed for mixer/control application. By using 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/bebob/bebob_pcm.c')
-rw-r--r--sound/firewire/bebob/bebob_pcm.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c
index 7474309dad87..9d868171db4e 100644
--- a/sound/firewire/bebob/bebob_pcm.c
+++ b/sound/firewire/bebob/bebob_pcm.c
@@ -159,13 +159,17 @@ pcm_open(struct snd_pcm_substream *substream)
bool internal;
int err;
- err = pcm_init_hw_params(bebob, substream);
+ err = snd_bebob_stream_lock_try(bebob);
if (err < 0)
goto end;
+ err = pcm_init_hw_params(bebob, substream);
+ if (err < 0)
+ goto err_locked;
+
err = snd_bebob_stream_check_internal_clock(bebob, &internal);
if (err < 0)
- goto end;
+ goto err_locked;
/*
* When source of clock is internal or any PCM stream are running,
@@ -178,7 +182,7 @@ pcm_open(struct snd_pcm_substream *substream)
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to get sampling rate: %d\n", err);
- goto end;
+ goto err_locked;
}
substream->runtime->hw.rate_min = sampling_rate;
@@ -186,14 +190,18 @@ pcm_open(struct snd_pcm_substream *substream)
}
snd_pcm_set_sync(substream);
-
end:
return err;
+err_locked:
+ snd_bebob_stream_lock_release(bebob);
+ return err;
}
static int
pcm_close(struct snd_pcm_substream *substream)
{
+ struct snd_bebob *bebob = substream->private_data;
+ snd_bebob_stream_lock_release(bebob);
return 0;
}