aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Girnus <dgirnus@de.adit-jv.com>2016-12-06 00:46:15 -0500
committerTakashi Iwai <tiwai@suse.de>2016-12-06 07:55:15 -0500
commit1e2e3fe480064ca33186e5a923beaa160efed35d (patch)
treeab3155a9ffd5391a54b5072a798615e71d382b54
parent4763601a56f155ddf94ef35fc2c41504a2de15f5 (diff)
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>
-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 44d178ee9177..a522c9af1f34 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)
806 if (ret < 0) 806 if (ret < 0)
807 goto unlock; 807 goto unlock;
808 808
809 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
810 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
811 ret = snd_usb_init_sample_rate(subs->stream->chip,
812 subs->cur_audiofmt->iface,
813 alts,
814 subs->cur_audiofmt,
815 subs->cur_rate);
816 if (ret < 0)
817 goto unlock;
818
819 if (subs->need_setup_ep) { 809 if (subs->need_setup_ep) {
810
811 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
812 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
813 ret = snd_usb_init_sample_rate(subs->stream->chip,
814 subs->cur_audiofmt->iface,
815 alts,
816 subs->cur_audiofmt,
817 subs->cur_rate);
818 if (ret < 0)
819 goto unlock;
820
820 ret = configure_endpoint(subs); 821 ret = configure_endpoint(subs);
821 if (ret < 0) 822 if (ret < 0)
822 goto unlock; 823 goto unlock;