mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: tas2783-sdw: restore the stereo split when no SDCA function data
@ 2026-12-03 22:18 Lee Mann
  0 siblings, 0 replies; only message in thread
From: Lee Mann @ 2026-12-03 22:18 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, linux-sound
  Cc: Baojun Xu, Shenghao Ding, Niranjan H Y, Waldemar Hamm,
	Thorsten Leemhuis, regressions, Antoine Monnet, Andrey Golovko,
	Pierre-Louis Bossart, Matthew Schwartz, linux-kernel

Commit f42fbd560cd8 ("ASoC: tas2783-sdw: add firmware download status
check") removed the per-amp channel mask from tas_sdw_hw_params(), on
the basis that the channel is selected by the SDCA init table from
ACPI DisCo.

That only holds when the SmartAmp function is parsed. On the ASUS
ProArt PX13 (HN7306EA, two TAS2783 on SoundWire link 1) the ACPI
declares the function type without a DisCo constant, so
sdca_parse_function() fails, sa_func_data stays NULL and the init
table is never written. Both amps keep the PPU21 Posture Number
(0x01) from tas2783_init_seq and, with the full playback mask, the
right speaker is silent.

Restore the split for that case only: when sa_func_data is NULL and
the link has one amp per channel, give each amp a single channel, as
before f42fbd560cd8, and set ch_count to match the mask.
sdw_compute_slave_ports() then places the amps in consecutive slots
in link order. Links with more amps than channels, such as the
four-amp tas2783_2_adr boards, keep the full mask: there the split
pushes amps 3 and 4 past the two-channel payload. Platforms where the
init table is applied are unchanged.

Tested on the PX13 on v7.3.7 with the v7.4-rc5 driver plus this patch,
speaker-test -c2 -t wav: left and right correct (v2; v3 changes only
the comment and changelog).

Fixes: f42fbd560cd8 ("ASoC: tas2783-sdw: add firmware download status check")
Closes: https://lore.kernel.org/all/20261107212552.10990-1-leepaulmann@gmail.com/
Link: https://github.com/thesofproject/linux/issues/6037
Assisted-by: LLM
Signed-off-by: Lee Mann <leepaulmann@gmail.com>
---
v3: comment and changelog only, no code change (sashiko-bot review):
 - PPU21 control 0x10 written by tas2783_init_seq is Posture Number,
   not ClusterIndex
 - the slot each amp takes comes from its order on the link; the mask
   only sets how many channels it takes
v2: https://lore.kernel.org/all/?q=s%3A%22PATCH+v2%22+s%3A%22restore+the+stereo+split%22
 - only split when the link has two amps (Mark: four-amp tas2783_2_adr;
   Waldemar Hamm's report from a four-amp HP board shows amps 3/4
   silent with the split and correct stereo with the full mask)
 - set stream_config.ch_count to 1 to match the mask (Mark)

Baojun, could you check this on your two-amp boards? I expect them to
log "Found Smart Amp function", in which case nothing changes there.

AI note: written with Claude Code; I reviewed, built and tested it.

 sound/soc/codecs/tas2783-sdw.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c
index 3f21700..cc9a3e1 100644
--- a/sound/soc/codecs/tas2783-sdw.c
+++ b/sound/soc/codecs/tas2783-sdw.c
@@ -995,6 +995,31 @@ static s32 tas_sdw_hw_params(struct snd_pcm_substream *substream,
 	snd_sdw_params_to_config(substream, params,
 				 &stream_config, &port_config);
 
+	/*
+	 * Without the SDCA SmartAmp function data from ACPI DisCo, the per-amp
+	 * init table is never written and both amps keep the PPU21 Posture
+	 * Number from tas2783_init_seq, so with the full mask from
+	 * snd_sdw_params_to_config() the pair does not render stereo.  On a
+	 * link with one amp per channel, give each amp a single channel, as
+	 * the prefix-based split did before; sdw_compute_slave_ports() then
+	 * places the amps in consecutive slots in link order.  Links with more
+	 * amps than channels keep the full mask, as do platforms where the
+	 * init table is applied.
+	 */
+	if (!tas_dev->sa_func_data &&
+	    substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+	    params_channels(params) == 2 &&
+	    snd_soc_substream_to_rtd(substream)->dai_link->num_codecs == 2 &&
+	    component->name_prefix) {
+		const char *idx_str = strrchr(component->name_prefix, '-');
+		unsigned long idx;
+
+		if (idx_str && !kstrtoul(idx_str + 1, 10, &idx) && idx) {
+			port_config.ch_mask = (idx & 1) ? BIT(0) : BIT(1);
+			stream_config.ch_count = 1;
+		}
+	}
+
 	/* port 1 for playback */
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		port_config.num = 1;
-- 
2.56.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 22:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 22:18 [PATCH v3] ASoC: tas2783-sdw: restore the stereo split when no SDCA function data Lee Mann

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

all inboxes | Powered by JetHome®