Linux Sound subsystem development
 help / color / mirror / Atom feed
* Re: ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14  (SN6140)
       [not found] <ME3PR01MB7504E1F31E26F760F73DF639BDBD2@ME3PR01MB7504.ausprd01.prod.outlook.com>
@ 2026-09-14 16:04 ` Takashi Iwai
  2026-09-19 13:46   ` 刘 栋
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2026-09-14 16:04 UTC (permalink / raw)
  To: 刘 栋
  Cc: linux-sound@vger.kernel.org, tiwai@suse.de, perex@perex.cz

On Sat, 12 Sep 2026 16:03:55 +0200,
刘 栋 wrote:
> 
> 
> Sir/Madam,
> 
> On the Huawei MateBook 14 (PCI SSID 19e5:329e), the SN6140 codec
> silently routes the speaker output through the headphone pin's
> connection select: whatever DAC the headphone pin 0x16 is connected to,
> the speaker pin 0x17 follows. The generic parser attaches the playback
> stream to DAC 0x10 (shared by the headphone path) and mutes that DAC
> when no headphone is plugged, silencing the internal speaker while the
> headphone jack keeps working.
> 
> Add a quirk for this machine that suppresses the auto-mute, binds the
> speaker pin to the shared DAC 0x10, removes the mute switch on that DAC
> so userspace cannot mute it, and re-applies the routing after every
> output update; at init it routes both pins to DAC 0x10, enables the
> speaker EAPD (which the driver otherwise leaves off) and unmutes the
> DAC.
> 
> Note that this is a different problem than the existing Huawei
> Matebook quirk for SSID 19e5:3289 (commit d152afd1cd7a), which fixes a
> missing headphone jack; that machine has working speakers.
> 
> Tested on Ubuntu 26.04 (kernels 7.0.0-30 and 7.0.0-31): the speaker
> plays at boot without any userspace helper, and keeps working across
> suspend/resume.
> 
> Signed-off-by: liudongxjtu <liudongxjtu@outlook.com>

The patch can't be applied because your mailer broke the spaces.

Please try to resubmit with a fixed mailer setup; at best use
git-send-email.

About the patch: please drop the heading "Sir/Madam".  The patch
description will be taken as the commit log as is, so such a greeting
doesn't fit at all.

Also, spelling your name in a bit more Western style (using
capital/lower letters and putting a space between first name and last
name) would be better.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14 (SN6140)
  2026-09-14 16:04 ` ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14 (SN6140) Takashi Iwai
@ 2026-09-19 13:46   ` 刘 栋
  2026-09-28 13:59     ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: 刘 栋 @ 2026-09-19 13:46 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-sound@vger.kernel.org, perex@perex.cz


