All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org,
	vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v8 08/23] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate
Date: Wed, 02 Dec 2026 10:29:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-245465@kernel.org> (raw)
In-Reply-To: <20261202-add-support-for-camss-on-sm8750-v8-8-a07210023c55@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: qcom: camss: csid: sibling phy_rx branch clocks drop
  shared RCG rate
--

commit cfe5f923a80f621718373259e5481e6e4f75cb38
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>

media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate

This commit calculates the minimum CSID core and CSIPHY receive clock
rates from the CSI-2 link frequency across all CSID generations and votes
for them with clk_set_rate_range().

> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index e8ecac3505b77..15bde95bea078 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
[ ... ]
> @@ -532,72 +533,197 @@ const struct csid_format_info *csid_get_fmt_entry(const struct csid_format_info
[ ... ]
> +		/*
> +		 * Vote for the rate as a minimum, as the clock may be shared
> +		 * with another CSID which needs it to run faster.
> +		 */
> +		ret = clk_set_rate_range(clock->clk, clock->freq[j], ULONG_MAX);
> +		if (ret < 0) {
> +			dev_err(dev, "clk set rate range failed: %d\n", ret);
> +			return ret;
> +		}
>  	}
>  
>  	return 0;
>  }
>  
> +/*
> + * Drop the minimum rates the CSID votes for and take its clocks back to their
> + * lowest level, or to the lowest level the other users of a shared clock need.
> + */
> +static void csid_release_clock_rates(struct csid_device *csid)
> +{
> +	int i;
> +
> +	for (i = 0; i < csid->nclocks; i++) {
> +		struct camss_clock *clock = &csid->clock[i];
> +		long rate;
> +
> +		if (!clock->nfreqs || !csid_match_scaled_clock_name(clock))
> +			continue;
> +
> +		clk_drop_range(clock->clk);
> +
> +		/* Round first, so that the rate respects the other votes */
> +		rate = clk_round_rate(clock->clk, clock->freq[0]);
> +		if (rate > 0)
> +			clk_set_rate(clock->clk, rate);
> +	}
> +}

[Severity: High]
Can voting on a child phy_rx branch clock allow a sibling branch clock to
drop the shared parent RCG below an active CSID's minimum rate?

On SoCs such as SM8550, SM8750, Eliza and Kaanapali, full CSIDs use
csiphy_rx (CAM_CC_CSID_CSIPHY_RX_CLK) while lite CSIDs use
vfe_lite_cphy_rx (CAM_CC_IFE_LITE_CPHY_RX_CLK), and on SM6150 each CSID
uses its own vfe0_cphy_rx, vfe1_cphy_rx or vfe_lite_cphy_rx clock:

drivers/media/platform/qcom/camss/camss.c:
    /* CSID 0 */
    {
        ...
        .clock = { "csid", "csiphy_rx" },
        .clock_rate = { { 400000000, 480000000 },
                        { 400000000, 480000000 } },
    ...
    /* CSID 3 (lite) */
    {
        ...
        .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" },
        .clock_rate = { { 400000000, 480000000 },
                        { 400000000, 480000000 } },

In the camcc clock drivers, these are distinct clk_branch2 leaf clocks
with CLK_SET_RATE_PARENT parented to a single shared RCG
(cam_cc_cphy_rx_clk_src).

clk_set_rate_range() records the minimum rate constraint on the child
branch clock's clk_core, not on the parent RCG.  When another CSID using
a sibling branch clock starts a slower stream in csid_set_clock_rates()
or stops streaming in csid_release_clock_rates() and lowers its branch
clock to clock->freq[0], the CCF rate calculation only checks the bounds
on that sibling branch clk_core and the parent RCG clk_core.  Because
neither holds the active CSID's minimum vote, clk_change_rate()
reprograms cam_cc_cphy_rx_clk_src to the lower frequency and underclocks
the active CSID's receive interface mid-stream.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-add-support-for-camss-on-sm8750-v8-0-a07210023c55@oss.qualcomm.com?part=8

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org,
	vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v8 08/23] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate
Date: Wed, 02 Dec 2026 10:29:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-245465@kernel.org> (raw)
In-Reply-To: <20261202-add-support-for-camss-on-sm8750-v8-8-a07210023c55@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: qcom: camss: csid: sibling phy_rx branch clocks drop
  shared RCG rate
--

commit cfe5f923a80f621718373259e5481e6e4f75cb38
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>

media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate

This commit calculates the minimum CSID core and CSIPHY receive clock
rates from the CSI-2 link frequency across all CSID generations and votes
for them with clk_set_rate_range().

> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index e8ecac3505b77..15bde95bea078 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
[ ... ]
> @@ -532,72 +533,197 @@ const struct csid_format_info *csid_get_fmt_entry(const struct csid_format_info
[ ... ]
> +		/*
> +		 * Vote for the rate as a minimum, as the clock may be shared
> +		 * with another CSID which needs it to run faster.
> +		 */
> +		ret = clk_set_rate_range(clock->clk, clock->freq[j], ULONG_MAX);
> +		if (ret < 0) {
> +			dev_err(dev, "clk set rate range failed: %d\n", ret);
> +			return ret;
> +		}
>  	}
>  
>  	return 0;
>  }
>  
> +/*
> + * Drop the minimum rates the CSID votes for and take its clocks back to their
> + * lowest level, or to the lowest level the other users of a shared clock need.
> + */
> +static void csid_release_clock_rates(struct csid_device *csid)
> +{
> +	int i;
> +
> +	for (i = 0; i < csid->nclocks; i++) {
> +		struct camss_clock *clock = &csid->clock[i];
> +		long rate;
> +
> +		if (!clock->nfreqs || !csid_match_scaled_clock_name(clock))
> +			continue;
> +
> +		clk_drop_range(clock->clk);
> +
> +		/* Round first, so that the rate respects the other votes */
> +		rate = clk_round_rate(clock->clk, clock->freq[0]);
> +		if (rate > 0)
> +			clk_set_rate(clock->clk, rate);
> +	}
> +}

