Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Taniya Das" <taniya.das@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 5/5] arm64: dts: qcom: Add GP M/N clock controller node for SA8775P and QCS8300
Date: Wed, 03 Jun 2026 15:25:50 +0000	[thread overview]
Message-ID: <20260603152550.872401F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602-pdm_clk_gp_mnd_v1-v1-5-1522662b6c53@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [High] Intent Mismatch / Incorrect File Modification
- [High] Missing 'status = "disabled";' causes unconditional probe and pin conflict
- [Low] Device Tree Node Sorting violation

Pre-existing issues:
- [High] Hardware Constraint Violation in duty cycle computation
--

commit 6b4f5403f54605460d10e6b912f07451ceb5b128
Author: Taniya Das <taniya.das@oss.qualcomm.com>

arm64: dts: qcom: Add GP M/N clock controller node for SA8775P and QCS8300

This commit adds the GP M/N divider clock controller node to the SA8775P and
QCS8300 device trees. The new node uses the qcom,clk-gp-mnd compatible and is
clocked by the PDM XO4 and AHB clocks to expose a single clock output.

> Add the GP M/N divider clock controller node at 0x088d3000 to the
> SA8775P (kodiak, lemans) and QCS8300 (monaco) SoC device trees.

[Severity: High]
Is Kodiak actually an SA8775P variant? Kodiak is typically the core SoC
device tree for the SC7280 family (Snapdragon 7c Gen 3 / QCM6490), while
SA8775P is exclusively Lemans. Does modifying kodiak.dtsi incorrectly apply
this clock controller to the SC7280 family and break its device tree?

> diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
> --- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
> +++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
> @@ -4412,6 +4412,20 @@ usb2_role_switch: endpoint {
>  			};
>  		};
>  
> +		gp_mn: clock-controller@88d3000 {

[Severity: Low]
Is this node placed in the correct sorting order? It appears to be inserted
sequentially after the usb@8c00000 node, but 0x088d3000 is less than
0x08c00000, which causes a unit-address sorting violation.

> +			compatible = "qcom,clk-gp-mnd";
> +			reg = <0x0 0x088d3000 0x0 0xc>;
> +			clocks = <&gcc GCC_PDM_XO4_CLK>,
> +				 <&gcc GCC_PDM_AHB_CLK>;
> +			clock-names = "pdm_clk", "ahb_clk";
> +			clock-output-names = "gp_mn_clk";
> +			#clock-cells = <0>;
> +			pinctrl-names = "active";
> +			pinctrl-0 = <&gp_mn_active>;
> +			assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> +			assigned-clock-rates = <4800000>;
> +		};

[Severity: High]
Should this node include a status = "disabled" property? IP blocks that
export signals to external pads are usually disabled by default in SoC dtsi
files. 

Without it, does the qcom,clk-gp-mnd driver probe unconditionally on every
board, forcibly multiplexing gpio35 to the gp_mn function? This could
potentially break boards that require gpio35 for other functions like
qup_spi8_cs or qup_uart8_rx.

[ ... ]

> diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qcom/lemans.dtsi
> --- a/arch/arm64/boot/dts/qcom/lemans.dtsi
> +++ b/arch/arm64/boot/dts/qcom/lemans.dtsi
> @@ -4353,6 +4353,20 @@ opp-384000000 {
>  			};
>  		};
>  
> +		gp_mn: clock-controller@88d3000 {
> +			compatible = "qcom,clk-gp-mnd";
> +			reg = <0x0 0x088d3000 0x0 0xc>;
> +			clocks = <&gcc GCC_PDM_XO4_CLK>,
> +				 <&gcc GCC_PDM_AHB_CLK>;
> +			clock-names = "pdm_clk", "ahb_clk";
> +			clock-output-names = "gp_mn_clk";
> +			#clock-cells = <0>;
> +			pinctrl-names = "active";
> +			pinctrl-0 = <&gp_mn_active>;
> +			assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> +			assigned-clock-rates = <4800000>;
> +		};

[Severity: High]
Would it be necessary to add a status = "disabled" property here as well to
prevent the unconditional multiplexing of gpio35?

[ ... ]

> diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
> --- a/arch/arm64/boot/dts/qcom/monaco.dtsi
> +++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
> @@ -4867,6 +4867,20 @@ opp-384000000 {
>  			};
>  		};
>  
> +		gp_mn: clock-controller@88d3000 {
> +			compatible = "qcom,clk-gp-mnd";
> +			reg = <0x0 0x088d3000 0x0 0xc>;
> +			clocks = <&gcc GCC_PDM_XO4_CLK>,
> +				 <&gcc GCC_PDM_AHB_CLK>;
> +			clock-names = "pdm_clk", "ahb_clk";
> +			clock-output-names = "gp_mn_clk";
> +			#clock-cells = <0>;
> +			pinctrl-names = "active";
> +			pinctrl-0 = <&gp_mn_active>;
> +			assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
> +			assigned-clock-rates = <4800000>;
> +		};

[Severity: High]
Similarly, does this node also need status = "disabled" to ensure safe
default behavior?

[ ... ]

While reviewing this change, a pre-existing issue was noticed in the clock
driver itself regarding hardware duty cycle constraints:

drivers/clk/qcom/clk-gp-mnd.c:gp_mnd_clk_set_rate() {
        /*
         * When N = 2M + 1 the valid D range [M+1, M] is empty; no duty
         * cycle can satisfy M < D < (N - M).  Reject before touching hw.
         */
        if (n == 2 * m + 1)
                return -EINVAL;
        ...
        /* Program the closest-to-50% duty cycle. */
        d_val = n / 2;
        ret = regmap_write(gp->regmap, GP_MND_DUTY_REG, d_val);
}

[Severity: High]
This is a pre-existing issue, but does the driver fail to fully enforce the
hardware duty cycle constraint M < D < (N - M)?

If req->rate >= parent_rate / 2, rational_best_approximation can return M=1,
N=2. In this scenario, N <= 2 * M is true, making the check n == 2 * m + 1
evaluate to false, and the calculation proceeds.

Does the driver then blindly compute d_val = N / 2 = 1 and program M=1, D=1,
N=2 into the hardware, violating the M < D constraint?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-pdm_clk_gp_mnd_v1-v1-0-1522662b6c53@oss.qualcomm.com?part=5

  reply	other threads:[~2026-06-03 15:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 15:21 [PATCH 0/5] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
2026-06-02 15:21 ` [PATCH 1/5] dt-bindings: clock: qcom: Add bindings for PDM GP_MN clock divider Taniya Das
2026-06-03 15:25   ` sashiko-bot
2026-06-09 13:24   ` Konrad Dybcio
2026-10-15  7:15     ` Taniya Das
2026-06-09 13:25   ` Konrad Dybcio
2026-10-15  7:15     ` Taniya Das
2026-06-02 15:21 ` [PATCH 2/5] clk: qcom: Add a driver for PDM GP_MN fractional " Taniya Das
2026-06-03 15:25   ` sashiko-bot
2026-06-08  3:31   ` Dmitry Baryshkov
2026-10-15  7:15     ` Taniya Das
2026-06-02 15:21 ` [PATCH 3/5] pinctrl: qcom: Add gp_mn mux function for QCS8300, SA8775P and SC7280 Taniya Das
2026-06-08 22:43   ` Linus Walleij
2026-10-15  7:14     ` Taniya Das
2026-10-15  8:28       ` Linus Walleij
2026-06-09 13:27   ` Konrad Dybcio
2026-10-15  7:14     ` Taniya Das
2026-06-02 15:21 ` [PATCH 4/5] arm64: dts: qcom: Add gp_mn pin state for GP M/N clock output Taniya Das
2026-06-03 15:25   ` sashiko-bot
2026-06-08  7:22   ` Luca Weiss
2026-10-15 10:44     ` Taniya Das
2026-06-09 13:28   ` Konrad Dybcio
2026-10-15  7:14     ` Taniya Das
2026-06-02 15:21 ` [PATCH 5/5] arm64: dts: qcom: Add GP M/N clock controller node for SA8775P and QCS8300 Taniya Das
2026-06-03 15:25   ` sashiko-bot [this message]
2026-06-08  7:32   ` Luca Weiss
2026-10-15 10:45     ` Taniya Das
2026-06-08  7:33   ` Luca Weiss
2026-10-15  7:14     ` Taniya Das

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=20260603152550.872401F00893@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=taniya.das@oss.qualcomm.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