[PATCH v2] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

From: Macpaul Lin
Date: Tue Nov 10 2020 - 03:43:27 EST


The HUAWEI USB-C headset (VID:0x12d1, PID:0x3a07) reported it supports
96khz. However there will be some random issue under 96khz.
Not sure if there is any alternate setting could be applied.
Hence 48khz is suggested to be applied at this moment.

Signed-off-by: Macpaul Lin <macpaul.lin@xxxxxxxxxxxx>
Signed-off-by: Eddie Hung <eddie.hung@xxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
Changes for v2:
- Fix build error.
- Add Cc: stable@xxxxxxxxxxxxxxx

sound/usb/format.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/sound/usb/format.c b/sound/usb/format.c
index 1b28d01..7a4837b 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -202,6 +202,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
fp->rate_min = fp->rate_max = 0;
for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
unsigned int rate = combine_triple(&fmt[idx]);
+ struct usb_device *udev = chip->dev;
if (!rate)
continue;
/* C-Media CM6501 mislabels its 96 kHz altsetting */
@@ -217,6 +218,11 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
(chip->usb_id == USB_ID(0x041e, 0x4064) ||
chip->usb_id == USB_ID(0x041e, 0x4068)))
rate = 8000;
+ /* Huawei headset can't support 96kHz fully */
+ if (rate == 96000 &&
+ chip->usb_id == USB_ID(0x12d1, 0x3a07) &&
+ le16_to_cpu(udev->descriptor.bcdDevice) == 0x49)
+ continue;

fp->rate_table[fp->nr_rates] = rate;
if (!fp->rate_min || rate < fp->rate_min)
--
1.7.9.5