Commit 393648ce authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: Intel: avs: Only create SSP%d snd_soc_dai_driver when requested

When using TDM configuration some other device may be using SSP%d, so
don't create snd_soc_dai_driver configuration for it unless requested
by TDM configuration.

While at it adjust tdf8532 board to explicitly describe TDM
configuration.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231012083514.492626-2-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 59825951
......@@ -193,7 +193,7 @@ static struct snd_soc_acpi_mach avs_apl_i2s_machines[] = {
.mach_params = {
.i2s_link_mask = AVS_SSP_RANGE(0, 5),
},
.pdata = (unsigned long[]){ 0, 0, 0x14, 0, 0, 0 }, /* SSP2 TDMs */
.pdata = (unsigned long[]){ 0x1, 0x1, 0x14, 0x1, 0x1, 0x1 }, /* SSP2 TDMs */
.tplg_filename = "tdf8532-tplg.bin",
},
{
......
......@@ -1238,7 +1238,11 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
int i, j;
ssp_count = adev->hw_cfg.i2s_caps.ctrl_count;
cpu_count = hweight_long(port_mask);
cpu_count = 0;
for_each_set_bit(i, &port_mask, ssp_count)
if (!tdms || test_bit(0, &tdms[i]))
cpu_count++;
if (tdms)
for_each_set_bit(i, &port_mask, ssp_count)
cpu_count += hweight_long(tdms[i]);
......@@ -1249,18 +1253,20 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
dai = cpus;
for_each_set_bit(i, &port_mask, ssp_count) {
memcpy(dai, &i2s_dai_template, sizeof(*dai));
if (!tdms || test_bit(0, &tdms[i])) {
memcpy(dai, &i2s_dai_template, sizeof(*dai));
dai->name =
devm_kasprintf(adev->dev, GFP_KERNEL, "SSP%d Pin", i);
dai->playback.stream_name =
devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Tx", i);
dai->capture.stream_name =
devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Rx", i);
dai->name =
devm_kasprintf(adev->dev, GFP_KERNEL, "SSP%d Pin", i);
dai->playback.stream_name =
devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Tx", i);
dai->capture.stream_name =
devm_kasprintf(adev->dev, GFP_KERNEL, "ssp%d Rx", i);
if (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name)
return -ENOMEM;
dai++;
if (!dai->name || !dai->playback.stream_name || !dai->capture.stream_name)
return -ENOMEM;
dai++;
}
}
if (!tdms)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment