The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops
@ 2026-08-04 18:53 Aaron Ma
  2026-08-04 18:53 ` [PATCH v2 2/2] ALSA: hda/realtek: Limit Legion AW88399 playback to stereo Aaron Ma
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aaron Ma @ 2026-08-04 18:53 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
	marco_giunta
  Cc: Zhang Heng, Kailang Yang, Damien Dagorn, Bob Song, Lei Huang,
	Sean Rhodes

The ALC287 codec on Lenovo Legion AW88399 laptops does not mark
the combo-jack microphone as a headset mic, so the HDA parser
treats it as a plain microphone. The headset microphone route
and inline headset buttons are therefore unavailable.

Enable Realtek headset mode without treating the jack as a
headphone microphone, and enable headset jack button handling.
Suppress automatic microphone selection so the internal microphone
remains selectable while a headset is connected.

The existing 0x1d override is redundant: firmware already marks
that pin unused, and the override triggers a "SKU not ready
0x411111f0" warning. Drop it.

Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
Changes in v2:
- Based on the original 1/3 (df2538d54b3c0 "Use AW88399 I2C fixup
  chain on Legion machines"): reworked to enable headset-mic mode
  and inline buttons.

 sound/hda/codecs/realtek/alc269.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index f7877127e0e49..30d71575bac3b 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -3276,21 +3276,19 @@ static void aw88399_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup
 static void alc287_fixup_legion_16iax10h_aw88399(struct hda_codec *codec,
 						 const struct hda_fixup *fix, int action)
 {
-	static const struct hda_pintbl pincfgs[] = {
-		{ 0x1d, 0x411111f0 }, /* unused bogus pin */
-		{ }
-	};
-
 	/*
 	 * Force DAC 0x02 for the bass speaker 0x17, as the default 0x06 lacks volume controls.
 	 */
 	static const hda_nid_t conn[] = { 0x02 };
+	struct alc_spec *spec = codec->spec;
 
 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
+	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
+	alc_fixup_headset_jack(codec, fix, action);
 
 	switch (action) {
 	case HDA_FIXUP_ACT_PRE_PROBE:
-		snd_hda_apply_pincfgs(codec, pincfgs);
+		spec->gen.suppress_auto_mic = 1;
 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
 		break;
 	}
-- 
2.53.0


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

* [PATCH v2 2/2] ALSA: hda/realtek: Limit Legion AW88399 playback to stereo
  2026-08-04 18:53 [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Aaron Ma
@ 2026-08-04 18:53 ` Aaron Ma
  2026-08-05  7:45 ` [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Marco Giunta
  2026-08-05  8:11 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Ma @ 2026-08-04 18:53 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
	marco_giunta
  Cc: Zhang Heng, Kailang Yang, Damien Dagorn, Bob Song, Lei Huang,
	Sean Rhodes

The Legion AW88399 speaker routing sends a stereo FL/FR stream
to both speaker pairs. A four-channel stream leaves the front
pair silent, so advertising four channels exposes an unusable
playback mode.

Limit the analogue PCM and the multi-output runtime constraint
to two channels for the affected Legion codec SSIDs. This
exposes the usable stereo configuration and rejects
four-channel playback.

Signed-off-by: Aaron Ma <mapengyu@gmail.com>
---
Changes in v2:
- Based on the original 2/3 (39adb275a45cd "Use quad channel map for
  Legion AW88399 speakers"), reworked: instead of advertising a quad
  channel map, playback is now limited to stereo because both speaker
  pairs carry the same stereo signal.

 sound/hda/codecs/realtek/alc269.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index 30d71575bac3b..1231d9bfeeb16 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -3291,6 +3291,10 @@ static void alc287_fixup_legion_16iax10h_aw88399(struct hda_codec *codec,
 		spec->gen.suppress_auto_mic = 1;
 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
 		break;
+	case HDA_FIXUP_ACT_BUILD:
+		spec->gen.multiout.max_channels = 2;
+		spec->gen.pcm_rec[0]->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 2;
+		break;
 	}
 }
 
-- 
2.53.0


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

* Re: [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops
  2026-08-04 18:53 [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Aaron Ma
  2026-08-04 18:53 ` [PATCH v2 2/2] ALSA: hda/realtek: Limit Legion AW88399 playback to stereo Aaron Ma
@ 2026-08-05  7:45 ` Marco Giunta
  2026-08-05  8:11 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Marco Giunta @ 2026-08-05  7:45 UTC (permalink / raw)
  To: mapengyu
  Cc: damien.dagorn29, huanglei, kailang, linux-kernel, linux-sound,
	marco_giunta, perex, sean, songxiebing, tiwai, zhangheng

Hi Aaron,

Thank you for this, both patches look good to me. You addressed all
my previous points and I have no further objections (in fact, I think
these are clever and useful solutions).

Tested on Legion Pro 7 16AFR10H (SSID 17aa:3938): headset buttons work,
internal mic remains selectable with headset plugged in, SKU warning gone,
and no bogus 4.0 profiles exposed anymore.

For both patches:
Reviewed-by: Marco Giunta <marco_giunta@outlook.it>
Tested-by: Marco Giunta <marco_giunta@outlook.it>

Best regards,
Marco

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

* Re: [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops
  2026-08-04 18:53 [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Aaron Ma
  2026-08-04 18:53 ` [PATCH v2 2/2] ALSA: hda/realtek: Limit Legion AW88399 playback to stereo Aaron Ma
  2026-08-05  7:45 ` [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Marco Giunta
@ 2026-08-05  8:11 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-08-05  8:11 UTC (permalink / raw)
  To: Aaron Ma
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel,
	marco_giunta, Zhang Heng, Kailang Yang, Damien Dagorn, Bob Song,
	Lei Huang, Sean Rhodes

On Tue, 04 Aug 2026 20:53:24 +0200,
Aaron Ma wrote:
> 
> The ALC287 codec on Lenovo Legion AW88399 laptops does not mark
> the combo-jack microphone as a headset mic, so the HDA parser
> treats it as a plain microphone. The headset microphone route
> and inline headset buttons are therefore unavailable.
> 
> Enable Realtek headset mode without treating the jack as a
> headphone microphone, and enable headset jack button handling.
> Suppress automatic microphone selection so the internal microphone
> remains selectable while a headset is connected.
> 
> The existing 0x1d override is redundant: firmware already marks
> that pin unused, and the override triggers a "SKU not ready
> 0x411111f0" warning. Drop it.
> 
> Signed-off-by: Aaron Ma <mapengyu@gmail.com>
> ---
> Changes in v2:
> - Based on the original 1/3 (df2538d54b3c0 "Use AW88399 I2C fixup
>   chain on Legion machines"): reworked to enable headset-mic mode
>   and inline buttons.

Applied both patches to for-next branch now.


thanks,

Takashi

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

end of thread, other threads:[~2026-08-05  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 18:53 [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Aaron Ma
2026-08-04 18:53 ` [PATCH v2 2/2] ALSA: hda/realtek: Limit Legion AW88399 playback to stereo Aaron Ma
2026-08-05  7:45 ` [PATCH v2 1/2] ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops Marco Giunta
2026-08-05  8:11 ` Takashi Iwai

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