Re: [PATCH 06/13] ASoC: amd: acp: move ignore_internal_dmic gate to DMIC enable condition

From: Pierre-Louis Bossart

Date: Sun Oct 18 2026 - 13:03:53 EST


On 10/14/26 12:16, Vijendar Mukunda wrote:
> Move the ignore_internal_dmic check from inside the dmic_num > 0 block
> to the DMIC enable condition itself. This eliminates the dead if/else
> inside the dmic_num > 0 block - when dmic_num is set,
> create_dmic_dailinks() is always called. Demote the suppression message
> from dev_warn to dev_dbg since ignoring the ACP DMIC in favour of a
> SoundWire DMIC codec is expected behaviour, not a warning condition.
>
> No functional change for platforms without a SoundWire DMIC codec.
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@xxxxxxx>
> ---
> sound/soc/amd/acp/acp-sdw-sof-mach.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
> index ac4c9e852f671..1207e35ffb581 100644
> --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
> +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
> @@ -351,9 +351,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
> sdw_be_num = ret;
>
> /* enable dmic */
> - if (sof_sdw_quirk & ASOC_SDW_ACP_DMIC || mach_params->dmic_num ||
> - amd_ctx->pdm_sel)
> + if ((sof_sdw_quirk & ASOC_SDW_ACP_DMIC || mach_params->dmic_num ||
> + amd_ctx->pdm_sel) && !ctx->ignore_internal_dmic)
> dmic_num = 1;
> + else if (ctx->ignore_internal_dmic &&
> + (sof_sdw_quirk & ASOC_SDW_ACP_DMIC ||
> + mach_params->dmic_num || amd_ctx->pdm_sel))
> + dev_dbg(dev, "ACP DMIC suppressed by SoundWire DMIC\n");

this looks weird with the same boolean tested twice, can't this be made
simpler with

if (sof_sdw_quirk & ASOC_SDW_ACP_DMIC || mach_params->dmic_num ||
amd_ctx->pdm_sel)
if (ctx->ignore_internal_dmic)
dev_dbg(dev, "ACP DMIC suppressed by SoundWire DMIC\n");
else
dmic_num = 1;

>
> dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num);
>
> @@ -384,13 +388,9 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
>
> /* dmic */
> if (dmic_num > 0) {
> - if (ctx->ignore_internal_dmic) {
> - dev_warn(dev, "Ignoring ACP DMIC\n");
> - } else {
> - ret = create_dmic_dailinks(card, &dai_links, &be_id, 1);
> - if (ret)
> - return ret;
> - }
> + ret = create_dmic_dailinks(card, &dai_links, &be_id, 1);
> + if (ret)
> + return ret;
> }
>
> WARN_ON(codec_conf != card->codec_conf + card->num_configs);