2020-11-10 08:08:45

by Macpaul Lin

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

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 <[email protected]>
Signed-off-by: Eddie Hung <[email protected]>
---
sound/usb/format.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/sound/usb/format.c b/sound/usb/format.c
index 1b28d01..6f6e79b 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -217,6 +217,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


2020-11-10 08:15:11

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

On Tue, 10 Nov 2020 09:04:03 +0100,
Macpaul Lin wrote:
>
> 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 <[email protected]>
> Signed-off-by: Eddie Hung <[email protected]>
> ---
> sound/usb/format.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/sound/usb/format.c b/sound/usb/format.c
> index 1b28d01..6f6e79b 100644
> --- a/sound/usb/format.c
> +++ b/sound/usb/format.c
> @@ -217,6 +217,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)

This causes the compile error due to the unknown udev.
Is this bcdDevice check mandatory?


thanks,

Takashi

2020-11-10 08:20:17

by Macpaul Lin

[permalink] [raw]
Subject: Re: [PATCH] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

On Tue, 2020-11-10 at 09:12 +0100, Takashi Iwai wrote:
> On Tue, 10 Nov 2020 09:04:03 +0100,
> Macpaul Lin wrote:
> >
> > 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 <[email protected]>
> > Signed-off-by: Eddie Hung <[email protected]>
> > ---
> > sound/usb/format.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/sound/usb/format.c b/sound/usb/format.c
> > index 1b28d01..6f6e79b 100644
> > --- a/sound/usb/format.c
> > +++ b/sound/usb/format.c
> > @@ -217,6 +217,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)
>
> This causes the compile error due to the unknown udev.
> Is this bcdDevice check mandatory?

This means firmware version of the headset as far as I know..
Sorry I'll check the compile error and resend later.

>
> thanks,
>
> Takashi

Thanks
Macpaul Lin

2020-11-10 08:26:07

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

On Tue, 10 Nov 2020 09:17:46 +0100,
Macpaul Lin wrote:
>
> On Tue, 2020-11-10 at 09:12 +0100, Takashi Iwai wrote:
> > On Tue, 10 Nov 2020 09:04:03 +0100,
> > Macpaul Lin wrote:
> > >
> > > 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 <[email protected]>
> > > Signed-off-by: Eddie Hung <[email protected]>
> > > ---
> > > sound/usb/format.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/sound/usb/format.c b/sound/usb/format.c
> > > index 1b28d01..6f6e79b 100644
> > > --- a/sound/usb/format.c
> > > +++ b/sound/usb/format.c
> > > @@ -217,6 +217,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)
> >
> > This causes the compile error due to the unknown udev.
> > Is this bcdDevice check mandatory?
>
> This means firmware version of the headset as far as I know..

OK, then it's useful.

> Sorry I'll check the compile error and resend later.

I guess the only needed change is to replace udev with chip->dev.


thanks,

Takashi

>
> >
> > thanks,
> >
> > Takashi
>
> Thanks
> Macpaul Lin
>

2020-11-10 08:47:04

by Macpaul Lin

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

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 <[email protected]>
Signed-off-by: Eddie Hung <[email protected]>
Cc: [email protected]
---
Changes for v2:
- Fix build error.
- Add Cc: [email protected]

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

2020-11-10 08:51:38

by Greg KH

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

On Tue, Nov 10, 2020 at 04:42:54PM +0800, Macpaul Lin wrote:
> 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 <[email protected]>
> Signed-off-by: Eddie Hung <[email protected]>
> Cc: [email protected]
> ---
> Changes for v2:
> - Fix build error.
> - Add Cc: [email protected]
>
> 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 */

Did you run this patch through checkpatch.pl?

2020-11-10 08:58:24

by Macpaul Lin

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

On Tue, 2020-11-10 at 09:50 +0100, Greg KH wrote:
> On Tue, Nov 10, 2020 at 04:42:54PM +0800, Macpaul Lin wrote:
> > 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 <[email protected]>
> > Signed-off-by: Eddie Hung <[email protected]>
> > Cc: [email protected]
> > ---
> > Changes for v2:
> > - Fix build error.
> > - Add Cc: [email protected]
> >
> > 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 */
>
> Did you run this patch through checkpatch.pl?
>

I've ran checkpatch for this patch v2, and it shown
"total: 0 errors, 0 warnings". We're using 5.9-rc1 internal.

However, I'll send patch v3 according to Takashi's suggestion.

Thanks
Macpaul Lin

2020-11-10 09:08:26

by Macpaul Lin

[permalink] [raw]
Subject: [PATCH v3] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

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 <[email protected]>
Signed-off-by: Eddie Hung <[email protected]>
Cc: [email protected]
---
Changes for v2:
- Fix build error.
- Add Cc: [email protected]
Changes for v3:
- Replace "udev" with "chip->dev" according to Takashi's suggestion. Thanks.

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

diff --git a/sound/usb/format.c b/sound/usb/format.c
index 1b28d01..0aff774 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -217,6 +217,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(chip->dev->descriptor.bcdDevice) == 0x49)
+ continue;

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

2020-11-18 05:27:59

by Macpaul Lin

[permalink] [raw]
Subject: Re: [PATCH v3] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

On Tue, 2020-11-10 at 17:04 +0800, Macpaul Lin wrote:
> 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 <[email protected]>
> Signed-off-by: Eddie Hung <[email protected]>
> Cc: [email protected]
> ---
> Changes for v2:
> - Fix build error.
> - Add Cc: [email protected]
> Changes for v3:
> - Replace "udev" with "chip->dev" according to Takashi's suggestion. Thanks.
>
> sound/usb/format.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/sound/usb/format.c b/sound/usb/format.c
> index 1b28d01..0aff774 100644
> --- a/sound/usb/format.c
> +++ b/sound/usb/format.c
> @@ -217,6 +217,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(chip->dev->descriptor.bcdDevice) == 0x49)
> + continue;
>
> fp->rate_table[fp->nr_rates] = rate;
> if (!fp->rate_min || rate < fp->rate_min)

Sorry for bothering again, please hold-on this patch.
I'm still trying to clarify if there is another approach for this
interoperability issue.
I'll update this thread once the result has came out.

Thanks
Macpaul Lin

2020-11-18 07:37:23

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v3] ALSA: usb-audio: disable 96khz support for HUAWEI USB-C HEADSET

On Wed, 18 Nov 2020 06:26:06 +0100,
Macpaul Lin wrote:
>
> On Tue, 2020-11-10 at 17:04 +0800, Macpaul Lin wrote:
> > 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 <[email protected]>
> > Signed-off-by: Eddie Hung <[email protected]>
> > Cc: [email protected]
> > ---
> > Changes for v2:
> > - Fix build error.
> > - Add Cc: [email protected]
> > Changes for v3:
> > - Replace "udev" with "chip->dev" according to Takashi's suggestion. Thanks.
> >
> > sound/usb/format.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/sound/usb/format.c b/sound/usb/format.c
> > index 1b28d01..0aff774 100644
> > --- a/sound/usb/format.c
> > +++ b/sound/usb/format.c
> > @@ -217,6 +217,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(chip->dev->descriptor.bcdDevice) == 0x49)
> > + continue;
> >
> > fp->rate_table[fp->nr_rates] = rate;
> > if (!fp->rate_min || rate < fp->rate_min)
>
> Sorry for bothering again, please hold-on this patch.
> I'm still trying to clarify if there is another approach for this
> interoperability issue.
> I'll update this thread once the result has came out.

OK, thanks for information.


Takashi