From: sashiko-bot@kernel.org
To: "Qianghua Wang" <qianghua.wang@senarytech.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: sn624x: honor ACPI DisCo when MIC SDCA function is absent
Date: Tue, 17 Nov 2026 01:51:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-218058@kernel.org> (raw)
In-Reply-To: <20261117013558.1790310-1-qianghua.wang@senarytech.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] ASoC: sn624x: sn624x_sdca_amp_function_init() fails with
-ENOENT without table
- [Medium] ASoC: sn624x: sn624x_sdca_disco_has_mic() breaks non-DisCo
DMIC fallback
- [Medium] ASoC: sn624x: sn624x_sdca_amp_function_init() skips init
table on re-attach
- [Low] ASoC: sn624x: missing Fixes trailer for commit 12d9c9f8679c
--
commit 153fc2fac552f6999cee2b2fc0a8d624ceaed6fb
Author: Qianghua Wang <qianghua.wang@senarytech.com>
> ASoC: sn624x: honor ACPI DisCo when MIC SDCA function is absent
>
> Some laptops ship ACPI _DSD DisCo for Senary SN624x with jack and
> speaker amp SDCA functions only, omitting the MIC array function even
> though the codec might otherwise expose a DMIC. The driver always
> advertised the DMIC capture port and ran DMIC function init against
> registers not described in DisCo, which breaks bring-up on platforms
> that use a minimal function list (for example some Panther Lake
> designs).
>
> Look at the parsed DisCo function list before exposing the DMIC port
> and before running DMIC init. Apply AMP function init from the ACPI
> init tables when an amp function is present, using the same pattern as
> the jack and DMIC paths.
>
> Link: https://github.com/thesofproject/linux/issues/6012
> Signed-off-by: Qianghua Wang <qianghua.wang@senarytech.com>
[Severity: Low]
Since this fixes bring-up on platforms with a minimal DisCo function list
and wires up speaker amp initialization, should it include a Fixes tag?
Fixes: 12d9c9f8679c ("ASoC: codecs: add SN624x SDCA SoundWire driver")
> diff --git a/sound/soc/codecs/sn624x-sdca-sdw.c b/sound/soc/codecs/sn624x-sdca-sdw.c
> index 081858689430c..49efa429b4268 100644
> --- a/sound/soc/codecs/sn624x-sdca-sdw.c
> +++ b/sound/soc/codecs/sn624x-sdca-sdw.c
[ ... ]
> @@ -1055,6 +1058,43 @@ static int sn624x_dmic_apply_defaults(struct device *dev,
> return sn624x_dmic_oem_fallback_init(dev, sn624x);
> }
>
> +static bool sn624x_sdca_disco_has_mic(const struct sdw_slave *slave)
> +{
> + int i;
> +
> + if (!slave->sdca_data.interface_revision || !slave->sdca_data.num_functions)
> + return false;
[Severity: Medium]
Does returning false when SDCA DisCo properties are absent break the
non-DisCo DMIC fallback?
When slave->sdca_data.interface_revision is 0, is_sdca_endpoint_present()
in sound/soc/sdw_utils/soc_sdw_utils.c returns 1, so the machine driver
still creates the sn624x-sdca-aif3 DMIC capture DAI link. However, with
sn624x_sdca_disco_has_mic() returning false, sn624x_sdca_read_prop() omits
SN624X_PORT_DMIC_CAPTURE from prop->source_ports and
sn624x_sdca_dmic_function_init() skips sn624x_dmic_oem_fallback_init(),
causing PCM hw_params on that DAI link to fail with -EINVAL in
sdw_slave_port_config().
> + for (i = 0; i < slave->sdca_data.num_functions; i++) {
> + const struct sdca_function_desc *desc = &slave->sdca_data.function[i];
> +
> + if (desc->adr == SN624X_FUNC_NUM_MIC_ARRAY)
> + return true;
> + switch (desc->type) {
> + case SDCA_FUNCTION_TYPE_SMART_MIC:
> + case SDCA_FUNCTION_TYPE_SIMPLE_MIC:
> + return true;
> + default:
> + break;
> + }
> + }
> + return false;
> +}
> +
> +static int sn624x_amp_apply_defaults(struct device *dev,
> + struct sn624x_sdca_priv *sn624x)
> +{
> + int ret;
> +
> + if (!sn624x || !sn624x->regmap || !sn624x->slave)
> + return -ENODEV;
> + if (!sn624x->amp_func)
> + return -ENOENT;
> + ret = sn624x_write_sdca_init_table(dev, sn624x, sn624x->amp_func, "amp");
> + if (ret == 0)
> + usleep_range(1000, 1500);
> + return ret;
> +}
[ ... ]
> @@ -1104,6 +1151,40 @@ static int sn624x_sdca_dmic_function_init(struct device *dev,
> return 0;
>
> ret = sn624x_dmic_apply_defaults(dev, sn624x);
> + if (ret < 0)
> + return ret;
> + ret = regmap_multi_reg_write_bypassed(sn624x->regmap, &clear_status, 1);
> + if (ret < 0)
> + return ret;
> + usleep_range(1000, 1500);
> + return 0;
> +}
> +
> +static int sn624x_sdca_amp_function_init(struct device *dev,
> + struct sn624x_sdca_priv *sn624x)
> +{
> + unsigned int amp_func_status;
> + const struct reg_sequence clear_status =
> + REG_SEQ0(SN624X_REG_AMP_FUN_STATUS_CTL, 0x61);
> + int ret;
> +
> + if (!sn624x->amp_func)
> + return 0;
> + ret = regmap_read_bypassed(sn624x->regmap,
> + SN624X_REG_AMP_FUN_STATUS_CTL,
> + &_func_status);
> + if (ret < 0)
> + return ret;
> + if (!(amp_func_status & (SN624X_JACK_FUN_NEEDS_INIT |
> + SN624X_JACK_FUN_HAS_BEEN_RESET))) {
> + if (!sn624x->first_hw_init && sn624x->amp_func->num_init_table)
> + dev_dbg(dev,
> + "sn624x: amp FUN STATUS 0x%x, apply ACPI init table anyway\n",
> + amp_func_status);
> + else
> + return 0;
> + }
[Severity: Medium]
Does gating this fallback on !sn624x->first_hw_init skip re-applying the
amp ACPI initialization table on re-attach after bus reset or suspend?
When the slave transitions through SDW_SLAVE_UNATTACHED,
sn624x_sdca_update_status() clears sn624x->hw_init while
sn624x->first_hw_init stays true. On re-attachment, if amp_func_status
still does not assert NEEDS_INIT or HAS_BEEN_RESET,
sn624x_sdca_amp_function_init() returns 0 without running the init table,
and vendor registers in that table are not restored by regcache_sync()
because sn624x_sdca_volatile_register() marks !SDW_SDCA_VALID_CTL(reg)
registers as volatile.
> + ret = sn624x_amp_apply_defaults(dev, sn624x);
> + if (ret < 0)
> + return ret;
[Severity: High]
Can sn624x_sdca_amp_function_init() fail with -ENOENT and abort codec
bring-up when the ACPI amp function omits
mipi-sdca-function-initialization-table?
find_sdca_init_table() treats that property as optional, so
sdca_parse_function() succeeds and sets sn624x->amp_func with
num_init_table == 0. When amp_func_status has SN624X_JACK_FUN_NEEDS_INIT
or SN624X_JACK_FUN_HAS_BEEN_RESET set, execution reaches
sn624x_amp_apply_defaults() -> sn624x_write_sdca_init_table(), which
returns -ENOENT on !fn->num_init_table; unlike the jack and DMIC paths,
sn624x_amp_apply_defaults() has no OEM fallback, so sn624x_sdca_io_init()
aborts before clearing the status register or initializing DMIC.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117013558.1790310-1-qianghua.wang@senarytech.com?part=1
next prev parent reply other threads:[~2026-11-17 1:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 1:35 [PATCH] ASoC: sn624x: honor ACPI DisCo when MIC SDCA function is absent Qianghua Wang
2026-11-17 1:51 ` sashiko-bot [this message]
2026-11-17 2:46 ` [PATCH v2] ASoC: sn624x: skip DMIC when ACPI DisCo has no MIC function Qianghua Wang
2026-11-17 3:02 ` sashiko-bot
2026-11-17 6:02 ` [PATCH v3] " Qianghua Wang
2026-11-17 11:12 ` Mark Brown
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-218058@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.