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[] = { ...@@ -193,7 +193,7 @@ static struct snd_soc_acpi_mach avs_apl_i2s_machines[] = {
.mach_params = { .mach_params = {
.i2s_link_mask = AVS_SSP_RANGE(0, 5), .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", .tplg_filename = "tdf8532-tplg.bin",
}, },
{ {
......
...@@ -1238,7 +1238,11 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l ...@@ -1238,7 +1238,11 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
int i, j; int i, j;
ssp_count = adev->hw_cfg.i2s_caps.ctrl_count; 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) if (tdms)
for_each_set_bit(i, &port_mask, ssp_count) for_each_set_bit(i, &port_mask, ssp_count)
cpu_count += hweight_long(tdms[i]); cpu_count += hweight_long(tdms[i]);
...@@ -1249,6 +1253,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l ...@@ -1249,6 +1253,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
dai = cpus; dai = cpus;
for_each_set_bit(i, &port_mask, ssp_count) { for_each_set_bit(i, &port_mask, ssp_count) {
if (!tdms || test_bit(0, &tdms[i])) {
memcpy(dai, &i2s_dai_template, sizeof(*dai)); memcpy(dai, &i2s_dai_template, sizeof(*dai));
dai->name = dai->name =
...@@ -1262,6 +1267,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l ...@@ -1262,6 +1267,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
return -ENOMEM; return -ENOMEM;
dai++; dai++;
} }
}
if (!tdms) if (!tdms)
goto plat_register; goto plat_register;
......
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