Commit 35d28ccd authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: Intel: sof_sdw: increase sdw pin index for each sdw link

To support multiple codecs per SoundWire link, we have to assign multiple
CPU DAIs to different DAI links sharing the same physical link. This is
not possible with the existing code since we assume that only 'Pin2' is
used for playback and 'Pin3' used for capture - additional DAIs cannot
be handled.

This patch enables more CPU DAIs to be used, e.g. "SDW0 Pin2",
"SDW0 Pin3", and "SDW0 Pin4" for SDW0-Playback-SimpleJack,
SDW0-Capture-SimpleJack, and SDW0-Playback-SmartAmp DAI links on physical
link #0.
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-15-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fbaaf80d
......@@ -22,6 +22,11 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");
#define INC_ID(BE, CPU, LINK) do { (BE)++; (CPU)++; (LINK)++; } while (0)
#define SDW_MAX_LINKS 4
/* To store SDW Pin index for each SoundWire link */
static unsigned int sdw_pin_index[SDW_MAX_LINKS];
static void log_quirks(struct device *dev)
{
if (SOF_JACK_JDSRC(sof_sdw_quirk))
......@@ -1247,10 +1252,10 @@ static int create_sdw_dailink(struct snd_soc_card *card,
int cpu_dai_num, cpu_dai_index;
unsigned int group_id;
int codec_idx = 0;
int i = 0, j = 0;
int codec_index;
int codec_num;
int stream;
int i = 0;
int ret;
int k;
......@@ -1336,7 +1341,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
for (k = 0; k < cpu_dai_num; k++) {
cpu_name = devm_kasprintf(dev, GFP_KERNEL,
"SDW%d Pin%d", cpu_dai_id[k],
j + SDW_INTEL_BIDIR_PDI_BASE);
sdw_pin_index[cpu_dai_id[k]]++);
if (!cpu_name)
return -ENOMEM;
......@@ -1385,7 +1390,6 @@ static int create_sdw_dailink(struct snd_soc_card *card,
}
*cpu_id += cpu_dai_num;
j++;
}
return 0;
......@@ -1538,6 +1542,9 @@ static int sof_card_dai_links_create(struct device *dev,
for (i = 0; i < SDW_MAX_GROUPS; i++)
group_generated[i] = false;
for (i = 0; i < SDW_MAX_LINKS; i++)
sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
for (; adr_link->num_adr; adr_link++) {
/*
* If there are two or more different devices on the same sdw link, we have to
......
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