[PATCH 2/3] ALSA: hda/realtek: Use quad channel map for Legion AW88399 speakers

Aaron Ma <[email protected]> Sat, 1 Aug 2026 14:06:29 +0800
Newsgroups gmane.linux.sound,gmane.linux.kernel
Message-ID <[email protected]>
The Lenovo Legion machines pairing an ALC287 codec with two AW88399
smart amplifiers have four speaker channels. The second pair is
full-range rear, not an LFE channel, so the default mapping is wrong.

Advertise FL/FR/RL/RR quad channel maps on the playback stream so
4-channel streams are routed correctly.

Signed-off-by: Aaron Ma <[email protected]>
---
 sound/hda/codecs/realtek/alc269.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index 2e3f7f1b52782..42fcdfe54225a 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -3268,6 +3268,15 @@ static void find_cirrus_companion_amps(struct hda_codec *cdc)
 	comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
 }
 
+static const struct snd_pcm_chmap_elem aw88399_pcm_quad_chmaps[] = {
+	{ .channels = 2,
+	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
+	{ .channels = 4,
+	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
+		   SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
+	{ }
+};
+
 static void aw88399_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
 {
 	struct alc_spec *spec = cdc->spec;
@@ -3276,6 +3285,10 @@ static void aw88399_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup
 		spec->gen.suppress_auto_mic = 1;
 
 	comp_generic_fixup(cdc, action, "i2c", "AWDZ8399", "-%s:00-aw88399-hda.%d", 2);
+	/* the second speaker pair is full-range rear, not LFE */
+	if (action == HDA_FIXUP_ACT_BUILD)
+		spec->gen.pcm_rec[0]->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
+			aw88399_pcm_quad_chmaps;
 }
 
 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
-- 
2.53.0