[Severity: High]
Can voting on a child phy_rx branch clock allow a sibling branch clock to
drop the shared parent RCG below an active CSID's minimum rate?

On SoCs such as SM8550, SM8750, Eliza and Kaanapali, full CSIDs use
csiphy_rx (CAM_CC_CSID_CSIPHY_RX_CLK) while lite CSIDs use
vfe_lite_cphy_rx (CAM_CC_IFE_LITE_CPHY_RX_CLK), and on SM6150 each CSID
uses its own vfe0_cphy_rx, vfe1_cphy_rx or vfe_lite_cphy_rx clock:

drivers/media/platform/qcom/camss/camss.c:
    /* CSID 0 */
    {
        ...
        .clock = { "csid", "csiphy_rx" },
        .clock_rate = { { 400000000, 480000000 },
                        { 400000000, 480000000 } },
    ...
    /* CSID 3 (lite) */
    {
        ...
        .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" },
        .clock_rate = { { 400000000, 480000000 },
                        { 400000000, 480000000 } },

In the camcc clock drivers, these are distinct clk_branch2 leaf clocks
with CLK_SET_RATE_PARENT parented to a single shared RCG
(cam_cc_cphy_rx_clk_src).

clk_set_rate_range() records the minimum rate constraint on the child
branch clock's clk_core, not on the parent RCG.  When another CSID using
a sibling branch clock starts a slower stream in csid_set_clock_rates()
or stops streaming in csid_release_clock_rates() and lowers its branch
clock to clock->freq[0], the CCF rate calculation only checks the bounds
on that sibling branch clk_core and the parent RCG clk_core.  Because
neither holds the active CSID's minimum vote, clk_change_rate()
reprograms cam_cc_cphy_rx_clk_src to the lower frequency and underclocks
the active CSID's receive interface mid-stream.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-add-support-for-camss-on-sm8750-v8-0-a07210023c55@oss.qualcomm.com?part=8

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-12-02 10:29 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:59 [PATCH v8 00/23] Add CAMSS support for SM8750 and Eliza Wenmeng Liu
2026-12-02  9:59 ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 01/23] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add SM8750 CSI2 PHY Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 02/23] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Eliza " Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 03/23] dt-bindings: media: qcom,sm8750-camss: Add SM8750 CAMSS Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 04/23] dt-bindings: media: qcom,eliza-camss: Add Eliza CAMSS Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 05/23] dt-bindings: i2c: qcom-cci: Document Eliza compatible Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 06/23] media: qcom: camss: Add SM8750 compatible Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02 10:46   ` Loic Poulain
2026-12-02 10:46     ` Loic Poulain
2026-12-02  9:59 ` [PATCH v8 07/23] media: qcom: camss: Add PM clock definitions for SM8750 Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 08/23] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02 10:29   ` sashiko-bot [this message]
2026-12-02 10:29     ` sashiko-bot
2026-12-02  9:59 ` [PATCH v8 09/23] media: qcom: camss: csid: Add support for CSID 980 Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02 10:22   ` sashiko-bot
2026-12-02 10:22     ` sashiko-bot
2026-12-02  9:59 ` [PATCH v8 10/23] media: qcom: camss: vfe: Add support for VFE 980 Wenmeng Liu
2026-12-02 10:14   ` sashiko-bot
2026-12-02 10:14     ` sashiko-bot
2026-12-02  9:59 ` [PATCH v8 11/23] media: qcom: camss: Add TPG support for SM8750 Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 12/23] media: qcom: camss: Add Eliza compatible Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 13/23] arm64: dts: qcom: sm8750: Add CAMSS and CSIPHY block definitions Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 14/23] arm64: dts: qcom: sm8750: Add CCI definitions Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 15/23] arm64: dts: qcom: sm8750: Add camera MCLK pinctrl Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 16/23] arm64: dts: qcom: sm8750-qrd: Enable S5KJN1 camera sensor Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 17/23] arm64: dts: qcom: sm8750-mtp: " Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 18/23] arm64: dts: qcom: eliza: Add CAMSS and CSIPHY block definitions Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 19/23] arm64: dts: qcom: eliza: Add CCI definitions Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 20/23] arm64: dts: qcom: eliza: Add camera MCLK pinctrl Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 21/23] arm64: dts: qcom: eliza-mtp: Add PM8010 PMICs Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 22/23] arm64: dts: qcom: eliza-mtp: Enable rear camera Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu
2026-12-02  9:59 ` [PATCH v8 23/23] arm64: dts: qcom: eliza-evk-imx577-camera: Add DT overlay Wenmeng Liu
2026-12-02  9:59   ` Wenmeng Liu

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-245465@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=media-ci@linuxtv.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    --cc=wenmeng.liu@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 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.