From 594ddced821dee39a548efe46d7f834bae013505 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Fri, 25 Apr 2014 22:45:12 +0900 Subject: 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 Signed-off-by: Takashi Iwai --- sound/firewire/fireworks/fireworks_pcm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sound/firewire/fireworks/fireworks_pcm.c') diff --git a/sound/firewire/fireworks/fireworks_pcm.c b/sound/firewire/fireworks/fireworks_pcm.c index 15ec4e02b84f..ed211d062202 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; } -- cgit v1.2.3