ASoC: tas2783-sdw: restore the stereo split when no SDCA function data
Subsystems (4)
PATCH RESEND 1/1 ASoC: tas2783-sdw: restore the stereo split when no SDCA function data
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 ClusterIndex 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, give each amp a single channel from its machine-assigned prefix, as before f42fbd560cd8. When the function data is present, keep the full mask and let the init table select the channel, so platforms that parse the table are unchanged.
Tested on the PX13 on v7.3.5 with the v7.4-rc5 driver plus this patch, speaker-test -c2 -t wav:
stock ACPI (function not parsed, split path): left and right correct SDCA function parsed (via the out-of-tree fallback from SOF PR #5904, init table applied, full mask): left and right correct
---
Resent as a new thread; the first copy went in reply to the v7 thread
(https://lore.kernel.org/all/[email protected]/).
No changes.
Baojun, your boards parse the SmartAmp function, so the init table selects the channel and the split broke them. The PX13 ACPI does not ("function type only supported as DisCo constant"), so without the split nothing selects the right channel. A plain revert would break your boards again; this keeps the split only for the unparsed case. I can send the PX13 ACPI tables if still useful.
AI note: written with Claude Code; I reviewed, built and tested it.
sound/soc/codecs/tas2783-sdw.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/soc/codecs/tas2783-sdw.c +20 -0
@@ -995,6 +995,26 @@ 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 that selects each amp's channel is never written and both +* amps keep the ClusterIndex from tas2783_init_seq. snd_sdw_params_to_config() +* hands every codec the full mask for playback, so the pair would render +* the same channel. In that case claim a single channel per amp, keyed +* off the machine-assigned prefix (soc_sdw_ti_amp.c names the amps +* tas2783-1..4). When the function data is present, the init table +* selects the channel and the full mask must be kept. +*/ +if (!tas_dev->sa_func_data && + substream->stream ==SNDRV_PCM_STREAM_PLAYBACK && +params_channels (params) ==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 ); + } +/* port 1 for playback */ if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) port_config.num =1 ;
Signature · 1 line
2.56.0
Mark Brown
maintainerQuoted 19 lines
Commit
f42fbd560cd8("ASoC: tas2783-sdw: add firmware download status check") removed the per-amp channel mask fromtas_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_datastays NULL and the init table is never written. Both amps keep ClusterIndex0x01fromtas2783_init_seqand, with the full playback mask, the right speaker is silent.Restore the split for that case only: when
sa_func_datais NULL, give each amp a single channel from its machine-assigned prefix, as beforef42fbd560cd8. When the function data is present, keep the full mask and let the init table select the channel, so platforms that parse the table are unchanged.
sound/soc/codecs/tas2783-sdw.c static s32 tas_sdw_hw_params(struct snd_pcm_substream *substream, · line 1010
Quoted 3 lines
sound/soc/codecs/tas2783-sdw.c +3
-0+if (!tas_dev->sa_func_data && + substream->stream ==SNDRV_PCM_STREAM_PLAYBACK && +params_channels (params) ==2 && component->name_prefix) {
Does this handle cases like tas2783_2_adr in amd-acp70-acpi-match.c correctly? That has four devices on one link. Though if they're broken already perhaps we should just apply this and then do any fixes they need incrementally.
sound/soc/codecs/tas2783-sdw.c static s32 tas_sdw_hw_params(struct snd_pcm_substream *substream, · line 1015
Quoted 5 lines
sound/soc/codecs/tas2783-sdw.c +5
-0+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 );
Do we need to update stream_config.ch_count as well?
Signature · 1 line
Mark Brown <[email protected]>