From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796287171; b=5b2aUpVK5NNrFCee7HvgdPd5yMwdnYjiRGwwi8YPwT+v3zWtmkGqsyLRt4pAucSgfsua BNWfd3gr81XCfBnhhUZ5A7zOb5dZjnMtbwns+2dn4gEwmFv0MBw7Ibt3kGrD4jkRWtnHc llquudHPq/j4k6cpIEiXH9agoXZ2pbdo3W65mBDJAyGgJD3iz1b/Am0iuKmE5zXMGWxIs WILu6PAlmbr1n3RoPMMdvO+BNRJfqDb2+udIk5P/UUh6RFwBGRGO5m53xtJOPjTuXEymz RtVLO0bXvWAVqaYacvl1fmfgTYQXjJ323WwjeShHQDIRnJYGjlHbcOswBeSMWB2yLsw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287171; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=IPOTxkF4l+skHb7y+LXSXkcr72lS/W4HX/3+bex4oEg=; b=GoqvL4H5/5Wbsm5FeV5BlVthfaqGifyBK3DA5jSJUxiHc1oCQAEIoVbM7dtdUwK0gJkC KIDQtQbrAvhNm+uTO8EFHT4EALT3auiOBpyDNolbcxxH0OAsKyRSsxURtssVy+QXdJjGa RVwFHMXRcDKMoF59C1hlQ+PhGCdtMD3bWSlAWCaIeyOY7cTCiQVZA6ZCRf4NPNuOGR6B/ KDZ0F/OcBBvJYoU65iz0VPxUQinuS1lDDcCH6VuJfUR8cS3onac2ZbrWd7mYYZFy4P0AZ WyhfggirUBw9MQ3R6HWgdTjSq6EkXCZquiVNr4iSi8l14B1I22g4SbkmIqocOYG4tSw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="FHl4ZUW/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 090E9606A322 for ; Thu, 3 Dec 2026 08:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FHl4ZUW/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D3D01F000C1; Thu, 3 Dec 2026 08:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796287170; bh=IPOTxkF4l+skHb7y+LXSXkcr72lS/W4HX/3+bex4oEg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FHl4ZUW/2HwUOAI7wUdHil2TQ61RBvOkS3/rkRPzKqeUiqiHlrsGTgv21Ii1mEMTU jgNOeSH1qh3t4xxiDLzEzhxMpfE0YPLWXYF6tmyh5fQfT1N2wRrv+wxKsHpJ4NAS0u 2mNEsObp5vVxx8adVjmxb2SSLoMZibJUJlrAjk+PH/SHKapiwKgC8kl+pTDfMM+jVX wuVLnHvJjjd+/+t5ulS+KM756EOhi4Jj/7SlAmw2KeLUpc8roG+Hf8IPEMUXkYw12g fSzu3959VVHrQtolstifMuTbN3LPaBYz3y/G0rUSmc+Q+6zaZmbG7H6kro+4FawgIa vrGoQJkQhLksw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 2/3] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate Reply-To: sashiko-reviews@lists.linux.dev To: "Nihal Kumar Gupta" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261203-hawi-camss-v6-2-6a30cc09a064@oss.qualcomm.com> References: <20261203-hawi-camss-v6-0-6a30cc09a064@oss.qualcomm.com> <20261203-hawi-camss-v6-2-6a30cc09a064@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 08:39:30 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] media: qcom: camss: leaf-branch votes fail to protect shared cphy_rx RCG - [Medium] media: qcom: camss: csid_cap_clock_level() is a no-op for known link rates - [Medium] media: qcom: camss: clk_set_rate_range() leaves CSID clocks stuck high -- commit 4e29d22048255b4715c551cb9170cf49335975d6 Author: Loic Poulain media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate This commit scales the CSID core and CSIPHY receive clocks according to the sensor CSI-2 link frequency across all CAMSS generations using clk_set_rate_range(), and drops those minimum rate votes on power-off. > diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/med= ia/platform/qcom/camss/camss-csid.c > index 123c097ee54bf..543ea9d05127f 100644 > --- a/drivers/media/platform/qcom/camss/camss-csid.c > +++ b/drivers/media/platform/qcom/camss/camss-csid.c [ ... ] > +/* Lower a level down to max_rate, but never below what min_rate needs */ > +static int csid_cap_clock_level(struct camss_clock *clock, int level, > + u64 min_rate, u64 max_rate) > +{ > + while (level > 0 && clock->freq[level] > max_rate && > + clock->freq[level - 1] > min_rate) > + level--; > + > + return level; > +} [Severity: Medium] Is csid_cap_clock_level() a no-op for every known sensor link rate? When min_rate is non-zero, csid_find_clock_level() returns the lowest index where clock->freq[level] > min_rate, so clock->freq[level - 1] is always <=3D min_rate. The while loop can therefore only execute when min_rate is 0. Because csid_set_clock_rates() also settles core_rate before resolving phy_rx clocks, a phy_rx clock can outrun the core clock even when a faster core OPP exists. For example, on SM6150 with 269.33 MHz <=3D min_rate < 320 MHz, vfe0_cphy_rx steps up to 384 MHz while vfe0_csid stays at 320 MHz despite 540 MHz being available, risking CSID backpressure or overflow. Resolving the phy_rx clock first and selecting a core level at least as high would keep the core clock ahead. [ ... ] > + /* > + * Vote for the rate as a minimum, as the clock may be shared > + * with another CSID which needs it to run faster. > + */ > + ret =3D 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; > } > } [Severity: Medium] Does calling clk_set_rate_range() with ULONG_MAX alone leave scaled clocks stuck at a higher rate? clk_set_rate_range_nolock() clamps clk->core->req_rate to [min, max], so passing ULONG_MAX never lowers an already-higher req_rate. On X1E80100, tpg_set_clock_rates() leaves csid_csiphy_rx at 400 MHz after power-off, keeping a later 300 MHz sensor stuck at 400 MHz. Rounding and setting clock->freq[j] afterwards, as csid_release_clock_rates() does, would lower req_rate while still respecting higher votes on the same clock. [ ... ] > +static void csid_release_clock_rates(struct csid_device *csid) > +{ > + int i; > + > + for (i =3D 0; i < csid->nclocks; i++) { > + struct camss_clock *clock =3D &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 =3D clk_round_rate(clock->clk, clock->freq[0]); > + if (rate > 0) > + clk_set_rate(clock->clk, rate); > + } > +} [Severity: High] Can sibling CSID branch clocks sharing a parent RCG still underclock an actively streaming CSID? clk_set_rate_range() records min_rate only on the leaf clk_branch2 consumer, and clk_core_get_boundaries() aggregates votes only across core->clks of that clock. Because clk_branch2_ops propagates rate changes via CLK_SET_RATE_PARENT, the shared parent RCG's min_rate stays 0. On SM8550 and X1E80100, full CSIDs scale cam_cc_csid_csiphy_rx_clk while lite CSIDs scale cam_cc_ife_lite_cphy_rx_clk, two distinct clk_branch2 children of cam_cc_cphy_rx_clk_src (and SM6150 has three vfe*_cphy_rx siblings). When a full CSID streams at 480 MHz and a lite CSID starts a slower sensor or powers off via csid_release_clock_rates() (including on the csid_set_power() error path), the sibling branch lowers cam_cc_cphy_rx_clk_src underneath the active CSID. Underclocking the receive clock below link_freq / 4 causes CSI-2 receive FIFO overruns, dropped or corrupted frames, or stream failure during concurrent multi-camera capture. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-hawi-camss= -v6-0-6a30cc09a064@oss.qualcomm.com?part=3D2