Skip to content

Commit 2ae4659

Browse files
charleskeepaxbroonie
authored andcommitted
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. To allow the appropriate function device to be bound to each DAI link. Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20251127163426.2500633-5-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 26ee34d commit 2ae4659

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

include/sound/soc_sdw_utils.h

Lines changed: 2 additions & 2 deletions
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];
@@ -131,7 +131,7 @@ int asoc_sdw_hw_free(struct snd_pcm_substream *substream);
131131
void asoc_sdw_shutdown(struct snd_pcm_substream *substream);
132132

133133
const char *asoc_sdw_get_codec_name(struct device *dev,
134-
const struct asoc_sdw_codec_info *codec_info,
134+
const struct asoc_sdw_dai_info *dai_info,
135135
const struct snd_soc_acpi_link_adr *adr_link,
136136
int adr_index);
137137

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,12 @@ struct asoc_sdw_codec_info codec_info_list[] = {
656656
{
657657
.part_id = 0x4243,
658658
.name_prefix = "cs42l43",
659-
.codec_name = "cs42l43-codec",
660659
.count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar,
661660
.add_sidecar = asoc_sdw_bridge_cs35l56_add_sidecar,
662661
.dais = {
663662
{
664663
.direction = {true, false},
664+
.codec_name = "cs42l43-codec",
665665
.dai_name = "cs42l43-dp5",
666666
.dai_type = SOC_SDW_DAI_TYPE_JACK,
667667
.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -673,6 +673,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
673673
},
674674
{
675675
.direction = {false, true},
676+
.codec_name = "cs42l43-codec",
676677
.dai_name = "cs42l43-dp1",
677678
.dai_type = SOC_SDW_DAI_TYPE_MIC,
678679
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
@@ -684,12 +685,14 @@ struct asoc_sdw_codec_info codec_info_list[] = {
684685
},
685686
{
686687
.direction = {false, true},
688+
.codec_name = "cs42l43-codec",
687689
.dai_name = "cs42l43-dp2",
688690
.dai_type = SOC_SDW_DAI_TYPE_JACK,
689691
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
690692
},
691693
{
692694
.direction = {true, false},
695+
.codec_name = "cs42l43-codec",
693696
.dai_name = "cs42l43-dp6",
694697
.dai_type = SOC_SDW_DAI_TYPE_AMP,
695698
.dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -1094,7 +1097,6 @@ static bool asoc_sdw_is_unique_device(const struct snd_soc_acpi_link_adr *adr_li
10941097
}
10951098

10961099
static const char *_asoc_sdw_get_codec_name(struct device *dev,
1097-
const struct asoc_sdw_codec_info *codec_info,
10981100
const struct snd_soc_acpi_link_adr *adr_link,
10991101
int adr_index)
11001102
{
@@ -1116,14 +1118,14 @@ static const char *_asoc_sdw_get_codec_name(struct device *dev,
11161118
}
11171119

11181120
const char *asoc_sdw_get_codec_name(struct device *dev,
1119-
const struct asoc_sdw_codec_info *codec_info,
1121+
const struct asoc_sdw_dai_info *dai_info,
11201122
const struct snd_soc_acpi_link_adr *adr_link,
11211123
int adr_index)
11221124
{
1123-
if (codec_info->codec_name)
1124-
return devm_kstrdup(dev, codec_info->codec_name, GFP_KERNEL);
1125+
if (dai_info->codec_name)
1126+
return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
11251127

1126-
return _asoc_sdw_get_codec_name(dev, codec_info, adr_link, adr_index);
1128+
return _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
11271129
}
11281130
EXPORT_SYMBOL_NS(asoc_sdw_get_codec_name, "SND_SOC_SDW_UTILS");
11291131

@@ -1354,8 +1356,7 @@ static int is_sdca_endpoint_present(struct device *dev,
13541356
}
13551357
kfree(dlc);
13561358

1357-
sdw_codec_name = _asoc_sdw_get_codec_name(dev, codec_info,
1358-
adr_link, adr_index);
1359+
sdw_codec_name = _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
13591360
if (!sdw_codec_name)
13601361
return -ENOMEM;
13611362

@@ -1529,7 +1530,7 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
15291530
num_link_dailinks += !!list_empty(&soc_dai->endpoints);
15301531
list_add_tail(&soc_end->list, &soc_dai->endpoints);
15311532

1532-
codec_name = asoc_sdw_get_codec_name(dev, codec_info,
1533+
codec_name = asoc_sdw_get_codec_name(dev, dai_info,
15331534
adr_link, i);
15341535
if (!codec_name)
15351536
return -ENOMEM;

0 commit comments

Comments
 (0)