From: Damon Ding <damon.ding@rock-chips.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Jingoo Han <jingoohan1@gmail.com>,
Inki Dae <inki.dae@samsung.com>,
Seung-Woo Kim <sw0312.kim@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Peter Griffin <peter.griffin@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Heiko Stuebner <heiko@sntech.de>,
Sandy Huang <hjc@rock-chips.com>, Andy Yan <andyshrk@163.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
linux-rockchip@lists.infradead.org,
Damon Ding <damon.ding@rock-chips.com>
Subject: [PATCH v7 17/20] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection
Date: Wed, 25 Nov 2026 19:21:38 +0800 [thread overview]
Message-ID: <20261125112141.1434903-18-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20261125112141.1434903-1-damon.ding@rock-chips.com>
This commit holds the runtime PM reference across the bind/unbind
lifecycle on the RK3576 and RK3588 platforms, which rely on the native
controller interrupt for hotplug detection. The hotplug IRQ is enabled
only for the platforms which support hotplug detection, i.e., the GPIO
HPD mode or the native HPD mode on RK3576 and RK3588, so that the IRQ
thread is not run on the platforms without hotplug support.
The force-connected and force-HPD modes are excluded from the hotplug
detection support, since the HPD events shall not be reported for the
fixed panels.
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
Changes in v2:
- Split IRQ enable/disable logic, handle native HPD pin and
GPIO/force-HPD modes separately to avoid unbalanced enable_irq()
calls. (Sashiko)
Changes in v3:
- Modify the commit msg according to the previous commit for moving IRQ
enabling/disabling.
Changes in v4:
- Add Tested-by tag.
Changes in v5:
- Limit the runtime PM holding to the RK3576/RK3588 platforms, which
are the only ones confirmed to support the DP mode hotplug
detection, and exclude the boards with a fixed panel, so that the
runtime suspend still works when the screen is blanked. (Sashiko)
- Add a new commit declaring DRM_BRIDGE_OP_HPD on the Analogix DP
bridge and reporting the hotplug events via drm_bridge_hpd_notify().
(Sashiko)
Changes in v6:
- Enable the hotplug IRQ only for the platforms which support hotplug
detection (the GPIO HPD mode, or the native HPD mode on RK3576 and
RK3588). (Sashiko)
- Exclude the force-connected and force-HPD modes from the hotplug
detection support check. (Sashiko)
- Simplify the commit msg.
- Add Tested-by tag.
Changes in v7:
- Derive analogix_dp_require_pm_for_hpd_irq() from
analogix_dp_supports_hpd().
- Track the hotplug IRQ enable state for an idempotent enable/disable,
and gate the IRQ around the runtime PM transitions only for the
platforms which hold the runtime PM reference. (Sashiko)
- Drop the Tested-by tags, as the design of this patch changed
significantly in this version.
---
.../drm/bridge/analogix/analogix_dp_core.c | 57 ++++++++++++++++++-
.../drm/bridge/analogix/analogix_dp_core.h | 1 +
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 46433ea73d67..cda6e4c5cbc8 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;
+ }
+
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);
@@ -1609,7 +1646,16 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
goto err_unregister_aux;
}
- enable_irq(dp->irq);
+ if (analogix_dp_require_pm_for_hpd_irq(dp)) {
+ ret = pm_runtime_resume_and_get(dp->dev);
+ if (ret)
+ goto err_unregister_aux;
+ }
+
+ if (analogix_dp_supports_hpd(dp) && !dp->hpd_irq_enabled) {
+ enable_irq(dp->irq);
+ dp->hpd_irq_enabled = true;
+ }
return 0;
@@ -1622,7 +1668,14 @@ EXPORT_SYMBOL_GPL(analogix_dp_bind);
void analogix_dp_unbind(struct analogix_dp_device *dp)
{
- disable_irq(dp->irq);
+ if (dp->hpd_irq_enabled) {
+ disable_irq(dp->irq);
+ dp->hpd_irq_enabled = false;
+ }
+
+ if (analogix_dp_require_pm_for_hpd_irq(dp))
+ pm_runtime_put_sync(dp->dev);
+
drm_dp_aux_unregister(&dp->aux);
}
EXPORT_SYMBOL_GPL(analogix_dp_unbind);
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index 2ac92b2bac0a..17ebb96d66ca 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -171,6 +171,7 @@ struct analogix_dp_device {
bool fast_train_enable;
bool psr_supported;
bool force_connected_mode;
+ bool hpd_irq_enabled;
u8 dpcd[DP_RECEIVER_CAP_SIZE];
--
2.34.1
next prev parent reply other threads:[~2026-11-25 11:22 UTC|newest]
Thread overview: 21+ 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 ` [PATCH v7 01/20] drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE 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 ` [PATCH v7 03/20] drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data field 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 ` [PATCH v7 05/20] drm/bridge: analogix_dp: Take a runtime PM reference in bridge detect 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 ` [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 ` [PATCH v7 08/20] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Damon Ding
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 ` [PATCH v7 10/20] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask 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 ` [PATCH v7 12/20] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme 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 ` [PATCH v7 14/20] drm/rockchip: analogix_dp: Unbind bridge when connector init fails Damon Ding
2026-11-25 11:21 ` [PATCH v7 15/20] drm/exynos: exynos_dp: " 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 [this message]
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 ` [PATCH v7 19/20] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-11-25 11:21 ` [PATCH v7 20/20] MAINTAINERS: Add entry for Analogix DP controller bridge Damon Ding
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=20261125112141.1434903-18-damon.ding@rock-chips.com \
--to=damon.ding@rock-chips.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=andrzej.hajda@intel.com \
--cc=andyshrk@163.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=inki.dae@samsung.com \
--cc=jernej.skrabec@gmail.com \
--cc=jingoohan1@gmail.com \
--cc=jonas@kwiboo.se \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=peter.griffin@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=sw0312.kim@samsung.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®