Unverified Commit da230e23 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown
Browse files

ASoC: SOF: ipc4-topology: set playback channel mask



Currently, we send all channels to all amps and copy the channel_mask
to all ALH DMAs in playback. However, the amp may not have the
capability to run any process and SOF may need to split the channels
and send specific data channel to each amp. In that case, we need
to split the channel_mask in ALH DMA.
Copy the channel mask only if the widget channel count is the same
the FE channels for playback, otherwise, split the channels among the
aggregated DAIs. Like what we did in capture.

Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarLiam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20251215130723.31081-1-peter.ujfalusi@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 84085139
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -2280,8 +2280,19 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
				ch_map >>= 4;
			}

			if (swidget->id == snd_soc_dapm_dai_in && ch_count == out_ref_channels) {
				/*
				 * For playback DAI widgets where the channel number is equal to
				 * the output reference channels, set the step = 0 to ensure all
				 * the ch_mask is applied to all alh mappings.
				 */
				mask = ch_mask;
				step = 0;
			} else {
				step = ch_count / blob->alh_cfg.device_count;
				mask =  GENMASK(step - 1, 0);
			}

			/*
			 * Set each gtw_cfg.node_id to blob->alh_cfg.mapping[]
			 * for all widgets with the same stream name
@@ -2316,8 +2327,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
				}

				/*
				 * Set the same channel mask for playback as the audio data is
				 * duplicated for all speakers. For capture, split the channels
				 * Set the same channel mask if the widget channel count is the same
				 * as the FE channels for playback as the audio data is duplicated
				 * for all speakers in this case. Otherwise, split the channels
				 * among the aggregated DAIs. For example, with 4 channels on 2
				 * aggregated DAIs, the channel_mask should be 0x3 and 0xc for the
				 * two DAI's.
@@ -2326,9 +2338,6 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
				 * the tables in soc_acpi files depending on the _ADR and devID
				 * registers for each codec.
				 */
				if (w->id == snd_soc_dapm_dai_in)
					blob->alh_cfg.mapping[i].channel_mask = ch_mask;
				else
				blob->alh_cfg.mapping[i].channel_mask = mask << (step * i);

				i++;