Skip to content

Commit cbf25c9

Browse files
bardliaoplbossart
authored andcommitted
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. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent dbe4ea6 commit cbf25c9

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎sound/soc/intel/boards/sof_sdw.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");
2222

2323
#define INC_ID(BE, CPU, LINK) do { (BE)++; (CPU)++; (LINK)++; } while (0)
2424

25+
#define SDW_MAX_LINKS 4
26+
27+
/* To store SDW Pin index for each SoundWire link */
28+
static unsigned int sdw_pin_index[SDW_MAX_LINKS];
29+
2530
static void log_quirks(struct device *dev)
2631
{
2732
if (SOF_JACK_JDSRC(sof_sdw_quirk))
@@ -1228,10 +1233,10 @@ static int create_sdw_dailink(struct snd_soc_card *card,
12281233
int cpu_dai_num, cpu_dai_index;
12291234
unsigned int group_id;
12301235
int codec_idx = 0;
1231-
int i = 0, j = 0;
12321236
int codec_index;
12331237
int codec_num;
12341238
int stream;
1239+
int i = 0;
12351240
int ret;
12361241
int k;
12371242

@@ -1317,7 +1322,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
13171322
for (k = 0; k < cpu_dai_num; k++) {
13181323
cpu_name = devm_kasprintf(dev, GFP_KERNEL,
13191324
"SDW%d Pin%d", cpu_dai_id[k],
1320-
j + SDW_INTEL_BIDIR_PDI_BASE);
1325+
sdw_pin_index[cpu_dai_id[k]]++);
13211326
if (!cpu_name)
13221327
return -ENOMEM;
13231328

@@ -1366,7 +1371,6 @@ static int create_sdw_dailink(struct snd_soc_card *card,
13661371
}
13671372

13681373
*cpu_id += cpu_dai_num;
1369-
j++;
13701374
}
13711375

13721376
return 0;
@@ -1519,6 +1523,9 @@ static int sof_card_dai_links_create(struct device *dev,
15191523
for (i = 0; i < SDW_MAX_GROUPS; i++)
15201524
group_generated[i] = false;
15211525

1526+
for (i = 0; i < SDW_MAX_LINKS; i++)
1527+
sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
1528+
15221529
for (; adr_link->num_adr; adr_link++) {
15231530
/*
15241531
* If there are two or more different devices on the same sdw link, we have to

0 commit comments

Comments
 (0)