summaryrefslogtreecommitdiffstats
path: root/sound/firewire/fireworks/fireworks_pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-04-25 22:45:12 +0900
committerTakashi Iwai <tiwai@suse.de>2014-05-26 14:28:41 +0200
commit594ddced821dee39a548efe46d7f834bae013505 (patch)
treec0abaae51d84ef71127c3db3797130eb61701001 /sound/firewire/fireworks/fireworks_pcm.c
parentaa02bb6e60783938d61eefe38346781a646800a6 (diff)
downloadop-kernel-dev-594ddced821dee39a548efe46d7f834bae013505.zip
op-kernel-dev-594ddced821dee39a548efe46d7f834bae013505.tar.gz
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_pcm.c')
-rw-r--r--sound/firewire/fireworks/fireworks_pcm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c
index 15ec4e0..ed211d0 100644
--- a/sound/firewire/fireworks/fireworks_pcm.c
+++ b/sound/firewire/fireworks/fireworks_pcm.c
@@ -199,13 +199,17 @@ static int pcm_open(struct snd_pcm_substream *substream)
unsigned int clock_source;
int err;
- err = pcm_init_hw_params(efw, substream);
+ err = snd_efw_stream_lock_try(efw);
if (err < 0)
goto end;
+ err = pcm_init_hw_params(efw, substream);
+ if (err < 0)
+ goto err_locked;
+
err = snd_efw_command_get_clock_source(efw, &clock_source);
if (err < 0)
- goto end;
+ goto err_locked;
/*
* When source of clock is not internal or any PCM streams are running,
@@ -216,7 +220,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
amdtp_stream_pcm_running(&efw->rx_stream)) {
err = snd_efw_command_get_sampling_rate(efw, &sampling_rate);
if (err < 0)
- goto end;
+ goto err_locked;
substream->runtime->hw.rate_min = sampling_rate;
substream->runtime->hw.rate_max = sampling_rate;
}
@@ -224,10 +228,15 @@ static int pcm_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);
end:
return err;
+err_locked:
+ snd_efw_stream_lock_release(efw);
+ return err;
}
static int pcm_close(struct snd_pcm_substream *substream)
{
+ struct snd_efw *efw = substream->private_data;
+ snd_efw_stream_lock_release(efw);
return 0;
}
OpenPOWER on IntegriCloud