From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/5] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
Date: Thu, 08 Oct 2026 11:13:57 +0000 [thread overview]
Message-ID: <sashiko-outbox-164079@kernel.org> (raw)
In-Reply-To: <20261008-nord-asoc-driver-support-v2-v2-2-0b6f7e94060d@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ASoC: devres lifecycle ordering bug causing I2C access after clock is gated
--
commit c3c4668080e08de3f73de6e53cea7fdcb695945c
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
The PCM1681 requires its SCK system clock to be running before register
access. This commit adds support for an optional sck clock and uses
runtime PM to manage it instead of keeping it enabled permanently.
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index 60fdbe5c4e054..a1ccf1edf4819 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
[ ... ]
> @@ -304,34 +335,128 @@ MODULE_DEVICE_TABLE(i2c, pcm1681_i2c_id);
>
> static int pcm1681_i2c_probe(struct i2c_client *client)
> {
[ ... ]
> + ret = devm_snd_soc_register_component(dev,
> + &soc_component_dev_pcm1681,
> + &pcm1681_dai, 1);
> + if (ret) {
> + dev_err(dev, "Failed to register component: %d\n", ret);
> + goto err_pm;
> + }
> +
> + return 0;
> +
> +err_pm:
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> + if (!pm_runtime_status_suspended(dev))
> + clk_disable_unprepare(priv->sck);
> + pm_runtime_set_suspended(dev);
> +
> + return ret;
> }
>
> +static void pcm1681_i2c_remove(struct i2c_client *client)
> +{
> + struct pcm1681_private *priv = i2c_get_clientdata(client);
> + struct device *dev = &client->dev;
> +
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> + /* Runtime PM may already have gated the clock */
> + if (!pm_runtime_status_suspended(dev))
> + clk_disable_unprepare(priv->sck);
[Severity: High]
Does this devres lifecycle ordering introduce a regression where I2C bus
timeouts occur during teardown?
Since the component is registered using devm_snd_soc_register_component() in
pcm1681_i2c_probe(), it will be unregistered during the devres phase, which
runs after pcm1681_i2c_remove() completes.
By manually disabling runtime PM and gating the hardware SCK clock here, the
clock is turned off while the ALSA component is still fully registered. The
subsequent devres unregistration phase will invoke ASoC DAPM teardown
sequences, which perform regmap writes to power down widgets and lower the
bias level.
Because regcache_cache_only() is not enabled here in pcm1681_i2c_remove(),
wouldn't these regmap accesses attempt physical I2C transactions to the
device with a gated SCK clock, resulting in I2C timeouts or hangs?
Could this be fixed by using snd_soc_register_component() and unregistering
it explicitly at the beginning of remove(), or by using
devm_add_action_or_reset() to manage the PM and clock teardown after the
component is unregistered?
> + pm_runtime_set_suspended(dev);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-nord-asoc-driver-support-v2-v2-0-0b6f7e94060d@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-10-08 11:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 11:06 [PATCH v2 0/5] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
2026-10-08 11:06 ` [PATCH v2 1/5] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
2026-10-08 11:06 ` [PATCH v2 2/5] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
2026-10-08 11:13 ` sashiko-bot [this message]
2026-10-08 11:06 ` [PATCH v2 3/5] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
2026-10-08 11:06 ` [PATCH v2 4/5] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card Mohammad Rafi Shaik
2026-10-08 19:48 ` Rob Herring (Arm)
2026-10-08 11:06 ` [PATCH v2 5/5] ASoC: qcom: sc8280xp: Add Nord sound card support Mohammad Rafi Shaik
2026-10-08 11:15 ` sashiko-bot
2026-10-09 1:50 ` [PATCH v2 0/5] ASoC: qcom: Add Nord audio support Shawn Guo
2026-10-09 6:18 ` Mohammad Rafi Shaik
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-164079@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mohammad.rafi.shaik@oss.qualcomm.com \
--cc=robh@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox