Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 2/2] ASoC: spacemit: add K3 SoC support with additional clocks
Date: Fri, 22 May 2026 13:33:44 +0000	[thread overview]
Message-ID: <20260522133344.EE51B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260522-k3-i2s-v3-2-08e3eb811d93@linux.spacemit.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unprotected rate changes on shared clocks `c_sysclk` and `c_bclk` can corrupt active audio streams on other I2S controllers.
--

commit f3c6244a03afa7c9321de2747d7f0c3a9bc65bd2
Author: Troy Mitchell <troy.mitchell@linux.spacemit.com>

ASoC: spacemit: add K3 SoC support with additional clocks

This commit adds support for the SpacemiT K3 SoC I2S controller. It acquires
new clocks (sysclk_div, c_sysclk, and c_bclk) using
devm_clk_get_optional_enabled() and configures their rates dynamically based
on the sample rate during stream setup.

> diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c
> index 5420ca2aefbd8..8871fc15b29cc 100644
> --- a/sound/soc/spacemit/k1_i2s.c
> +++ b/sound/soc/spacemit/k1_i2s.c

[ ... ]

> @@ -206,6 +209,14 @@ static int spacemit_i2s_hw_params(struct snd_pcm_substream *substream,
>  		    params_rate(params) *
>  		    data_bits;
>  
> +	ret = clk_set_rate(i2s->c_sysclk, bclk_rate * 2);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_set_rate(i2s->c_bclk, bclk_rate);
> +	if (ret)
> +		return ret;
> +

[Severity: Medium]
The commit message notes that c_sysclk and c_bclk are shared across multiple
I2S controllers on the K3 SoC. If multiple controllers are concurrently
active and request different sample rates, will calling clk_set_rate() here
silently overwrite the shared clock rates?

Could this instantaneous frequency change disrupt the active audio stream on
the other controllers, causing pitch shifts or FIFO underflows?

Would it be safer to use clk_set_rate_exclusive() to lock the rate while the
stream is active and reject conflicting requests?

>  	ret = clk_set_rate(i2s->bclk, bclk_rate);
>  	if (ret)
>  		return ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260522-k3-i2s-v3-0-08e3eb811d93@linux.spacemit.com?part=2

  reply	other threads:[~2026-05-22 13:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 13:12 [PATCH v3 0/2] ASoC: spacemit: add K3 SoC support Troy Mitchell
2026-05-22 13:12 ` [PATCH v3 1/2] ASoC: dt-bindings: add SpacemiT K3 SoC compatible Troy Mitchell
2026-05-22 13:12 ` [PATCH v3 2/2] ASoC: spacemit: add K3 SoC support with additional clocks Troy Mitchell
2026-05-22 13:33   ` sashiko-bot [this message]
2026-06-01 15:00 ` [PATCH v3 0/2] ASoC: spacemit: add K3 SoC support 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=20260522133344.EE51B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=troy.mitchell@linux.spacemit.com \
    /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