From 07fc5ee61b5a4e6861150b283630d4ca19877384 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Wed, 13 Nov 2024 09:33:29 +0800 Subject: [PATCH 1/3] ASoC: Intel: sof_sdw: correct mach_params->dmic_num mach_params->dmic_num will be used to set the cfg-mics value of card->components string which should be the dmic channels. However dmic_num is dmic link number and could be set due to the SOC_SDW_PCH_DMIC quirk. Set mach_params->dmic_num to the default value if the dmic link is created due to the SOC_SDW_PCH_DMIC quirk. Fixes: 7db9f6361170 ("ASoC: Intel: sof_sdw: overwrite mach_params->dmic_num") Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index ac7bf2b7e3edbb..5cdbaeb2032559 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -22,6 +22,8 @@ static int quirk_override = -1; module_param_named(quirk, quirk_override, int, 0444); MODULE_PARM_DESC(quirk, "Board-specific quirk override"); +#define DMIC_DEFAULT_CHANNELS 2 + static void log_quirks(struct device *dev) { if (SOC_SDW_JACK_JDSRC(sof_sdw_quirk)) @@ -1133,17 +1135,19 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) hdmi_num = SOF_PRE_TGL_HDMI_COUNT; /* enable dmic01 & dmic16k */ - if (sof_sdw_quirk & SOC_SDW_PCH_DMIC || mach_params->dmic_num) { - if (ctx->ignore_internal_dmic) - dev_warn(dev, "Ignoring PCH DMIC\n"); - else - dmic_num = 2; + if (ctx->ignore_internal_dmic) { + dev_warn(dev, "Ignoring internal DMIC\n"); + mach_params->dmic_num = 0; + } else if (mach_params->dmic_num) { + dmic_num = 2; + } else if (sof_sdw_quirk & SOC_SDW_PCH_DMIC) { + dmic_num = 2; + /* + * mach_params->dmic_num will be used to set the cfg-mics value of + * card->components string. Set it to the default value. + */ + mach_params->dmic_num = DMIC_DEFAULT_CHANNELS; } - /* - * mach_params->dmic_num will be used to set the cfg-mics value of card->components - * string. Overwrite it to the actual number of PCH DMICs used in the device. - */ - mach_params->dmic_num = dmic_num; if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) bt_num = 1; From c3d9b802cb3a9f8684dfb964a6be6a74f1083729 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 14 Nov 2024 09:59:40 +0800 Subject: [PATCH 2/3] ASoC: Intel: sof_sdw: reduce log level for not using internal dmic ctx->ignore_internal_dmic is set when there is a dedicated SoundWire DMIC is in the system. In other words, ignoring internal DMIC is expected, not an error. Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 5cdbaeb2032559..8cb83e81c77bdb 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1136,7 +1136,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) /* enable dmic01 & dmic16k */ if (ctx->ignore_internal_dmic) { - dev_warn(dev, "Ignoring internal DMIC\n"); + dev_dbg(dev, "SoundWire DMIC is used, ignoring internal DMIC\n"); mach_params->dmic_num = 0; } else if (mach_params->dmic_num) { dmic_num = 2; From 277eda06dd036f0f7c5de22a5efbe30366e3b329 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Thu, 14 Nov 2024 10:12:27 +0800 Subject: [PATCH 3/3] ASoC: Intel: sof_sdw: improve the log of DAI link numbers The log shows the number for different type of DAIs. Add "DAI link numbers:" to make the log be more explicit. Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 8cb83e81c77bdb..431a2e963b9b35 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1152,7 +1152,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) bt_num = 1; - dev_dbg(dev, "sdw %d, ssp %d, dmic %d, hdmi %d, bt: %d\n", + dev_dbg(dev, "DAI link numbers: sdw %d, ssp %d, dmic %d, hdmi %d, bt: %d\n", sdw_be_num, ssp_num, dmic_num, intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num);