Commit 1e2e3fe4 authored by Daniel Girnus's avatar Daniel Girnus Committed by Takashi Iwai

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: default avatarDaniel Girnus <dgirnus@de.adit-jv.com>
Signed-off-by: default avatarJens Lorenz <jlorenz@de.adit-jv.com>
Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4763601a
...@@ -806,6 +806,8 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -806,6 +806,8 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
if (subs->need_setup_ep) {
iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
ret = snd_usb_init_sample_rate(subs->stream->chip, ret = snd_usb_init_sample_rate(subs->stream->chip,
...@@ -816,7 +818,6 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -816,7 +818,6 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
if (subs->need_setup_ep) {
ret = configure_endpoint(subs); ret = configure_endpoint(subs);
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment