Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] clk: qcom: add SM8650 LPASS core & audio clock controllers
Date: Tue, 24 Nov 2026 17:40:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-231728@kernel.org> (raw)
In-Reply-To: <20261124-topic-sm8650-el2-clks-v2-2-8086440e2c09@linaro.org>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] clk: qcom: unclocked GDSC MMIO access in lpass_aon_cc on SM8650
- [Medium] clk: qcom: MND freq_tbl used on non-MND
  lpass_aon_cc_main_rcg_clk_src
- [Medium] clk: qcom: MCLK branches parented to 2X RCGs instead of CDIV
  dividers
- [Low] clk: qcom: stale LPASS HM iface clock description in commit
  message
--

commit 5b9d49ed39635aa6cd0df792f0d843cc860ce478
Author: Neil Armstrong <neil.armstrong@linaro.org>

clk: qcom: add SM8650 LPASS core & audio clock controllers

This commit adds drivers for the SM8650 LPASS HM, core, audio, and AON
clock controllers so Linux can manage LPASS clocks and GDSCs without ADSP
firmware.

> Add drivers for the SM8650 LPASS HM, core, audio and AON clock
> controllers, the HM, audio and AON controllers keeping their iface clock
> enabled while in use, LPASS HM's being the GCC LPASS config NoC clock.

[Severity: Low]
Is the commit message description of LPASS HM's iface clock still
accurate?  Only the audio and AON drivers acquire and manage an "iface"
clock via pm_clk_add(); lpass_hm_core_probe() calls qcom_cc_probe()
directly without setting up pm_clk.

> diff --git a/drivers/clk/qcom/lpassaudiocc-sm8650.c b/drivers/clk/qcom/lpassaudiocc-sm8650.c
> new file mode 100644
> index 0000000000000..abd0258d9e72f
> --- /dev/null
> +++ b/drivers/clk/qcom/lpassaudiocc-sm8650.c
[ ... ]
> +/* XO only for now: the ADSP plan feeds these from the audio CC DIG PLL */
> +static const struct freq_tbl ftbl_lpass_cc_ext_clk_src[] = {
> +	F(1536000, P_BI_TCXO, 1, 2, 25),
> +	F(2304000, P_BI_TCXO, 1, 3, 25),
> +	F(3072000, P_BI_TCXO, 1, 4, 25),
> +	F(9600000, P_BI_TCXO, 2, 0, 0),
> +	F(19200000, P_BI_TCXO, 1, 0, 0),
> +	{ }
> +};
[ ... ]
> +static struct clk_rcg2 lpass_aon_cc_main_rcg_clk_src = {
> +	.cmd_rcgr = 0x19000,
> +	.mnd_width = 0,
> +	.hid_width = 5,
> +	.parent_map = lpass_aon_cc_parent_map_0,
> +	.freq_tbl = ftbl_lpass_cc_ext_clk_src,
> +	.clkr.hw.init = &(const struct clk_init_data){
> +		.name = "lpass_aon_cc_main_rcg_clk_src",
> +		.parent_data = lpass_aon_cc_parent_data_0,
> +		.num_parents = ARRAY_SIZE(lpass_aon_cc_parent_data_0),
> +		.ops = &clk_rcg2_ops,
> +	},
> +};

[Severity: Medium]
Should lpass_aon_cc_main_rcg_clk_src use a frequency table without MND
entries (such as ftbl_lpass_mclk_clk_src) since its .mnd_width is 0?

Because __clk_rcg2_configure_mnd() only programs M, N, and D when
rcg->mnd_width is non-zero, requesting 1.536 MHz, 2.304 MHz, or 3.072 MHz
on lpass_aon_cc_main_rcg_clk_src (or via its CLK_SET_RATE_PARENT child
branches) matches the fractional M/N entries in ftbl_lpass_cc_ext_clk_src
during rate determination, but programs only pre_div = 1 in hardware,
leaving the clock running at 19.2 MHz.

[ ... ]

> +/* MCLK = RCG / CDIV (reset value: divide by 2), the 2X clocks are the RCG */
> +static struct clk_regmap_div lpass_audio_cc_cdiv_rx_mclk_div_clk_src = {
[ ... ]
> +static struct clk_branch lpass_audio_cc_wsa_mclk_clk = {
> +	.halt_reg = 0x2a0d4,
> +	.halt_check = BRANCH_HALT,
> +	.clkr = {
> +		.enable_reg = 0x2a0d4,
> +		.enable_mask = BIT(0),
> +		.hw.init = &(const struct clk_init_data){
> +			.name = "lpass_audio_cc_wsa_mclk_clk",
> +			.parent_hws = (const struct clk_hw*[]){
> +				&lpass_audio_cc_cdiv_wsa_mclk_div_clk_src.clkr.hw,
> +			},
> +			.num_parents = 1,
> +			.flags = CLK_SET_RATE_PARENT,
> +			.ops = &clk_branch2_ops,
> +		},
> +	},
> +};
> +
> +static struct clk_branch lpass_audio_cc_wsa2_mclk_clk = {
> +	.halt_reg = 0x2d004,
> +	.halt_check = BRANCH_HALT,
> +	.clkr = {
> +		.enable_reg = 0x2d004,
> +		.enable_mask = BIT(0),
> +		.hw.init = &(const struct clk_init_data){
> +			.name = "lpass_audio_cc_wsa2_mclk_clk",
> +			.parent_hws = (const struct clk_hw*[]){
> +				&lpass_audio_cc_wsa_mclk_clk_src.clkr.hw,
> +			},
> +			.num_parents = 1,
> +			.flags = CLK_SET_RATE_PARENT,
> +			.ops = &clk_branch2_ops,
> +		},
> +	},
> +};
> +
> +static struct clk_branch lpass_audio_cc_tx_mclk_wsa_clk = {
> +	.halt_reg = 0x2a0f4,
> +	.halt_check = BRANCH_HALT,
> +	.clkr = {
> +		.enable_reg = 0x2a0f4,
> +		.enable_mask = BIT(0),
> +		.hw.init = &(const struct clk_init_data){
> +			.name = "lpass_audio_cc_tx_mclk_wsa_clk",
> +			.parent_hws = (const struct clk_hw*[]){
> +				&lpass_aon_cc_tx_mclk_clk_src.clkr.hw,
> +			},
> +			.num_parents = 1,
> +			.flags = CLK_SET_RATE_PARENT,
> +			.ops = &clk_branch2_ops,
> +		},
> +	},
> +};
> +
> +static struct clk_branch lpass_audio_cc_tx_mclk_rx_clk = {
> +	.halt_reg = 0x2c0e0,
> +	.halt_check = BRANCH_HALT,
> +	.clkr = {
> +		.enable_reg = 0x2c0e0,
> +		.enable_mask = BIT(0),
> +		.hw.init = &(const struct clk_init_data){
> +			.name = "lpass_audio_cc_tx_mclk_rx_clk",
> +			.parent_hws = (const struct clk_hw*[]){
> +				&lpass_aon_cc_tx_mclk_clk_src.clkr.hw,
> +			},
> +			.num_parents = 1,
> +			.flags = CLK_SET_RATE_PARENT,
> +			.ops = &clk_branch2_ops,
> +		},
> +	},
> +};
> +
> +static struct clk_branch lpass_audio_cc_tx_mclk_wsa2_clk = {
> +	.halt_reg = 0x2d00c,
> +	.halt_check = BRANCH_HALT,
> +	.clkr = {
> +		.enable_reg = 0x2d00c,
> +		.enable_mask = BIT(0),
> +		.hw.init = &(const struct clk_init_data){
> +			.name = "lpass_audio_cc_tx_mclk_wsa2_clk",
> +			.parent_hws = (const struct clk_hw*[]){
> +				&lpass_aon_cc_tx_mclk_clk_src.clkr.hw,
> +			},
> +			.num_parents = 1,
> +			.flags = CLK_SET_RATE_PARENT,
> +			.ops = &clk_branch2_ops,
> +		},
> +	},
> +};

[Severity: Medium]
Should lpass_audio_cc_wsa2_mclk_clk and the three lpass_audio_cc_tx_mclk_*
branches be parented to their CDIV divider clocks rather than directly to
the 2X RCG clock sources?

As noted in the CDIV comment above, 1X MCLK branches are divided by CDIV
(divide by 2 at reset), which is how lpass_audio_cc_rx_mclk_clk,
lpass_audio_cc_wsa_mclk_clk, and lpass_aon_cc_tx_mclk_clk are wired.
Parenting lpass_audio_cc_wsa2_mclk_clk directly to
lpass_audio_cc_wsa_mclk_clk_src and lpass_audio_cc_tx_mclk_{wsa,rx,wsa2}_clk
directly to lpass_aon_cc_tx_mclk_clk_src with CLK_SET_RATE_PARENT causes a
2x rate mismatch in clk_get_rate() and conflicts with sibling 1X MCLK
branches sharing those RCGs when clk_set_rate() is called.

[ ... ]

> +static struct gdsc lpass_aon_cc_lpass_audio_hm_gdsc = {
> +	.gdscr = 0x11090,
> +	.pd = {
> +		.name = "lpass_aon_cc_lpass_audio_hm_gdsc",
> +	},
> +	.pwrsts = PWRSTS_OFF_ON,
> +	.flags = RETAIN_FF_ENABLE,
> +};
[ ... ]
> +static int lpass_cc_sm8650_probe(struct platform_device *pdev,
> +				 const struct qcom_cc_desc *desc)
> +{
> +	int ret;
> +
> +	ret = devm_pm_runtime_enable(&pdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_pm_clk_create(&pdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_clk_add(&pdev->dev, "iface");
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "failed to acquire iface clock\n");
> +		return ret;
> +	}
> +
> +	ret = pm_runtime_resume_and_get(&pdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = qcom_cc_probe(pdev, desc);
> +
> +	pm_runtime_put_sync(&pdev->dev);
> +
> +	return ret;
> +}

[Severity: High]
Can gdsc_enable() or gdsc_disable() access
lpass_aon_cc_lpass_audio_hm_gdsc (offset 0x11090) while lpass_aon_cc is
runtime-suspended and its iface clock is disabled?

At the end of lpass_cc_sm8650_probe(), pm_runtime_put_sync() suspends
lpass_aon_cc and disables its iface clock (LPASS_CORE_CC_CORE_CLK), which
also allows lpass_core_cc to runtime-suspend and power off
LPASS_CORE_HM_GDSC.  Because gdsc_enable() and gdsc_disable() do not
runtime-resume the GDSC provider device, any genpd power transition that
runs while lpass_aon_cc is suspended performs unclocked MMIO on 0x11090
and triggers a bus hang or SError.  For example, genpd_power_off_unused()
at late_initcall_sync, asynchronous genpd_power_off_work_fn() after a
consumer drops its runtime PM supplier link, or system suspend/resume of a
virtual genpd device attached via dev_pm_domain_attach_by_name() in
lpass_macro_pds_init() can all toggle this GDSC while lpass_aon_cc is
runtime-suspended.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-topic-sm8650-el2-clks-v2-0-8086440e2c09@linaro.org?part=2

      reply	other threads:[~2026-11-24 17:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 17:01 [PATCH v2 0/2] clk: qcom: add SM8650 LPASS core & audio clock controllers Neil Armstrong
2026-11-24 17:01 ` [PATCH v2 1/2] dt-bindings: clock: " Neil Armstrong
2026-11-24 17:08   ` sashiko-bot
2026-11-24 17:01 ` [PATCH v2 2/2] clk: " Neil Armstrong
2026-11-24 17:40   ` sashiko-bot [this message]

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-231728@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --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