Skip to content

Commit

Permalink
ALSA: usb-audio: Optimize TEAC clock quirk
Browse files Browse the repository at this point in the history
commit 3753fcc upstream.

Maris found out that the quirk for TEAC devices to work around the
clock setup is needed to apply only when the base clock is changed,
e.g. from 48000-based clocks (48000, 96000, 192000, 384000) to
44100-based clocks (44100, 88200, 176400, 352800), or vice versa,
while switching to another clock with the same base clock doesn't need
the (forcible) interface setup.

This patch implements the optimization for the TEAC clock quirk to
avoid the unnecessary interface re-setup.

Fixes: 5ce0b06 ("ALSA: usb-audio: Workaround for clock setup on TEAC devices")
Reported-by: Maris Abele <maris7abele@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220531130749.30357-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
tiwai authored and gregkh committed Jun 6, 2022
1 parent 6099a6c commit 37fad50
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sound/usb/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,14 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip,
}

/* FIXME - TEAC devices require the immediate interface setup */
if (rate != prev_rate && USB_ID_VENDOR(chip->usb_id) == 0x0644) {
usb_set_interface(chip->dev, fmt->iface, fmt->altsetting);
if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY)
msleep(50);
if (USB_ID_VENDOR(chip->usb_id) == 0x0644) {
bool cur_base_48k = (rate % 48000 == 0);
bool prev_base_48k = (prev_rate % 48000 == 0);
if (cur_base_48k != prev_base_48k) {
usb_set_interface(chip->dev, fmt->iface, fmt->altsetting);
if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY)
msleep(50);
}
}

validation:
Expand Down

0 comments on commit 37fad50

Please sign in to comment.