All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qianghua Wang" <qianghua.wang@senarytech.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 2/3] ASoC: sdw_utils: add SN622x codec_info and DAPM hooks
Date: Wed, 02 Dec 2026 02:40:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-244705@kernel.org> (raw)
In-Reply-To: <20261202022209.77448-3-qianghua.wang@senarytech.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ASoC: sdw_utils: missing asoc_sdw_senary_amp_exit() on SN622x
  codec_info_list
- [Medium] ASoC: sdw_utils: broken fallback mic_name in
  asoc_sdw_senary_dmic_rtd_init()
--

commit 119d388e168f5de68368b6edbe3c2554b1c58aff
Author: Qianghua Wang <qianghua.wang@senarytech.com>

ASoC: sdw_utils: add SN622x codec_info and DAPM hooks

This commit adds codec_info_list entries and speaker DAPM routes for Senary
SN6220 and SN6224, and switches Senary DMIC routing to use a dynamic
component name_prefix.

> diff --git a/sound/soc/sdw_utils/soc_sdw_senary_dmic.c b/sound/soc/sdw_utils/soc_sdw_senary_dmic.c
> index 725f4658ec9c7..82e9a8b34ff92 100644
> --- a/sound/soc/sdw_utils/soc_sdw_senary_dmic.c
> +++ b/sound/soc/sdw_utils/soc_sdw_senary_dmic.c
[ ... ]
> @@ -24,21 +19,34 @@ int asoc_sdw_senary_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_so
>  	struct snd_soc_card *card = rtd->card;
>  	struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
>  	struct snd_soc_component *component;
> +	struct snd_soc_dapm_route route;
> +	char *codec_dmic;
>  	char *mic_name;
>  	int ret;
>  
>  	component = dai->component;
>  
>  	if (component->name_prefix) {
> -		ret = snd_soc_dapm_add_routes(dapm, senary_dmic_map,
> -					      ARRAY_SIZE(senary_dmic_map));
> +		codec_dmic = devm_kasprintf(card->dev, GFP_KERNEL, "%s DMIC",
> +					    component->name_prefix);
> +		if (!codec_dmic)
> +			return -ENOMEM;
> +		route = (struct snd_soc_dapm_route){ codec_dmic, NULL, "Dmic" };
> +		ret = snd_soc_dapm_add_routes(dapm, &route, 1);
>  		mic_name = devm_kstrdup(card->dev, component->name_prefix, GFP_KERNEL);
>  	} else {
> -		dev_warn(card->dev, "sn624x dmic: component %s has no name_prefix\n",
> +		const char *name = component->name;
> +
> +		dev_warn(card->dev, "senary dmic: component %s has no name_prefix\n",
>  			 component->name);
>  		ret = snd_soc_dapm_add_routes(dapm, senary_dmic_map_bare,
>  					      ARRAY_SIZE(senary_dmic_map_bare));
> -		mic_name = devm_kstrdup(card->dev, "sn624x", GFP_KERNEL);
> +		if (name && name[0])
> +			mic_name = devm_kstrdup(card->dev, name, GFP_KERNEL);
> +		else if (dai->name)
> +			mic_name = devm_kstrdup(card->dev, dai->name, GFP_KERNEL);
> +		else
> +			mic_name = NULL;
>  	}

[Severity: Medium]
Does this fallback populate card->components with the SoundWire bus device
name instead of the codec prefix?

Because the SN622x and SN624x codec drivers leave
snd_soc_component_driver.name NULL, snd_soc_component_initialize() sets
component->name to the SoundWire device name (such as
"sdw:0:3:0496:184c:01").  When component->name_prefix is NULL, "name &&
name[0]" is always true, so card->components receives
"mic:sdw:0:3:0496:184c:01-dmic" instead of "mic:sn622x-dmic" or
"mic:sn624x-dmic", breaking UCM matching and making the dai->name branch
unreachable (and dai->name is "sn622x-sdca-aif2" or "sn624x-sdca-aif3"
rather than the codec prefix).

> diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
> index b6acf7616d147..b782e36491a30 100644
> --- a/sound/soc/sdw_utils/soc_sdw_utils.c
> +++ b/sound/soc/sdw_utils/soc_sdw_utils.c
[ ... ]
> @@ -1690,16 +1690,179 @@ struct asoc_sdw_codec_info codec_info_list[] = {
[ ... ]
> +	/* SN6220, part_id 0x184c */
> +	{
> +		.vendor_id = 0x0496,
> +		.part_id = 0x184c,
> +		.name_prefix = "sn622x",
> +		.ignore_internal_dmic = true,
> +		.dais = {
> +			{
> +				.direction = {true, false},
> +				.dai_name = "sn622x-sdca-aif",
> +				.component_name = "sn622x",
> +				.dai_type = SOC_SDW_DAI_TYPE_AMP,
> +				.dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
> +				.init = asoc_sdw_senary_amp_init,
> +				.rtd_init = asoc_sdw_senary_sdca_spk_rtd_init,
> +				.controls = generic_spk_controls,
> +				.num_controls = ARRAY_SIZE(generic_spk_controls),
> +				.widgets = generic_spk_widgets,
> +				.num_widgets = ARRAY_SIZE(generic_spk_widgets),
> +				.quirk = SOC_SDW_CODEC_SPKR,
> +				.quirk_exclude = true,
> +			},

[Severity: Medium]
Should all four SN6220 and SN6224 amplifier DAI entries also set .exit =
asoc_sdw_senary_amp_exit, like the SN624x entries above?

When two SN622x amplifier endpoints are present, asoc_sdw_senary_amp_init()
takes device references via bus_find_device_by_name() and stores them in
ctx->amp_dev1 and ctx->amp_dev2.  Without .exit wired up,
asoc_sdw_mc_dailink_exit_loop() never calls asoc_sdw_senary_amp_exit() on
card removal or probe failure, leaking those device references and any
attached software nodes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202022209.77448-1-qianghua.wang@senarytech.com?part=2

  reply	other threads:[~2026-12-02  2:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  2:22 [PATCH v3 0/3] ASoC: add Senary SN622x SDCA SoundWire support Qianghua Wang
2026-12-02  2:22 ` [PATCH v3 1/3] ASoC: codecs: add SN622x SDCA SoundWire codec support Qianghua Wang
2026-12-02  2:52   ` sashiko-bot
2026-12-02  2:22 ` [PATCH v3 2/3] ASoC: sdw_utils: add SN622x codec_info and DAPM hooks Qianghua Wang
2026-12-02  2:40   ` sashiko-bot [this message]
2026-12-02  2:22 ` [PATCH v3 3/3] ASoC: Intel: soc-acpi: add SN622x PTL/NVL SoundWire machines Qianghua Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-244705@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=qianghua.wang@senarytech.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.