Commit d36bfa32 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: Intel: sof_sdw: Move flags to private struct

Move the flags ignore_pch_dmic and append_dai_type into the drivers
private structure rather than passing them around between functions.
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240326160429.13560-8-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 07033296
......@@ -1463,10 +1463,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
struct snd_soc_dai_link *dai_links, int sdw_be_num,
const struct snd_soc_acpi_link_adr *adr_link,
struct snd_soc_codec_conf **codec_conf,
int *be_id, bool *ignore_pch_dmic,
bool append_dai_type,
int adr_index,
int dai_index)
int *be_id, int adr_index, int dai_index)
{
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
struct device *dev = card->dev;
......@@ -1549,8 +1546,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
if (!codec_info)
return -EINVAL;
if (codec_info->ignore_pch_dmic)
*ignore_pch_dmic = true;
ctx->ignore_pch_dmic |= codec_info->ignore_pch_dmic;
for_each_pcm_streams(stream) {
char *name, *cpu_name;
......@@ -1572,7 +1568,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
}
/* create stream name according to first link id */
if (append_dai_type) {
if (ctx->append_dai_type) {
name = devm_kasprintf(dev, GFP_KERNEL,
sdw_stream_name[stream + 2], cpu_dai_id[0],
type_strings[codec_info->dais[dai_index].dai_type]);
......@@ -1647,8 +1643,6 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
struct snd_soc_codec_conf *codec_conf;
struct sof_sdw_codec_info *codec_info;
struct sof_sdw_codec_info *ssp_info;
bool append_dai_type = false;
bool ignore_pch_dmic = false;
int codec_conf_num = 0;
bool group_generated[SDW_MAX_GROUPS] = { };
struct snd_soc_dai_link *dai_links;
......@@ -1732,7 +1726,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
if (!codec_info)
return -EINVAL;
if (codec_info->dai_num > 1) {
append_dai_type = true;
ctx->append_dai_type = true;
goto out;
}
for (j = 0; j < i; j++) {
......@@ -1740,7 +1734,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
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[j].adr))) {
append_dai_type = true;
ctx->append_dai_type = true;
goto out;
}
}
......@@ -1771,8 +1765,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
ret = create_sdw_dailink(card, &link_index, dai_links,
sdw_be_num, adr_link,
&codec_conf, &current_be_id,
&ignore_pch_dmic,
append_dai_type, i, j);
i, j);
if (ret < 0) {
dev_err(dev, "failed to create dai link %d\n", link_index);
return ret;
......@@ -1825,7 +1818,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
DMIC:
/* dmic */
if (dmic_num > 0) {
if (ignore_pch_dmic) {
if (ctx->ignore_pch_dmic) {
dev_warn(dev, "Ignoring PCH DMIC\n");
goto HDMI;
}
......
......@@ -103,6 +103,8 @@ struct mc_private {
struct device *amp_dev1, *amp_dev2;
/* To store SDW Pin index for each SoundWire link */
unsigned int sdw_pin_index[SDW_MAX_LINKS];
bool append_dai_type;
bool ignore_pch_dmic;
};
extern unsigned long sof_sdw_quirk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment