Skip to contentSkip to conversation

ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops

PATCH Applied Aaron Ma 3 participants 4 messages Aug 4 – Aug 5 Sound

lore
Share & tools
lore

Aaron Ma

author
#0 lore raw

PATCH v2 1/2 ALSA: hda/realtek: Fix headset mic on Legion AW88399 laptops

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.

---
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(-)
sound/hda/codecs/realtek/alc269.c +4 -6
index f7877127e0e49..30d71575bac3b 100644
@@ -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;
 	}
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v2 2/2 ALSA: hda/realtek: Limit Legion AW88399 playback to stereo

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.

---
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(+)
sound/hda/codecs/realtek/alc269.c +4 -0
index 30d71575bac3b..1231d9bfeeb16 100644
@@ -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;
 	}
 }
 
Signature · 1 line
2.53.0
Reviewed-by Tested-by on v2 1/2
#2 lore raw
In reply to Aaron Ma

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:

Best regards,
Marco

Applied
#3 lore raw
In reply to Aaron Ma
Quoted 15 lines · Aaron Ma

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.

Quoted 6 lines

---
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