Skip to content

Commit 3386645

Browse files
bardliaolgirdwood
authored andcommitted
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 b250b54 commit 3386645

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

sound/soc/sof/ipc4-topology.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,8 +2305,19 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23052305
ch_map >>= 4;
23062306
}
23072307

2308-
step = ch_count / blob->alh_cfg.device_count;
2309-
mask = GENMASK(step - 1, 0);
2308+
if (swidget->id == snd_soc_dapm_dai_in && ch_count == out_ref_channels) {
2309+
/*
2310+
* For playback DAI widgets where the channel number is equal to
2311+
* the output reference channels, set the step = 0 to ensure all
2312+
* the ch_mask is applied to all alh mappings.
2313+
*/
2314+
mask = ch_mask;
2315+
step = 0;
2316+
} else {
2317+
step = ch_count / blob->alh_cfg.device_count;
2318+
mask = GENMASK(step - 1, 0);
2319+
}
2320+
23102321
/*
23112322
* Set each gtw_cfg.node_id to blob->alh_cfg.mapping[]
23122323
* for all widgets with the same stream name
@@ -2341,8 +2352,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23412352
}
23422353

23432354
/*
2344-
* Set the same channel mask for playback as the audio data is
2345-
* duplicated for all speakers. For capture, split the channels
2355+
* Set the same channel mask if the widget channel count is the same
2356+
* as the FE channels for playback as the audio data is duplicated
2357+
* for all speakers in this case. Otherwise, split the channels
23462358
* among the aggregated DAIs. For example, with 4 channels on 2
23472359
* aggregated DAIs, the channel_mask should be 0x3 and 0xc for the
23482360
* two DAI's.
@@ -2351,10 +2363,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
23512363
* the tables in soc_acpi files depending on the _ADR and devID
23522364
* registers for each codec.
23532365
*/
2354-
if (w->id == snd_soc_dapm_dai_in)
2355-
blob->alh_cfg.mapping[i].channel_mask = ch_mask;
2356-
else
2357-
blob->alh_cfg.mapping[i].channel_mask = mask << (step * i);
2366+
blob->alh_cfg.mapping[i].channel_mask = mask << (step * i);
23582367

23592368
i++;
23602369
}

0 commit comments

Comments
 (0)