summaryrefslogtreecommitdiff
path: root/sound/soc/intel/boards/sof_sdw.c
diff options
context:
space:
mode:
authorBard Liao <yung-chuan.liao@linux.intel.com>2023-06-02 23:22:02 +0300
committerMark Brown <broonie@kernel.org>2023-06-05 16:00:12 +0300
commit5714aabdf9713297947615fd2325719a6f9db316 (patch)
tree3370f8c208e43ccb2e75151b24cd7c286b80978a /sound/soc/intel/boards/sof_sdw.c
parentcededa5a6486821402c5e9bb7fd3cfd71d7999bc (diff)
downloadlinux-5714aabdf9713297947615fd2325719a6f9db316.tar.xz
ASoC: Intel: sdw_sof: append dai_type and remove codec_type
We append codec type to dailink name to distinguish different dailink on the same sdw link and direction. But we could create multi dailinks for a codec and the dailink name will be duplicated if we append codec type to the dailink name. Appending dai type instead of codec type can solve the issue. For example, if a codec supports JACK on dai 0 and AMP on dai 1, the existing code will create dailinks SDW0-Playback-SimpleJack or SDW0-Playback-SmartAmp for both dailinks, and it will be SDW0-Playback-SimpleJack for dailink 0 and SDW0-Playback-SmartAmp for dailink 1 after this change. Then codec type is not used any more and can be removed. Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230602202225.249209-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/sof_sdw.c')
-rw-r--r--sound/soc/intel/boards/sof_sdw.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index b197c2920e80..6c4c05addb50 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -573,7 +573,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0x711,
@@ -589,7 +588,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0x711,
@@ -605,7 +603,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0x1308,
@@ -622,7 +619,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
.dai_num = 1,
.ops = &sof_sdw_rt1308_i2s_ops,
- .codec_type = SOF_SDW_CODEC_TYPE_AMP,
},
{
.part_id = 0x1316,
@@ -637,7 +633,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_AMP,
},
{
.part_id = 0x1318,
@@ -652,7 +647,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_AMP,
},
{
.part_id = 0x714,
@@ -668,7 +662,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_MIC,
},
{
.part_id = 0x715,
@@ -684,7 +677,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_MIC,
},
{
.part_id = 0x714,
@@ -700,7 +692,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_MIC,
},
{
.part_id = 0x715,
@@ -716,7 +707,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_MIC,
},
{
.part_id = 0x8373,
@@ -730,7 +720,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_AMP,
},
{
.part_id = 0x5682,
@@ -744,7 +733,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0xaaaa, /* generic codec mockup */
@@ -759,7 +747,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0xaa55, /* headset codec mockup */
@@ -774,7 +761,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_JACK,
},
{
.part_id = 0x55aa, /* amplifier mockup */
@@ -789,7 +775,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_AMP,
},
{
.part_id = 0x5555,
@@ -804,7 +789,6 @@ static struct sof_sdw_codec_info codec_info_list[] = {
},
},
.dai_num = 1,
- .codec_type = SOF_SDW_CODEC_TYPE_MIC,
},
};
@@ -1181,7 +1165,7 @@ static int create_sdw_dailink(struct snd_soc_card *card,
int codec_count, int *link_id,
int *codec_conf_index,
bool *ignore_pch_dmic,
- bool append_codec_type,
+ bool append_dai_type,
int adr_index)
{
const struct snd_soc_acpi_link_adr *link_next;
@@ -1261,10 +1245,10 @@ static int create_sdw_dailink(struct snd_soc_card *card,
}
/* create stream name according to first link id */
- if (append_codec_type) {
+ if (append_dai_type) {
name = devm_kasprintf(dev, GFP_KERNEL,
sdw_stream_name[stream + 2], cpu_dai_id[0],
- type_strings[codec_info->codec_type]);
+ type_strings[codec_info->dais[0].dai_type]);
} else {
name = devm_kasprintf(dev, GFP_KERNEL,
sdw_stream_name[stream], cpu_dai_id[0]);
@@ -1384,7 +1368,7 @@ static int sof_card_dai_links_create(struct device *dev,
const struct snd_soc_acpi_link_adr *adr_link;
struct snd_soc_dai_link_component *cpus;
struct snd_soc_codec_conf *codec_conf;
- bool append_codec_type = false;
+ bool append_dai_type = false;
bool ignore_pch_dmic = false;
int codec_conf_count;
int codec_conf_index = 0;
@@ -1489,7 +1473,7 @@ static int sof_card_dai_links_create(struct device *dev,
SDW_PART_ID(adr_link->adr_d[j].adr)) ||
(SDW_MFG_ID(adr_link->adr_d[i].adr) !=
SDW_MFG_ID(adr_link->adr_d[i].adr))) {
- append_codec_type = true;
+ append_dai_type = true;
goto out;
}
}
@@ -1519,7 +1503,7 @@ out:
&cpu_id, group_generated,
codec_conf, codec_conf_count,
&be_id, &codec_conf_index,
- &ignore_pch_dmic, append_codec_type, i);
+ &ignore_pch_dmic, append_dai_type, i);
if (ret < 0) {
dev_err(dev, "failed to create dai link %d", link_index);
return ret;