From: sashiko-bot@kernel.org
To: "Damon Ding" <damon.ding@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 17/20] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection
Date: Wed, 25 Nov 2026 11:41:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-233271@kernel.org> (raw)
In-Reply-To: <20261125112141.1434903-18-damon.ding@rock-chips.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/bridge: analogix_dp: premature IRQ enable in
analogix_dp_resume()
- [Medium] drm/bridge: analogix_dp: deadlock between
analogix_dp_suspend() and IRQ
--
commit 2148ea987a79afc2769bfb9bcea363df9810b9e9
Author: Damon Ding <damon.ding@rock-chips.com>
drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection
This commit holds a runtime PM reference across bind and unbind on RK3576
and RK3588 for native hotplug detection, and gates the hotplug IRQ on
hotplug support and runtime PM transitions.
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 46433ea73d678..cda6e4c5cbc8d 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -42,6 +42,33 @@
>
> static const bool verify_fast_training;
>
> +/*
> + * The hotplug events are reported either through the optional GPIO HPD
> + * pin or through the native controller interrupt, which is confirmed
> + * to work only on the RK3576 and RK3588 platforms.
> + */
> +static bool analogix_dp_supports_hpd(struct analogix_dp_device *dp)
> +{
> + if (dp->force_connected_mode || dp->force_hpd)
> + return false;
> +
> + if (dp->hpd_gpiod)
> + return true;
> +
> + return dp->plat_data->dev_type == RK3576_EDP || dp->plat_data->dev_type == RK3588_EDP;
> +}
> +
> +/*
> + * The native HPD interrupt relies on the controller staying powered
> + * and clocked to report the hotplug events, so a runtime PM reference
> + * is held for it. The GPIO HPD mode needs no such reference, as it
> + * reads the GPIO level directly.
> + */
> +static bool analogix_dp_require_pm_for_hpd_irq(struct analogix_dp_device *dp)
> +{
> + return analogix_dp_supports_hpd(dp) && !dp->hpd_gpiod;
> +}
> +
> static void analogix_dp_init_dp(struct analogix_dp_device *dp)
> {
> analogix_dp_reset(dp);
> @@ -1547,6 +1574,11 @@ EXPORT_SYMBOL_GPL(analogix_dp_probe);
>
> int analogix_dp_suspend(struct analogix_dp_device *dp)
> {
> + if (analogix_dp_require_pm_for_hpd_irq(dp) && dp->hpd_irq_enabled) {
> + disable_irq(dp->irq);
> + dp->hpd_irq_enabled = false;
> + }
> +
[Severity: Medium]
Can calling disable_irq(dp->irq) inside the runtime_suspend callback cause an
ABBA deadlock with analogix_dp_irq_thread()?
If dp->dev is runtime-resumed while no persistent runtime PM reference is
held (for example, during pre-bind AUX transfers in
analogix_dp_finish_probe(), or after analogix_dp_unbind()),
analogix_dp_resume() enables dp->irq. When the autosuspend timer later fires
and an HPD interrupt arrives at the same time:
CPU0 (pm_wq) CPU1 (irq/analogix-dp)
------------ ----------------------
rpm_suspend(dp->dev)
runtime_status = RPM_SUSPENDING
...
analogix_dp_suspend(dp)
analogix_dp_irq_thread()
pm_runtime_resume_and_get(dp->dev)
rpm_resume(dp->dev, RPM_GET_PUT)
/* waits for RPM_SUSPENDING */
disable_irq(dp->irq)
synchronize_irq(dp->irq)
/* waits for IRQ thread */
*** DEADLOCK ***
> phy_power_off(dp->phy);
>
> if (dp->plat_data->power_off)
> @@ -1576,6 +1608,11 @@ int analogix_dp_resume(struct analogix_dp_device *dp)
>
> analogix_dp_init_dp(dp);
>
> + if (analogix_dp_require_pm_for_hpd_irq(dp) && !dp->hpd_irq_enabled) {
> + enable_irq(dp->irq);
> + dp->hpd_irq_enabled = true;
> + }
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(analogix_dp_resume);
[Severity: High]
Does enabling dp->irq in analogix_dp_resume() leave the HPD IRQ permanently
enabled across runtime suspend on RK3576 and RK3588 boards with an eDP panel
on the DP AUX bus?
dp->force_connected_mode is not initialized in analogix_dp_probe(); it is set
later during analogix_dp_bind() -> drm_bridge_attach() ->
analogix_dp_bridge_attach():
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:analogix_dp_bridge_attach() {
...
if (dp->bridge.next_bridge) {
...
dp->force_connected_mode = analogix_dp_bridge_force_connected(dp);
}
}
Before analogix_dp_bind() runs, analogix_dp_finish_probe() populates the DP
AUX bus. Probing the panel child runtime-resumes dp->dev while
dp->force_connected_mode is still false, so
analogix_dp_require_pm_for_hpd_irq(dp) returns true and analogix_dp_resume()
enables dp->irq.
Once analogix_dp_bridge_attach() sets dp->force_connected_mode = true,
analogix_dp_require_pm_for_hpd_irq(dp) becomes false. When the 100 ms
autosuspend delay expires, analogix_dp_suspend() skips disable_irq(dp->irq)
and leaves dp->irq enabled while the PHY, power and clock are turned off.
In addition, because analogix_dp_resume() does not check whether the bridge
is bound, any runtime resume during or after analogix_dp_unbind() (such as
during drm_dp_aux_unregister(&dp->aux)) re-enables dp->irq while unbound,
allowing analogix_dp_irq_thread() to use a stale dp->drm_dev.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125112141.1434903-1-damon.ding@rock-chips.com?part=17
next prev parent reply other threads:[~2026-11-25 11:41 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:21 [PATCH v7 00/20] Add HPD support for Rockchip Analogix DP Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 01/20] drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 02/20] drm/bridge: analogix_dp: Drop the redundant pm_runtime_mark_last_busy() calls Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 03/20] drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data field Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 04/20] drm/bridge: analogix_dp: Restrict forced connected status to panel endpoints Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 05/20] drm/bridge: analogix_dp: Take a runtime PM reference in bridge detect Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 06/20] drm/bridge: analogix_dp: Return bitmask from analogix_dp_get_irq_type() Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 07/20] drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 08/20] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:31 ` sashiko-bot
2026-11-25 11:21 ` [PATCH v7 09/20] drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ bitmask Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 10/20] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 11/20] drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt() Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 12/20] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 13/20] drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 14/20] drm/rockchip: analogix_dp: Unbind bridge when connector init fails Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 15/20] drm/exynos: exynos_dp: " Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 16/20] drm/bridge: analogix_dp: Move IRQ enable/disable to bind/unbind Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 17/20] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:41 ` sashiko-bot [this message]
2026-11-26 3:58 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 18/20] drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug reporting Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 19/20] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-11-25 11:21 ` Damon Ding
2026-11-25 11:48 ` sashiko-bot
2026-11-26 8:06 ` Damon Ding
2026-11-25 11:21 ` [PATCH v7 20/20] MAINTAINERS: Add entry for Analogix DP controller bridge Damon Ding
2026-11-25 11:21 ` Damon Ding
-- strict thread matches above, loose matches on Subject: below --
2026-11-27 18:24 [PATCH v7 12/20] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme kernel test robot
2026-11-30 5:47 ` Dan Carpenter
2026-11-30 5:47 ` Dan Carpenter
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-233271@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon.ding@rock-chips.com \
--cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.