ASoC: sdw_utils: Add codec_conf for every DAI
The assumption so far is that all the DAI links for a given audio part would be on the same device. However, as SDCA implements each audio function on a separate auxiliary driver this will no longer be true. This means it is necessary to add additional codec_conf structures to get the prefix for an audio part to apply to all the auxiliary drivers that make up that part. 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-4-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>pull/1354/merge
parent
48fa77af2f
commit
26ee34d2f5
|
|
@ -364,6 +364,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
|
|||
struct snd_soc_dai_link *dai_links;
|
||||
int num_devs = 0;
|
||||
int num_ends = 0;
|
||||
int num_confs;
|
||||
int num_links;
|
||||
int be_id = 0;
|
||||
int ret;
|
||||
|
|
@ -374,6 +375,8 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
|
|||
return ret;
|
||||
}
|
||||
|
||||
num_confs = num_ends;
|
||||
|
||||
/* One per DAI link, worst case is a DAI link for every endpoint */
|
||||
soc_dais = kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL);
|
||||
if (!soc_dais)
|
||||
|
|
@ -384,7 +387,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
|
|||
if (!soc_ends)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = asoc_sdw_parse_sdw_endpoints(card, soc_dais, soc_ends, &num_devs);
|
||||
ret = asoc_sdw_parse_sdw_endpoints(card, soc_dais, soc_ends, &num_confs);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -396,7 +399,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
|
|||
|
||||
dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num);
|
||||
|
||||
codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL);
|
||||
codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL);
|
||||
if (!codec_conf)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -407,7 +410,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card)
|
|||
return -ENOMEM;
|
||||
|
||||
card->codec_conf = codec_conf;
|
||||
card->num_configs = num_devs;
|
||||
card->num_configs = num_confs;
|
||||
card->dai_link = dai_links;
|
||||
card->num_links = num_links;
|
||||
|
||||
|
|
|
|||
|
|
@ -1191,6 +1191,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
|
|||
struct asoc_sdw_dailink *sof_dais;
|
||||
int num_devs = 0;
|
||||
int num_ends = 0;
|
||||
int num_confs;
|
||||
struct snd_soc_dai_link *dai_links;
|
||||
int num_links;
|
||||
int be_id = 0;
|
||||
|
|
@ -1204,6 +1205,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
|
|||
return ret;
|
||||
}
|
||||
|
||||
num_confs = num_ends;
|
||||
|
||||
/*
|
||||
* One per DAI link, worst case is a DAI link for every endpoint, also
|
||||
* add one additional to act as a terminator such that code can iterate
|
||||
|
|
@ -1220,7 +1223,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
|
|||
goto err_dai;
|
||||
}
|
||||
|
||||
ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs);
|
||||
ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_confs);
|
||||
if (ret < 0)
|
||||
goto err_end;
|
||||
|
||||
|
|
@ -1268,7 +1271,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
|
|||
sdw_be_num, ssp_num, dmic_num,
|
||||
intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num);
|
||||
|
||||
codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL);
|
||||
codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL);
|
||||
if (!codec_conf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_end;
|
||||
|
|
@ -1283,7 +1286,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
|
|||
}
|
||||
|
||||
card->codec_conf = codec_conf;
|
||||
card->num_configs = num_devs;
|
||||
card->num_configs = num_confs;
|
||||
card->dai_link = dai_links;
|
||||
card->num_links = num_links;
|
||||
|
||||
|
|
|
|||
|
|
@ -1442,15 +1442,6 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
|
|||
|
||||
ctx->ignore_internal_dmic |= codec_info->ignore_internal_dmic;
|
||||
|
||||
codec_name = asoc_sdw_get_codec_name(dev, codec_info, adr_link, i);
|
||||
if (!codec_name)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_dbg(dev, "Adding prefix %s for %s\n",
|
||||
adr_dev->name_prefix, codec_name);
|
||||
|
||||
soc_end->name_prefix = adr_dev->name_prefix;
|
||||
|
||||
if (codec_info->count_sidecar && codec_info->add_sidecar) {
|
||||
ret = codec_info->count_sidecar(card, &num_dais, num_devs);
|
||||
if (ret)
|
||||
|
|
@ -1538,6 +1529,16 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
|
|||
num_link_dailinks += !!list_empty(&soc_dai->endpoints);
|
||||
list_add_tail(&soc_end->list, &soc_dai->endpoints);
|
||||
|
||||
codec_name = asoc_sdw_get_codec_name(dev, codec_info,
|
||||
adr_link, i);
|
||||
if (!codec_name)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_dbg(dev, "Adding prefix %s for %s\n",
|
||||
adr_dev->name_prefix, codec_name);
|
||||
|
||||
soc_end->name_prefix = adr_dev->name_prefix;
|
||||
|
||||
soc_end->link_mask = adr_link->mask;
|
||||
soc_end->codec_name = codec_name;
|
||||
soc_end->codec_info = codec_info;
|
||||
|
|
|
|||
Loading…
Reference in New Issue