diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2015-10-01 22:02:17 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-10-02 18:17:04 +0200 |
commit | e5e0c3dd257bf34cf001e10422943f90437f0f1b (patch) | |
tree | 3a4dfafb1815f996d9bf0366c2f9b95353a09199 /sound/firewire/tascam/tascam-pcm.c | |
parent | e453df44f0d6574e99fae990c89a22c6ec6bbb62 (diff) | |
download | lwn-e5e0c3dd257bf34cf001e10422943f90437f0f1b.tar.gz lwn-e5e0c3dd257bf34cf001e10422943f90437f0f1b.zip |
ALSA: firewire-tascam: add hwdep interface
This commit adds hwdep interface so as the other IEEE 1394 sound devices
has.
This interface is designed for mixer/control applications. 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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/tascam/tascam-pcm.c')
-rw-r--r-- | sound/firewire/tascam/tascam-pcm.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/firewire/tascam/tascam-pcm.c b/sound/firewire/tascam/tascam-pcm.c index 696b371e3c44..380d3db969a5 100644 --- a/sound/firewire/tascam/tascam-pcm.c +++ b/sound/firewire/tascam/tascam-pcm.c @@ -72,9 +72,13 @@ static int pcm_open(struct snd_pcm_substream *substream) unsigned int rate; int err; + err = snd_tscm_stream_lock_try(tscm); + if (err < 0) + goto end; + err = pcm_init_hw_params(tscm, substream); if (err < 0) - return err; + goto err_locked; err = snd_tscm_stream_get_clock(tscm, &clock); if (clock != SND_TSCM_CLOCK_INTERNAL || @@ -82,18 +86,25 @@ static int pcm_open(struct snd_pcm_substream *substream) amdtp_stream_pcm_running(&tscm->tx_stream)) { err = snd_tscm_stream_get_rate(tscm, &rate); if (err < 0) - return err; + goto err_locked; substream->runtime->hw.rate_min = rate; substream->runtime->hw.rate_max = rate; } snd_pcm_set_sync(substream); - +end: + return err; +err_locked: + snd_tscm_stream_lock_release(tscm); return err; } static int pcm_close(struct snd_pcm_substream *substream) { + struct snd_tscm *tscm = substream->private_data; + + snd_tscm_stream_lock_release(tscm); + return 0; } |