Skip to content

Commit

Permalink
ALSA: usb - Avoid unnecessary sample rate changes on USB 2.0 clock so…
Browse files Browse the repository at this point in the history
…urces

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>
  • Loading branch information
David Henningsson authored and tiwai committed Apr 26, 2013
1 parent 4b417cf commit fa92dd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/usb/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa92dd7

Please sign in to comment.