Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 14/21] drm/bridge: synopsys: dw-dp: Add Runtime PM support
Date: Thu, 06 Aug 2026 01:07:23 +0000	[thread overview]
Message-ID: <20260806010724.733A41F00ACF@smtp.kernel.org> (raw)
In-Reply-To: <20260806-synopsys-dw-dp-improvements-v10-14-d84a26c303d6@collabora.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Using asynchronous pm_runtime_put_autosuspend() during teardown paths leaves hardware in an active power state.
- [High] Calling sleeping functions from within the bridge atomic enable and disable callbacks violates atomic context restrictions.
- [Medium] Calling `phy_init()` while the APB and AUX clocks are disabled may cause hardware faults.
--

--- Patch [14]: [PATCH v10 14/21] drm/bridge: synopsys: dw-dp: Add Runtime PM support ---
commit c4724f477a725eaa23bb5ef5b62b3fe8b8f02e8a
Author: Sebastian Reichel <sebastian.reichel@collabora.com>

drm/bridge: synopsys: dw-dp: Add Runtime PM support
    
Add runtime PM stubs to the Synopsys DesignWare DisplayPort bridge
driver. Support is not enabled automatically and must be hooked up
in the platform specific glue code.

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> index 847c2aa95e27c..545dddce69e7b 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
[ ... ]
> @@ -1681,6 +1689,13 @@ static void dw_dp_bridge_atomic_enable(struct drm_bridge *bridge,
>  	struct drm_connector_state *conn_state;
>  	int ret;
>  
> +	ret = pm_runtime_get_active(dp->dev, RPM_TRANSPARENT);
> +	if (ret) {
> +		dev_err(dp->dev, "runtime PM failure\n");
> +		return;
> +	}
> +	dp->pm_active = true;
> +

[Severity: High]
Does this introduce a sleeping function into an atomic context?

During a non-blocking atomic commit, the DRM core invokes
dw_dp_bridge_atomic_enable(). This callback executes in an atomic context
where sleeping is forbidden. However, pm_runtime_get_active()
synchronously resumes the device, invoking dw_dp_runtime_resume(), which
subsequently calls msleep(110).

This isn't a bug introduced by this patch, but there are pre-existing
sleeping operations in these paths, including a mutex lock
(scoped_guard(mutex, &dp->audio_lock)) and usleep_range() inside
dw_dp_reset(), which may also need attention to avoid kernel warnings.

[ ... ]
> @@ -1940,6 +1972,9 @@ static int dw_dp_bridge_attach(struct drm_bridge *bridge,
>  err_disable_irq:
>  	disable_irq(dp->irq);
>  	cancel_work_sync(&dp->hpd_work);
> +
> +	pm_runtime_put_autosuspend(dp->dev);
> +
>  	return ret;
>  }

[Severity: High]
Will this async put leave the hardware in an active power state?

This async put is used in the attach error cleanup path, which will also be
immediately followed by driver unbind and PM disable. The delayed suspend
is scheduled right before the device is unregistered. 

Because device removal immediately follows, the devres cleanup executes
pm_runtime_disable(), which cancels the pending async suspend work. This
aborts the power-down sequence and leaves the apb_clk and aux_clk enabled.
Should pm_runtime_put_sync() be used here instead?

[ ... ]
> @@ -1951,6 +1986,8 @@ static void dw_dp_bridge_detach(struct drm_bridge *bridge)
>  	drm_dp_aux_unregister(&dp->aux);
>  	disable_irq(dp->irq);
>  	cancel_work_sync(&dp->hpd_work);
> +	if (!dp->usbc_mode)
> +		pm_runtime_put_autosuspend(dp->dev);
>  }

[Severity: High]
Similar to the error path in dw_dp_bridge_attach(), does this need to be a
synchronous put? pm_runtime_put_sync() ensures the idle/suspend completes
before the subsequent device deletion.

