Skip to content

Commit ca8026c

Browse files
committed
ASoC: sdw_utils: Move codec_name to dai info
As SDCA devices will support each DAI link on a different child device, move the codec name from codec_info to each dai_info. Change-Id: I9fb073a647974af1573601676fcbac9800472fdd Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
1 parent 53c8dd9 commit ca8026c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

include/sound/soc_sdw_utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct asoc_sdw_codec_info;
4545

4646
struct asoc_sdw_dai_info {
4747
const bool direction[2]; /* playback & capture support */
48+
const char *codec_name;
4849
const char *dai_name;
4950
const char *component_name;
5051
const int dai_type;
@@ -67,7 +68,6 @@ struct asoc_sdw_dai_info {
6768
struct asoc_sdw_codec_info {
6869
const int part_id;
6970
const int version_id;
70-
const char *codec_name;
7171
const char *name_prefix;
7272
int amp_num;
7373
const u8 acpi_id[ACPI_ID_LEN];
@@ -132,6 +132,7 @@ void asoc_sdw_shutdown(struct snd_pcm_substream *substream);
132132

133133
const char *asoc_sdw_get_codec_name(struct device *dev,
134134
const struct asoc_sdw_codec_info *codec_info,
135+
const struct asoc_sdw_dai_info *dai_info,
135136
const struct snd_soc_acpi_link_adr *adr_link,
136137
int adr_index);
137138

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
662662
.dais = {
663663
{
664664
.direction = {true, false},
665+
.codec_name = "cs42l43-codec",
665666
.dai_name = "cs42l43-dp5",
666667
.dai_type = SOC_SDW_DAI_TYPE_JACK,
667668
.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -673,6 +674,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
673674
},
674675
{
675676
.direction = {false, true},
677+
.codec_name = "cs42l43-codec",
676678
.dai_name = "cs42l43-dp1",
677679
.dai_type = SOC_SDW_DAI_TYPE_MIC,
678680
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
@@ -684,12 +686,14 @@ struct asoc_sdw_codec_info codec_info_list[] = {
684686
},
685687
{
686688
.direction = {false, true},
689+
.codec_name = "cs42l43-codec",
687690
.dai_name = "cs42l43-dp2",
688691
.dai_type = SOC_SDW_DAI_TYPE_JACK,
689692
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
690693
},
691694
{
692695
.direction = {true, false},
696+
.codec_name = "cs42l43-codec",
693697
.dai_name = "cs42l43-dp6",
694698
.dai_type = SOC_SDW_DAI_TYPE_AMP,
695699
.dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -1116,11 +1120,12 @@ static const char *_asoc_sdw_get_codec_name(struct device *dev,
11161120

11171121
const char *asoc_sdw_get_codec_name(struct device *dev,
11181122
const struct asoc_sdw_codec_info *codec_info,
1123+
const struct asoc_sdw_dai_info *dai_info,
11191124
const struct snd_soc_acpi_link_adr *adr_link,
11201125
int adr_index)
11211126
{
1122-
if (codec_info->codec_name)
1123-
return devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL);
1127+
if (dai_info->codec_name)
1128+
return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
11241129

11251130
return _asoc_sdw_get_codec_name(dev, codec_info, adr_link, adr_index);
11261131
}
@@ -1521,6 +1526,7 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
15211526
list_add_tail(&soc_end->list, &soc_dai->endpoints);
15221527

15231528
codec_name = asoc_sdw_get_codec_name(dev, codec_info,
1529+
dai_info,
15241530
adr_link, i);
15251531
if (!codec_name)
15261532
return -ENOMEM;

0 commit comments

Comments
 (0)