From: David Henningsson Date: Thu, 25 Apr 2013 12:32:24 +0000 (+0200) Subject: ALSA: usb - Avoid unnecessary sample rate changes on USB 2.0 clock sources X-Git-Tag: upstream/snapshot3+hdmi~5112^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa92dd77ec5623cc0546acb77ee61a0a7ea4f0f0;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Takashi Iwai --- diff --git a/sound/usb/clock.c b/sound/usb/clock.c index b0ec364..3a2ce39 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, return clock; prev_rate = get_sample_rate_v2(chip, iface, fmt->altsetting, clock); + if (prev_rate == rate) + return 0; cs_desc = snd_usb_find_clock_source(chip->ctrl_intf, clock); writeable = uac2_control_is_writeable(cs_desc->bmControls, UAC2_CS_CONTROL_SAM_FREQ - 1);