aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-04-25 08:32:24 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-26 01:37:09 -0400
commitfa92dd77ec5623cc0546acb77ee61a0a7ea4f0f0 (patch)
tree4d5b8b0fe47eaf9ab35c74ea7fc530068579eb0b /sound
parent4b417cf01657c8dcd03abb0aa49f3825fede6539 (diff)
ALSA: usb - Avoid unnecessary sample rate changes on USB 2.0 clock sources
The Scarlett 2i2 seems to take almost 500 ms to set the sample rate, even if the clock is currently set to that value. This patch speeds up prepare of the device, by avoiding setting the clock to something it already is. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/clock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index b0ec3643eb62..3a2ce390e278 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -356,6 +356,8 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
356 return clock; 356 return clock;
357 357
358 prev_rate = get_sample_rate_v2(chip, iface, fmt->altsetting, clock); 358 prev_rate = get_sample_rate_v2(chip, iface, fmt->altsetting, clock);
359 if (prev_rate == rate)
360 return 0;
359 361
360 cs_desc = snd_usb_find_clock_source(chip->ctrl_intf, clock); 362 cs_desc = snd_usb_find_clock_source(chip->ctrl_intf, clock);
361 writeable = uac2_control_is_writeable(cs_desc->bmControls, UAC2_CS_CONTROL_SAM_FREQ - 1); 363 writeable = uac2_control_is_writeable(cs_desc->bmControls, UAC2_CS_CONTROL_SAM_FREQ - 1);