summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDaniel Girnus <dgirnus@de.adit-jv.com>2016-12-06 14:46:15 +0900
committerTakashi Iwai <tiwai@suse.de>2016-12-06 13:55:15 +0100
commit1e2e3fe480064ca33186e5a923beaa160efed35d (patch)
treeab3155a9ffd5391a54b5072a798615e71d382b54 /sound/usb
parent4763601a56f155ddf94ef35fc2c41504a2de15f5 (diff)
downloadop-kernel-dev-1e2e3fe480064ca33186e5a923beaa160efed35d.zip
op-kernel-dev-1e2e3fe480064ca33186e5a923beaa160efed35d.tar.gz
ALSA: usb-audio: avoid setting of sample rate multiple times on bus
Some of userland applications call 'snd_pcm_hw_params()' and 'snd_pcm_hw_prepare()' sequentially, which means 'snd_pcm_hw_prepare()' is called twice and the second 'snd_pcm_hw_prepare()' is called in 'SNDRV_PCM_STATE_PREPARED' state. Some devices are not able to manage this and they will stop playback if the sample rate will be configured several times over USB protocol. V2: updated Changelog Signed-off-by: Daniel Girnus <dgirnus@de.adit-jv.com> Signed-off-by: Jens Lorenz <jlorenz@de.adit-jv.com> Signed-off-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/pcm.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 44d178e..a522c9a 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -806,17 +806,18 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
if (ret < 0)
goto unlock;
- iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
- alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
- ret = snd_usb_init_sample_rate(subs->stream->chip,
- subs->cur_audiofmt->iface,
- alts,
- subs->cur_audiofmt,
- subs->cur_rate);
- if (ret < 0)
- goto unlock;
-
if (subs->need_setup_ep) {
+
+ iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
+ alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
+ ret = snd_usb_init_sample_rate(subs->stream->chip,
+ subs->cur_audiofmt->iface,
+ alts,
+ subs->cur_audiofmt,
+ subs->cur_rate);
+ if (ret < 0)
+ goto unlock;
+
ret = configure_endpoint(subs);
if (ret < 0)
goto unlock;
OpenPOWER on IntegriCloud