Devicetree
 help / color / mirror / Atom feed
From: "Rok Markovič" <rok@kanardia.eu>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 4/4] arm64: dts: rockchip: rk356x: add LVDS node
Date: Tue, 21 Jul 2026 09:14:54 +0200	[thread overview]
Message-ID: <6391bf976ade8fa7df217d0880ccdb88@kanardia.eu> (raw)
In-Reply-To: <20260717121309.516801F00A3A@smtp.kernel.org>

17.7.2026 14:13, je sashiko-bot@kernel.org napisal
> Thank you for your contribution! Sashiko AI review found 2 potential 
> issue(s) to consider:
> - [High] Missing Hardware Clock Initialization for RK3568 LVDS
> - [Medium] Unbalanced Hardware Resource Teardown in Error Paths
> --
> 
> --- Patch [4]: [PATCH 4/4] arm64: dts: rockchip: rk356x: add LVDS node 
> ---
> commit bfe12cef9ca639b004d58e050ef9175743345f7b
> Author: Rok Markovic <rok@kanardia.eu>
> 
> arm64: dts: rockchip: rk356x: add LVDS node
> 
> This commit adds the LVDS transmitter node for the RK356x SoC, 
> assigning
> its clock, physical interface, and power domains. It is left disabled 
> by
> default, to be enabled by specific board files.
> 
>> diff --git a/arch/arm64/boot/dts/rockchip/rk356x-base.dtsi 
>> b/arch/arm64/boot/dts/rockchip/rk356x-base.dtsi
>> index a5832895bd392..2b3beab5507b1 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk356x-base.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk356x-base.dtsi
>> @@ -879,6 +879,31 @@ hdmi_out: port@1 {
>>  		};
>>  	};
>> 
>> +	lvds: lvds {
>> +		compatible = "rockchip,rk3568-lvds";
>> +		clocks = <&cru PCLK_DSITX_0>;
>> +		clock-names = "pclk_lvds";
> 
> [Severity: High]
> Does the driver actually use this clock?
> 
> Looking at rk3568_lvds_probe() in 
> drivers/gpu/drm/rockchip/rockchip_lvds.c,
> it seems to completely omit fetching the required pclk_lvds clock from 
> the
> device tree:
> 
> drivers/gpu/drm/rockchip/rockchip_lvds.c:rk3568_lvds_probe() {
>     ...
>     lvds->dphy = devm_phy_get(&pdev->dev, "dphy");
>     if (IS_ERR(lvds->dphy))
>         return PTR_ERR(lvds->dphy);
> 
>     return phy_init(lvds->dphy);
> }
> 
> Because lvds->pclk is left NULL, the clk_enable() call in
> rk3568_lvds_poweron() acts as a no-op:
> 
> drivers/gpu/drm/rockchip/rockchip_lvds.c:rk3568_lvds_poweron() {
>     ...
>     ret = clk_enable(lvds->pclk);
>     if (ret < 0) {
>     ...
> }
> 
> Will this cause hardware registers to be accessed without a running 
> clock,
> potentially leading to system hangs on device probe or modeset?
> 
>> +		phys = <&dsi_dphy0>;
>> +		phy-names = "dphy";
>> +		power-domains = <&power RK3568_PD_VO>;
>> +		rockchip,grf = <&grf>;
>> +		rockchip,output = "lvds";
>> +		status = "disabled";
>> +
>> +		ports {

Fixed. Removed unused clock.


> 
> [Severity: Medium]
> Will enabling this hardware expose an unbalanced resource teardown in 
> the
> driver's error paths?
> 
> If intermediate steps like phy_set_mode() fail in
> rk3568_lvds_encoder_enable(), the function returns early without 
> rolling
> back earlier successful calls:
> 
> drivers/gpu/drm/rockchip/rockchip_lvds.c:rk3568_lvds_encoder_enable() {
>     ...
>     ret = phy_set_mode(lvds->dphy, PHY_MODE_LVDS);
>     if (ret) {
>         DRM_DEV_ERROR(lvds->dev, "failed to set phy mode: %d\n", ret);
>         drm_panel_unprepare(lvds->panel);
>         return;
>     }
>     ...
> }
> 
> Because .enable() returns void, the DRM core assumes it succeeded and 
> will
> later call .disable(). The rk3568_lvds_encoder_disable() function
> unconditionally tears down all resources:
> 
> drivers/gpu/drm/rockchip/rockchip_lvds.c:rk3568_lvds_encoder_disable() 
> {
>     struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
> 
>     drm_panel_disable(lvds->panel);
>     phy_power_off(lvds->dphy);
>     rk3568_lvds_poweroff(lvds);
>     drm_panel_unprepare(lvds->panel);
> }
> 
> Could this cause refcount underflows for PHY, PM runtime, and clocks,
> resulting in kernel warnings if they were never successfully enabled?
> 
>> +			#address-cells = <1>;
>> +			#size-cells = <0>;
>> +
>> +			lvds_in: port@0 {
>> +				reg = <0>;
>> +			};
>> +
>> +			lvds_out: port@1 {
>> +				reg = <1>;
>> +			};
>> +		};
>> +	};
>> +


Fixed. Testing if lvds->enabled in disable.

Will post patchset v2.

      reply	other threads:[~2026-07-21  7:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 12:00 [PATCH 0/4] drm/rockchip: add RK3568 LVDS support Rok Markovic
2026-07-17 12:00 ` [PATCH 1/4] drm/rockchip: lvds: propagate bus_flags to the CRTC state Rok Markovic
2026-07-17 12:16   ` sashiko-bot
2026-07-20  1:27   ` Chaoyi Chen
2026-07-17 12:00 ` [PATCH 2/4] dt-bindings: display: rockchip,lvds: add RK3568 Rok Markovic
2026-07-17 12:00 ` [PATCH 3/4] drm/rockchip: lvds: add RK3568 support Rok Markovic
2026-07-17 12:16   ` sashiko-bot
2026-07-20  1:54   ` Chaoyi Chen
2026-07-21  8:31     ` Rok Markovič
2026-07-21  8:48       ` Chaoyi Chen
2026-07-20  5:39   ` Alibek Omarov
2026-07-20 12:20     ` AW: " Jakob Loe
2026-07-17 12:00 ` [PATCH 4/4] arm64: dts: rockchip: rk356x: add LVDS node Rok Markovic
2026-07-17 12:13   ` sashiko-bot
2026-07-21  7:14     ` Rok Markovič [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=6391bf976ade8fa7df217d0880ccdb88@kanardia.eu \
    --to=rok@kanardia.eu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.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