@@ -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