Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Molnár Máté" <matemolnar88@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 4/5] drm/rockchip: lvds: Add RK3128 support
Date: Sun, 06 Dec 2026 03:26:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-252125@kernel.org> (raw)
In-Reply-To: <20261206-rk3128-lvds-v1-4-09543f8e1e9f@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/rockchip: Inno D-PHY left uncycled across RK3128 LVDS
  disable/enable
- [Low] drm/rockchip: unbalanced pm_runtime_put() on rk3128 LVDS enable
  error
--

commit 167c38fbb5c46d1d5b1e6afa49ade12ee926ef77
Author: Molnár Máté <matemolnar88@gmail.com>

drm/rockchip: lvds: Add RK3128 support

This commit adds RK3126/RK3128 LVDS transmitter support to the Rockchip
LVDS driver, configuring GRF_LVDS_CON0 in new encoder enable/disable
callbacks and factoring D-PHY initialization out of px30_lvds_probe() into
a shared helper.

> diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> index 231258974639a..a187e1caf3238 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
> @@ -422,6 +422,43 @@ struct drm_encoder_helper_funcs px30_lvds_encoder_helper_funcs = {
[ ... ]
> +static void rk3128_lvds_encoder_enable(struct drm_encoder *encoder)
> +{
> +	struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
> +	int ret;
> +
> +	ret = pm_runtime_resume_and_get(lvds->dev);
> +	if (ret < 0) {
> +		DRM_DEV_ERROR(lvds->dev, "failed to get pm runtime: %d\n", ret);
> +		return;
> +	}

[Severity: Low]
Can this early return cause an unbalanced pm_runtime_put() in
rk3128_lvds_encoder_disable()?

Because drm_encoder_helper_funcs.enable is void, DRM still treats the
encoder as enabled if pm_runtime_resume_and_get() fails (for example,
via the dphy supplier in RK3128_PD_VIO).  The later disable then calls
pm_runtime_put(lvds->dev), underflowing the runtime PM usage count.

Tracking whether runtime PM was acquired on struct rockchip_lvds before
calling pm_runtime_put() would avoid the imbalance.

> +	regmap_write(lvds->grf, RK3128_GRF_LVDS_CON0,
> +		     RK3128_LVDS_P2S_EN(1) | RK3128_LVDS_MODE_EN(1) |
> +		     RK3128_LVDS_MSBSEL(1) | RK3128_LVDS_FORMAT(lvds->format));
> +}
> +
> +static void rk3128_lvds_encoder_disable(struct drm_encoder *encoder)
> +{
> +	struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
> +
> +	regmap_write(lvds->grf, RK3128_GRF_LVDS_CON0,
> +		     RK3128_LVDS_P2S_EN(0) | RK3128_LVDS_MODE_EN(0));
> +	pm_runtime_put(lvds->dev);
> +}

[Severity: High]
Does leaving lvds->dphy uncycled across disable and enable break LVDS
output after system suspend/resume?

rockchip_lvds_dphy_init() calls phy_power_on(lvds->dphy) once at probe
time, while rk3128_lvds_encoder_disable() and rk3128_lvds_encoder_enable()
never call phy_power_off() or phy_power_on().  During system suspend,
RK3128_PD_VIO is powered off and the Inno D-PHY loses its register state.

Because inno_dsidphy_driver has no suspend/resume callbacks and
rockchip_drm_sys_resume() relies on drm_mode_config_helper_resume() to
re-enable the encoder, the D-PHY is never reinitialized on resume.
It also keeps its PLL, clocks, and RK3128_PD_VIO active during DPMS off.

Cycling phy_power_off()/phy_power_on() in disable/enable (while ensuring
rockchip_lvds_unbind() does not disable an already-disabled encoder) would
restore D-PHY state on resume and allow it to power down when blanked.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-rk3128-lvds-v1-0-09543f8e1e9f@gmail.com?part=4

  reply	other threads:[~2026-12-06  3:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  3:08 [PATCH 0/5] drm/rockchip: Add RK3126/RK3128 LVDS support Molnár Máté via B4 Relay
2026-12-06  3:08 ` [PATCH 1/5] drm/rockchip: lvds: Do not override the panel bridge funcs Molnár Máté via B4 Relay
2026-12-06  3:08 ` [PATCH 2/5] dt-bindings: display: rockchip,lvds: Add RK3128 LVDS Molnár Máté via B4 Relay
2026-12-06  3:08 ` [PATCH 3/5] drm/rockchip: vop: Use the RK3126 LVDS output bits for LVDS Molnár Máté via B4 Relay
2026-12-06  3:08 ` [PATCH 4/5] drm/rockchip: lvds: Add RK3128 support Molnár Máté via B4 Relay
2026-12-06  3:26   ` sashiko-bot [this message]
2026-12-06  3:08 ` [PATCH 5/5] ARM: dts: rockchip: rk3128: Add LVDS node Molnár Máté via B4 Relay

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-252125@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matemolnar88@gmail.com \
    --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