Skip to content

Commit 0aebf80

Browse files
committed
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: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 43382d2 commit 0aebf80

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

sound/soc/sof/ipc4-topology.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,13 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23002300

23012301
step = ch_count / blob->alh_cfg.device_count;
23022302
mask = GENMASK(step - 1, 0);
2303+
2304+
/* Set the same mask to all devices if ch_count == out_ref_channels */
2305+
if (swidget->id == snd_soc_dapm_dai_in && ch_count == out_ref_channels) {
2306+
mask = ch_mask;
2307+
step = 0;
2308+
}
2309+
23032310
/*
23042311
* Set each gtw_cfg.node_id to blob->alh_cfg.mapping[]
23052312
* for all widgets with the same stream name
@@ -2334,8 +2341,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23342341
}
23352342

23362343
/*
2337-
* Set the same channel mask for playback as the audio data is
2338-
* duplicated for all speakers. For capture, split the channels
2344+
* Set the same channel mask if the widget channel count is the same
2345+
* as the FE channels for playback as the audio data is duplicated
2346+
* for all speakers in the case. Otherwise, split the channels
23392347
* among the aggregated DAIs. For example, with 4 channels on 2
23402348
* aggregated DAIs, the channel_mask should be 0x3 and 0xc for the
23412349
* two DAI's.
@@ -2344,10 +2352,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23442352
* the tables in soc_acpi files depending on the _ADR and devID
23452353
* registers for each codec.
23462354
*/
2347-
if (w->id == snd_soc_dapm_dai_in)
2348-
blob->alh_cfg.mapping[i].channel_mask = ch_mask;
2349-
else
2350-
blob->alh_cfg.mapping[i].channel_mask = mask << (step * i);
2355+
blob->alh_cfg.mapping[i].channel_mask = mask << (step * i);
23512356

23522357
i++;
23532358
}

0 commit comments

Comments
 (0)