[ ... ]
> @@ -2209,31 +2283,57 @@ struct dw_dp *dw_dp_probe(struct platform_device *pdev, const struct dw_dp_plat_
[ ... ]
> +	if (dp->plat_data.autosuspend_delay > 0) {
> +		pm_runtime_use_autosuspend(dev);
> +		pm_runtime_set_autosuspend_delay(dev, dp->plat_data.autosuspend_delay);
> +		ret = devm_pm_runtime_enable(dev);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	if (!pm_runtime_enabled(dev)) {
> +		dw_dp_runtime_resume(dp);
> +
> +		ret = devm_add_action_or_reset(dev, dw_dp_manual_suspend, dp);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	ret = phy_init(dp->phy);
>  	if (ret) {
>  		dev_err_probe(dev, ret, "phy init failed\n");
> -		return ERR_PTR(ret);
> +		return ret;
>  	}

[Severity: Medium]
Can calling phy_init() while the APB and AUX clocks are disabled cause
hardware faults?

If PM runtime is active (which is the default if autosuspend_delay > 0),
the apb_clk and aux_clk remain disabled until the device is explicitly
resumed. However, phy_init() is still called unconditionally at the end of
probe. If the generic PHY driver accesses internal registers that rely on
the display controller's APB bus clock, the unclocked access might hang the
system.

[ ... ]
> +int dw_dp_runtime_resume(struct dw_dp *dp)
> +{
[ ... ]
> +	/*
> +	 * HPD_HOT_PLUG bit is asserted only after the sink holds HPD
> +	 * high for at least 100ms.
> +	 */
> +	msleep(110);
> +
> +	return 0;
> +}

[Severity: High]
As mentioned earlier, does this msleep(110) introduce a sleep into atomic
context when reached from dw_dp_bridge_atomic_enable() via
pm_runtime_get_active()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806-synopsys-dw-dp-improvements-v10-0-d84a26c303d6@collabora.com?part=14

  reply	other threads:[~2026-08-06  1:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  0:39 [PATCH v10 00/21] Synopsys DisplayPort Controller improvements for Rockchip platforms Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 01/21] drm/bridge: synopsys: dw-dp: Register DP AUX on bridge attach Sebastian Reichel
2026-08-06  1:02   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 02/21] drm/bridge: synopsys: dw-dp: Fix incorrect resource lifetimes in bind callback Sebastian Reichel
2026-08-06  1:05   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 03/21] drm/bridge: synopsys: dw-dp: Fix error handling for DP link enablement Sebastian Reichel
2026-08-06  0:59   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 04/21] drm/bridge: synopsys: dw-dp: Document missing reset line deassert Sebastian Reichel
2026-08-06  0:58   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 05/21] drm/bridge: synopsys: dw-dp: Add missing mutex cleanups on module removal Sebastian Reichel
2026-08-06  0:58   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 06/21] drm/bridge: synopsys: dw-dp: Fix AUX transfer timeout race condition Sebastian Reichel
2026-08-06  1:05   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 07/21] drm/bridge: synopsys: dw-dp: Fix support for short I2C reads Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 08/21] drm/bridge: synopsys: dw-dp: Free output_fmts when none are valid Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 09/21] drm/bridge: synopsys: dw-dp: Support MEDIA_BUS_FMT_FIXED Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 10/21] drm/bridge: synopsys: dw-dp: Add follow-up bridge support Sebastian Reichel
2026-08-06  1:01   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 11/21] drm/bridge: Add out-of-band HPD notify handler Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 12/21] drm/bridge: synopsys: dw-dp: Support software triggered OOB HPD Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 13/21] drm/rockchip: dw_dp: Implement out-of-band HPD handling Sebastian Reichel
2026-08-06  0:58   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 14/21] drm/bridge: synopsys: dw-dp: Add Runtime PM support Sebastian Reichel
2026-08-06  1:07   ` sashiko-bot [this message]
2026-08-06  0:39 ` [PATCH v10 15/21] drm/rockchip: dw_dp: Add runtime " Sebastian Reichel
2026-08-06  1:06   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 16/21] drm/bridge: synopsys: dw-dp: Protect sdp_reg_bank from concurrent access Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 17/21] drm/bridge: synopsys: dw-dp: Drop useless reservation of first slot Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 18/21] drm/bridge: synopsys: dw-dp: Clear only enabled SDPs on atomic disable Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 19/21] drm/bridge: synopsys: dw-dp: Use regmap_set_bits in dw_dp_send_sdp Sebastian Reichel
2026-08-06  0:39 ` [PATCH v10 20/21] dt-bindings: display: rockchip: dw-dp: Fix sound DAI cells Sebastian Reichel
2026-08-06  1:06   ` sashiko-bot
2026-08-06  0:39 ` [PATCH v10 21/21] drm/bridge: synopsys: dw-dp: Add audio support Sebastian Reichel
2026-08-06  1:10   ` sashiko-bot

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=20260806010724.733A41F00ACF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --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 \
    --cc=sebastian.reichel@collabora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox