diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-03-31 16:06:11 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-04-05 22:31:49 +0300 |
commit | f656edd5fb33d889561978b81ec2897087c2f4ca (patch) | |
tree | 5c023947956c83b1f27326f89a4039b7e24388e7 /sound/firewire/fireface/ff-pcm.c | |
parent | 4b316436ab2e0b74e4986fc66b7cd7902cfd7054 (diff) | |
download | linux-f656edd5fb33d889561978b81ec2897087c2f4ca.tar.xz |
ALSA: fireface: add hwdep interface
This commit adds hwdep interface so as the other drivers for audio and
music units on IEEE 1394 have.
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/fireface/ff-pcm.c')
-rw-r--r-- | sound/firewire/fireface/ff-pcm.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sound/firewire/fireface/ff-pcm.c b/sound/firewire/fireface/ff-pcm.c index d282467d39a6..93cee1978e8e 100644 --- a/sound/firewire/fireface/ff-pcm.c +++ b/sound/firewire/fireface/ff-pcm.c @@ -154,13 +154,21 @@ static int pcm_open(struct snd_pcm_substream *substream) enum snd_ff_clock_src src; int i, err; - err = pcm_init_hw_params(ff, substream); + err = snd_ff_stream_lock_try(ff); if (err < 0) return err; + err = pcm_init_hw_params(ff, substream); + if (err < 0) { + snd_ff_stream_lock_release(ff); + return err; + } + err = ff->spec->protocol->get_clock(ff, &rate, &src); - if (err < 0) + if (err < 0) { + snd_ff_stream_lock_release(ff); return err; + } if (src != SND_FF_CLOCK_SRC_INTERNAL) { for (i = 0; i < CIP_SFC_COUNT; ++i) { @@ -171,8 +179,10 @@ static int pcm_open(struct snd_pcm_substream *substream) * The unit is configured at sampling frequency which packet * streaming engine can't support. */ - if (i >= CIP_SFC_COUNT) + if (i >= CIP_SFC_COUNT) { + snd_ff_stream_lock_release(ff); return -EIO; + } substream->runtime->hw.rate_min = rate; substream->runtime->hw.rate_max = rate; @@ -192,6 +202,10 @@ static int pcm_open(struct snd_pcm_substream *substream) static int pcm_close(struct snd_pcm_substream *substream) { + struct snd_ff *ff = substream->private_data; + + snd_ff_stream_lock_release(ff); + return 0; } |