Commit 35564e2b authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: Intel: sof_sdw: add mutual exclusion between PCH DMIC and RT715

When external RT714/715 devices are used for capture, we don't want
the PCH DMICs to be used.

Any information provided by the SOF platform driver or DMI quirks will
be overridden.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarLibin Yang <libin.yang@intel.com>
Link: https://lore.kernel.org/r/20210505163705.305616-5-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2e4dba57
...@@ -353,6 +353,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -353,6 +353,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.part_id = 0x714, .part_id = 0x714,
.version_id = 3, .version_id = 3,
.direction = {false, true}, .direction = {false, true},
.ignore_pch_dmic = true,
.dai_name = "rt715-aif2", .dai_name = "rt715-aif2",
.init = sof_sdw_rt715_sdca_init, .init = sof_sdw_rt715_sdca_init,
}, },
...@@ -360,6 +361,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -360,6 +361,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.part_id = 0x715, .part_id = 0x715,
.version_id = 3, .version_id = 3,
.direction = {false, true}, .direction = {false, true},
.ignore_pch_dmic = true,
.dai_name = "rt715-aif2", .dai_name = "rt715-aif2",
.init = sof_sdw_rt715_sdca_init, .init = sof_sdw_rt715_sdca_init,
}, },
...@@ -367,6 +369,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -367,6 +369,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.part_id = 0x714, .part_id = 0x714,
.version_id = 2, .version_id = 2,
.direction = {false, true}, .direction = {false, true},
.ignore_pch_dmic = true,
.dai_name = "rt715-aif2", .dai_name = "rt715-aif2",
.init = sof_sdw_rt715_init, .init = sof_sdw_rt715_init,
}, },
...@@ -374,6 +377,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -374,6 +377,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.part_id = 0x715, .part_id = 0x715,
.version_id = 2, .version_id = 2,
.direction = {false, true}, .direction = {false, true},
.ignore_pch_dmic = true,
.dai_name = "rt715-aif2", .dai_name = "rt715-aif2",
.init = sof_sdw_rt715_init, .init = sof_sdw_rt715_init,
}, },
...@@ -729,7 +733,8 @@ static int create_sdw_dailink(struct device *dev, int *be_index, ...@@ -729,7 +733,8 @@ static int create_sdw_dailink(struct device *dev, int *be_index,
int *cpu_id, bool *group_generated, int *cpu_id, bool *group_generated,
struct snd_soc_codec_conf *codec_conf, struct snd_soc_codec_conf *codec_conf,
int codec_count, int codec_count,
int *codec_conf_index) int *codec_conf_index,
bool *ignore_pch_dmic)
{ {
const struct snd_soc_acpi_link_adr *link_next; const struct snd_soc_acpi_link_adr *link_next;
struct snd_soc_dai_link_component *codecs; struct snd_soc_dai_link_component *codecs;
...@@ -782,6 +787,9 @@ static int create_sdw_dailink(struct device *dev, int *be_index, ...@@ -782,6 +787,9 @@ static int create_sdw_dailink(struct device *dev, int *be_index,
if (codec_index < 0) if (codec_index < 0)
return codec_index; return codec_index;
if (codec_info_list[codec_index].ignore_pch_dmic)
*ignore_pch_dmic = true;
cpu_dai_index = *cpu_id; cpu_dai_index = *cpu_id;
for_each_pcm_streams(stream) { for_each_pcm_streams(stream) {
char *name, *cpu_name; char *name, *cpu_name;
...@@ -913,6 +921,7 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -913,6 +921,7 @@ static int sof_card_dai_links_create(struct device *dev,
const struct snd_soc_acpi_link_adr *adr_link; const struct snd_soc_acpi_link_adr *adr_link;
struct snd_soc_dai_link_component *cpus; struct snd_soc_dai_link_component *cpus;
struct snd_soc_codec_conf *codec_conf; struct snd_soc_codec_conf *codec_conf;
bool ignore_pch_dmic = false;
int codec_conf_count; int codec_conf_count;
int codec_conf_index = 0; int codec_conf_index = 0;
bool group_generated[SDW_MAX_GROUPS]; bool group_generated[SDW_MAX_GROUPS];
...@@ -1019,7 +1028,8 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -1019,7 +1028,8 @@ static int sof_card_dai_links_create(struct device *dev,
sdw_cpu_dai_num, cpus, adr_link, sdw_cpu_dai_num, cpus, adr_link,
&cpu_id, group_generated, &cpu_id, group_generated,
codec_conf, codec_conf_count, codec_conf, codec_conf_count,
&codec_conf_index); &codec_conf_index,
&ignore_pch_dmic);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to create dai link %d", be_id); dev_err(dev, "failed to create dai link %d", be_id);
return -ENOMEM; return -ENOMEM;
...@@ -1087,6 +1097,10 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -1087,6 +1097,10 @@ static int sof_card_dai_links_create(struct device *dev,
DMIC: DMIC:
/* dmic */ /* dmic */
if (dmic_num > 0) { if (dmic_num > 0) {
if (ignore_pch_dmic) {
dev_warn(dev, "Ignoring PCH DMIC\n");
goto HDMI;
}
cpus[cpu_id].dai_name = "DMIC01 Pin"; cpus[cpu_id].dai_name = "DMIC01 Pin";
init_dai_link(dev, links + link_id, be_id, "dmic01", init_dai_link(dev, links + link_id, be_id, "dmic01",
0, 1, // DMIC only supports capture 0, 1, // DMIC only supports capture
...@@ -1105,6 +1119,7 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -1105,6 +1119,7 @@ static int sof_card_dai_links_create(struct device *dev,
INC_ID(be_id, cpu_id, link_id); INC_ID(be_id, cpu_id, link_id);
} }
HDMI:
/* HDMI */ /* HDMI */
if (hdmi_num > 0) { if (hdmi_num > 0) {
idisp_components = devm_kcalloc(dev, hdmi_num, idisp_components = devm_kcalloc(dev, hdmi_num,
......
...@@ -56,6 +56,7 @@ struct sof_sdw_codec_info { ...@@ -56,6 +56,7 @@ struct sof_sdw_codec_info {
int amp_num; int amp_num;
const u8 acpi_id[ACPI_ID_LEN]; const u8 acpi_id[ACPI_ID_LEN];
const bool direction[2]; // playback & capture support const bool direction[2]; // playback & capture support
const bool ignore_pch_dmic;
const char *dai_name; const char *dai_name;
const struct snd_soc_ops *ops; const struct snd_soc_ops *ops;
......
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