[-- Attachment #1.1: Type: text/plain, Size: 2390 bytes --]

Resubmitting as v2 with the patch attached, since the web mailer
mangles whitespace in inline text.  Please apply from the attachment.

Changes in v2 are listed after the --- line in the patch file.

________________________________
发件人: Takashi Iwai <tiwai@suse.de>
发送时间: 2026年9月15日 0:04
收件人: 刘 栋 <liudongxjtu@outlook.com>
抄送: linux-sound@vger.kernel.org <linux-sound@vger.kernel.org>; tiwai@suse.de <tiwai@suse.de>; perex@perex.cz <perex@perex.cz>
主题: Re: ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14 (SN6140)

On Sat, 12 Sep 2026 16:03:55 +0200,
刘 栋 wrote:
>
>
> Sir/Madam,
>
> On the Huawei MateBook 14 (PCI SSID 19e5:329e), the SN6140 codec
> silently routes the speaker output through the headphone pin's
> connection select: whatever DAC the headphone pin 0x16 is connected to,
> the speaker pin 0x17 follows. The generic parser attaches the playback
> stream to DAC 0x10 (shared by the headphone path) and mutes that DAC
> when no headphone is plugged, silencing the internal speaker while the
> headphone jack keeps working.
>
> Add a quirk for this machine that suppresses the auto-mute, binds the
> speaker pin to the shared DAC 0x10, removes the mute switch on that DAC
> so userspace cannot mute it, and re-applies the routing after every
> output update; at init it routes both pins to DAC 0x10, enables the
> speaker EAPD (which the driver otherwise leaves off) and unmutes the
> DAC.
>
> Note that this is a different problem than the existing Huawei
> Matebook quirk for SSID 19e5:3289 (commit d152afd1cd7a), which fixes a
> missing headphone jack; that machine has working speakers.
>
> Tested on Ubuntu 26.04 (kernels 7.0.0-30 and 7.0.0-31): the speaker
> plays at boot without any userspace helper, and keeps working across
> suspend/resume.
>
> Signed-off-by: liudongxjtu <liudongxjtu@outlook.com>

The patch can't be applied because your mailer broke the spaces.

Please try to resubmit with a fixed mailer setup; at best use
git-send-email.

About the patch: please drop the heading "Sir/Madam".  The patch
description will be taken as the commit log as is, so such a greeting
doesn't fit at all.

Also, spelling your name in a bit more Western style (using
capital/lower letters and putting a space between first name and last
name) would be better.


thanks,

Takashi

[-- Attachment #1.2: Type: text/html, Size: 4074 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ALSA-hda-conexant-Fix-silent-speaker-on-Huawei-MateB.patch --]
[-- Type: text/x-patch; name="0001-ALSA-hda-conexant-Fix-silent-speaker-on-Huawei-MateB.patch", Size: 5746 bytes --]

From 8c92414221287ffd84b630c07e560acde9f340ea Mon Sep 17 00:00:00 2001
From: Liu Eason <liudongxjtu@outlook.com>
Date: Sat, 19 Sep 2026 21:08:13 +0800
Subject: [PATCH v2] ALSA: hda/conexant: Fix silent speaker on Huawei MateBook
 14 (SN6140)

On the Huawei MateBook 14 (PCI SSID 19e5:329e), the SN6140 codec
silently routes the speaker output through the headphone pin's
connection select: whatever DAC the headphone pin 0x16 is connected to,
the speaker pin 0x17 follows.  The generic parser attaches the playback
stream to DAC 0x10 (shared by the headphone path) and mutes that DAC
when no headphone is plugged, silencing the internal speaker while the
headphone jack keeps working.

Add a quirk for this machine that suppresses the auto-mute, binds the
speaker pin to the shared DAC 0x10, removes the mute switch on that DAC
so userspace cannot mute it, and re-applies the routing after every
output update; at init it routes both pins to DAC 0x10, enables the
speaker EAPD (which the driver otherwise leaves off) and unmutes the
DAC.

Note that this is a different problem than the existing Huawei
Matebook quirk for SSID 19e5:3289 (commit d152afd1cd7a), which fixes a
missing headphone jack; that machine has working speakers.

Tested on Ubuntu 26.04 (kernels 7.0.0-30 and 7.0.0-31): the speaker
plays at boot without any userspace helper, and keeps working across
suspend/resume.

Signed-off-by: Liu Eason <liudongxjtu@outlook.com>
---
Changes in v2:
- Move the amp-caps override to HDA_FIXUP_ACT_PROBE: at pre-probe time
  the codec regmap is not available yet, so the mute-switch removal was
  a silent no-op there
- Re-apply the pin routing after every output update via the auto-mute
  hook
- Unmute the shared DAC at -30dB instead of 0dB so that the vmaster
  volume keeps a usable range until userspace takes over
- Update the tested notes with suspend/resume and the kernel update
  from 7.0.0-30 to 7.0.0-31

 sound/hda/codecs/conexant.c | 67 +++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index 7357dc9..5da5077 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -293,6 +293,7 @@ enum {
 	CXT_FIXUP_HP_A_U,
 	CXT_FIXUP_ACER_SWIFT_HP,
 	CXT_FIXUP_HUAWEI_MATEBOOK_HP,
+	CXT_FIXUP_MATEBOOK14_SN6140,
 };
 
 /* for hda_fixup_thinkpad_acpi() */
@@ -798,6 +799,67 @@ static void cxt_fixup_hp_a_u(struct hda_codec *codec,
 		cxt_setup_gpio_unmute(codec, 0x2);
 }
 
+/* Huawei MateBook 14 (SN6140): the speaker output follows the headphone
+ * pin's connection select in hardware.  Both pins must be routed to the
+ * shared DAC 0x10, which carries the playback stream; the generic
+ * parser mutes that DAC when no headphone is plugged, silencing the
+ * speaker.  Suppress the auto-mute, bind the speaker pin to the shared
+ * DAC, remove its mute switch and keep it unmuted; the auto-mute hook
+ * re-applies the routing after every output update.
+ */
+static void cxt_mb14_route_unmute(struct hda_codec *codec)
+{
+	/* route both pins to the shared DAC 0x10, enable the speaker
+	 * EAPD and unmute the DAC at a moderate gain; the vmaster
+	 * volume takes over once userspace starts
+	 */
+	snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_CONNECT_SEL, 0);
+	snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_CONNECT_SEL, 0);
+	snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_EAPD_BTLENABLE, 0x02);
+	snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
+				 HDA_AMP_VOLMASK | HDA_AMP_MUTE, 0x40);
+}
+
+static void cxt_mb14_automute(struct hda_codec *codec)
+{
+	snd_hda_gen_update_outputs(codec);
+	cxt_mb14_route_unmute(codec);
+}
+
+static void cxt_fixup_matebook14_sn6140(struct hda_codec *codec,
+					const struct hda_fixup *fix, int action)
+{
+	struct conexant_spec *spec = codec->spec;
+
+	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+		static const hda_nid_t dac_0x10[] = { 0x10 };
+
+		spec->gen.suppress_auto_mute = 1;
+		spec->gen.automute_hook = cxt_mb14_automute;
+		/* Bind the speaker pin to the shared DAC 0x10.
+		 */
+		snd_hda_override_conn_list(codec, 0x17, 1, dac_0x10);
+		return;
+	}
+	if (action == HDA_FIXUP_ACT_PROBE) {
+		unsigned int caps;
+
+		/* Remove the mute switch on the shared DAC so that
+		 * userspace (WirePlumber) cannot mute it when the
+		 * headphone route becomes unavailable (e.g. after
+		 * resume).  Must be done here: the codec regmap is not
+		 * available at pre-probe time.
+		 */
+		caps = query_amp_caps(codec, 0x10, HDA_OUTPUT);
+		snd_hda_override_amp_caps(codec, 0x10, HDA_OUTPUT,
+					  caps & ~AC_AMPCAP_MUTE);
+		return;
+	}
+	if (action != HDA_FIXUP_ACT_INIT)
+		return;
+	cxt_mb14_route_unmute(codec);
+}
+
 /* ThinkPad X200 & co with cxt5051 */
 static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
 	{ 0x16, 0x042140ff }, /* HP (seq# overridden) */
