From eef6c90c4e4d7b07b40a39f06948017f10578b7f Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Tue, 14 Dec 2021 13:29:25 -0600 Subject: [PATCH] ASoC: Intel: sof_es8336: use NHLT information to set dmic and SSP This should help remove the need for additional quirks to determine DMIC and SSP connections. However we have no means to determine which GPIO might be used, in that case a DMI quirk or kernel parameter quirk_override will be required. Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_es8336.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c index 20d577eaab6d7d..e5ba6f56e4019b 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -470,11 +470,23 @@ static int sof_es8336_probe(struct platform_device *pdev) card = &sof_es8336_card; card->dev = dev; - if (!dmi_check_system(sof_es8336_quirk_table)) + if (!dmi_check_system(sof_es8336_quirk_table)) { quirk = SOF_ES8336_SSP_CODEC(2); - - if (quirk & SOF_ES8336_ENABLE_DMIC) - dmic_be_num = 2; + } else { + /* + * Set configuration based on platform NHLT. + * In this machine driver, we can only support one SSP for the + * ES8336 link, the else-if below are intentional + */ + if (mach->mach_params.i2s_link_mask & BIT(0)) + quirk = SOF_ES8336_SSP_CODEC(0); + else if (mach->mach_params.i2s_link_mask & BIT(1)) + quirk = SOF_ES8336_SSP_CODEC(1); + else if (mach->mach_params.i2s_link_mask & BIT(2)) + quirk = SOF_ES8336_SSP_CODEC(2); + if (mach->mach_params.dmic_num) + quirk |= SOF_ES8336_ENABLE_DMIC; + } if (quirk_override != -1) { dev_info(dev, "Overriding quirk 0x%lx => 0x%x\n", @@ -483,6 +495,9 @@ static int sof_es8336_probe(struct platform_device *pdev) } log_quirks(dev); + if (quirk & SOF_ES8336_ENABLE_DMIC) + dmic_be_num = 2; + sof_es8336_card.num_links += dmic_be_num + hdmi_num; dai_links = sof_card_dai_links_create(dev, SOF_ES8336_SSP_CODEC(quirk),