Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 07/15] drm/rockchip: vop2: Reset AXI and DCLK to improve robustness
Date: Thu, 05 Nov 2026 01:20:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-198401@kernel.org> (raw)
In-Reply-To: <20261105-dw-hdmi-qp-yuv-v6-7-1bb63ef5766e@collabora.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/rockchip: vop2: missing of_node_put() on error in vop2_create_crtcs()
- [Medium] drm/rockchip: vop2: axi_rst pulsed in vop2_bind() without enabling aclk or PM
--

commit 7b3ce842063d5aafe025d15a4339ddc7bddb6893
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

drm/rockchip: vop2: Reset AXI and DCLK to improve robustness

This commit adds optional AXI and VP DCLK reset controls to the Rockchip VOP2
driver, pulsing the AXI reset during bind and CRTC disable and the VP DCLK
reset during CRTC enable to leave the hardware in a clean state.

> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index b85cd94d1e9d9..98430587a7abe 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

[ ... ]

> @@ -2585,6 +2610,12 @@ static int vop2_create_crtcs(struct vop2 *vop2)
>  			return dev_err_probe(drm->dev, PTR_ERR(vp->dclk),
>  					     "failed to get %s\n", dclk_name);
>  
> +		vp->dclk_rst = devm_reset_control_get_optional_exclusive(vop2->dev,
> +									 dclk_name);
> +		if (IS_ERR(vp->dclk_rst))
> +			return dev_err_probe(drm->dev, PTR_ERR(vp->dclk_rst),
> +					     "failed to get %s reset\n", dclk_name);

[Severity: Medium]
Does returning directly here leak the port device_node references acquired in
earlier iterations of this loop?

In vop2_create_crtcs(), each iteration for a connected video port acquires a
port reference at the end of the loop body:

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:vop2_create_crtcs() {
	for (i = 0; i < vop2_data->nr_vps; i++) {
		...
		port = of_graph_get_port_by_id(dev->of_node, i);
		if (!port)
			return dev_err_probe(drm->dev, -ENOENT,
					     "no port node found for video_port%d\n", i);
		vp->crtc.port = port;
		nvps++;
	}
}

If devm_reset_control_get_optional_exclusive() fails on a subsequent iteration
(i > 0), vop2_create_crtcs() returns immediately to vop2_bind(), which also
returns the error without calling of_node_put() on vop2->vps[0 .. i - 1].crtc.port
(a pre-existing issue also shared with the other early returns in
vop2_create_crtcs()).

> @@ -2944,6 +2975,13 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
>  		return dev_err_probe(drm->dev, PTR_ERR(vop2->pll_hdmiphy1),
>  				     "failed to get pll_hdmiphy1\n");
>  
> +	vop2->axi_rst = devm_reset_control_get_optional_exclusive(vop2->dev, "axi");
> +	if (IS_ERR(vop2->axi_rst))
> +		return dev_err_probe(drm->dev, PTR_ERR(vop2->axi_rst),
> +				     "failed to get axi reset\n");
> +
> +	vop2_reset_assert_deassert(vop2, vop2->axi_rst);

[Severity: Medium]
As reported by Sashiko on v5 [1], can pulsing vop2->axi_rst here in
vop2_bind() take effect if the VOP2 power domain is powered down or
vop2->aclk is gated?

In vop2_bind(), vop2_reset_assert_deassert() is called before
pm_runtime_enable(&pdev->dev) and without resuming runtime PM or enabling
vop2->aclk. After vop2_probe() completes, genpd_dev_pm_sync() schedules
power-off for the RK3588_PD_VOP domain (which uses GENPD_FLAG_PM_CLK |
GENPD_FLAG_NO_STAY_ON), and the core clocks are only prepared and enabled
later in vop2_enable():

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:vop2_enable() {
	ret = pm_runtime_resume_and_get(vop2->dev);
	if (ret < 0) {
		drm_err(vop2->drm, "failed to get pm runtime: %d\n", ret);
		return ret;
	}

	ret = vop2_core_clks_prepare_enable(vop2);
	if (ret)
		goto err_put_pm;
}

By contrast, vop2_disable() pulses vop2->axi_rst while runtime PM and the core
clocks are still active, and vop_initial() in rockchip_drm_vop.c resumes
runtime PM and enables hclk and aclk before pulsing resets. Should this reset
be performed while the power domain and aclk are enabled?

[1] https://lore.kernel.org/r/20261014-dw-hdmi-qp-yuv-v5-7-6fab0fe43a9b@collabora.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-dw-hdmi-qp-yuv-v6-0-1bb63ef5766e@collabora.com?part=7

  reply	other threads:[~2026-11-05  1:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  1:00 [PATCH v6 00/15] Support 10-bit YUV422 and 8/10-bit YUV420 color format on DW HDMI QP Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 01/15] dt-bindings: display: vop2: Add missing reset properties Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 02/15] drm/rockchip: vop2: Fix resource leak on vop2_enable() error path Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 03/15] drm/rockchip: vop2: Disable core clocks before dropping runtime PM reference Cristian Ciocaltea
2026-11-05 11:43   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 04/15] drm/rockchip: vop2: Balance state on atomic_enable() error paths Cristian Ciocaltea
2026-11-05  1:20   ` sashiko-bot
2026-11-05 12:24   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 05/15] drm/rockchip: vop2: Avoid division by zero when computing max_dclk Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 06/15] drm/rockchip: vop2: Fix VOP2_MAX_DCLK_RATE overflow on 32-bit Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 07/15] drm/rockchip: vop2: Reset AXI and DCLK to improve robustness Cristian Ciocaltea
2026-11-05  1:20   ` sashiko-bot [this message]
2026-11-05  1:00 ` [PATCH v6 08/15] drm/rockchip: vop2: Consolidate HDMI PHY PLL clock parent switch Cristian Ciocaltea
2026-11-05 12:18   ` Daniel Stone
2026-11-05 12:56     ` Cristian Ciocaltea
2026-11-05 14:33       ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 09/15] drm/rockchip: vop2: Use TMDS character rate to select DCLK source Cristian Ciocaltea
2026-11-05 14:35   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 10/15] drm/rockchip: vop2: Switch to enum vop_csc_format Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 11/15] drm/bridge: dw-hdmi-qp: Log resolution and refresh rate in atomic_enable() Cristian Ciocaltea
2026-11-05  1:00 ` [PATCH v6 12/15] drm/rockchip: dw_hdmi_qp: Do not mask error code in atomic_check() Cristian Ciocaltea
2026-11-05 11:55   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 13/15] drm/rockchip: dw_hdmi_qp: Support 10-bit YUV422 output format Cristian Ciocaltea
2026-11-05 12:08   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 14/15] drm/rockchip: dw_hdmi_qp: Enable YUV420 " Cristian Ciocaltea
2026-11-05 12:09   ` Daniel Stone
2026-11-05  1:00 ` [PATCH v6 15/15] arm64: dts: rockchip: Add RK3588 VOP2 resets Cristian Ciocaltea
2026-11-05 12:25 ` [PATCH v6 00/15] Support 10-bit YUV422 and 8/10-bit YUV420 color format on DW HDMI QP Daniel Stone
2026-11-05 13:04   ` Cristian Ciocaltea
2026-11-05 13:22     ` Heiko Stübner
2026-11-05 14:36       ` Daniel Stone
2026-11-05 14:35     ` Daniel Stone

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-198401@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --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