@@ -1043,6 +1105,10 @@ static const struct hda_fixup cxt_fixups[] = {
 			{ }
 		},
 	},
+	[CXT_FIXUP_MATEBOOK14_SN6140] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = cxt_fixup_matebook14_sn6140,
+	},
 };
 
 static const struct hda_quirk cxt5045_fixups[] = {
@@ -1145,6 +1211,7 @@ static const struct hda_quirk cxt5066_fixups[] = {
 	SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad/Ideapad", CXT_FIXUP_LENOVO_XPAD_ACPI),
 	SND_PCI_QUIRK(0x19e5, 0x3289, "Huawei Matebook", CXT_FIXUP_HUAWEI_MATEBOOK_HP),
+	SND_PCI_QUIRK(0x19e5, 0x329e, "Huawei MateBook 14", CXT_FIXUP_MATEBOOK14_SN6140),
 	SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
 	SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
 	SND_PCI_QUIRK(0x1d05, 0x3012, "MECHREVO Wujie 15X Pro", CXT_FIXUP_HEADSET_MIC),
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14  (SN6140)
  2026-09-19 13:46   ` 刘 栋
@ 2026-09-28 13:59     ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2026-09-28 13:59 UTC (permalink / raw)
  To: 刘 栋
  Cc: Takashi Iwai, linux-sound@vger.kernel.org, perex@perex.cz

On Sat, 19 Sep 2026 15:46:33 +0200,
刘 栋 wrote:
> 
> 
> Resubmitting as v2 with the patch attached, since the web mailer
> mangles whitespace in inline text.  Please apply from the attachment.
> 
> Changes in v2 are listed after the --- line in the patch file.

Applied to for-next branch now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-28 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ME3PR01MB7504E1F31E26F760F73DF639BDBD2@ME3PR01MB7504.ausprd01.prod.outlook.com>
2026-09-14 16:04 ` ALSA: hda/conexant: Fix silent speaker on Huawei MateBook 14 (SN6140) Takashi Iwai
2026-09-19 13:46   ` 刘 栋
2026-09-28 13:59     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox