mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 18/20] drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug reporting
Date: Wed, 25 Nov 2026 19:21:39 +0800	[thread overview]
Message-ID: <20261125112141.1434903-19-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20261125112141.1434903-1-damon.ding@rock-chips.com>

This commit declares DRM_BRIDGE_OP_HPD for the analogix_dp bridge,
adds the hpd_enable/hpd_disable bridge callbacks and reports the
hotplug events through drm_bridge_hpd_notify() with the status read
from the HPD GPIO pin or the controller registers.

The DRM_BRIDGE_OP_HPD capability is declared only for the platforms
which support hotplug detection (the GPIO HPD mode, or the native HPD
mode on RK3576 and RK3588), since the drm core stops polling the
connector once DRM_BRIDGE_OP_HPD is declared.

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>

---

Changes in v6:
- Declare DRM_BRIDGE_OP_HPD only for the platforms which support
  hotplug detection, since the drm core stops polling the connector
  once DRM_BRIDGE_OP_HPD is declared. (Sashiko)
- Add Tested-by tag.

Changes in v7:
- Set the bridge ops after the chain is attached, as the
  DRM_BRIDGE_OP_HPD declaration previously preceded the
  force_connected_mode initialization, leaving the hotplug detection
  broken on fixed panels with a wired HPD GPIO. (Sashiko)
- Drop the Tested-by tags, as the design of this patch changed
  significantly in this version.
---
 .../drm/bridge/analogix/analogix_dp_core.c    | 24 +++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index cda6e4c5cbc8..7ab183f72eb6 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -31,7 +31,6 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/drm_print.h>
-#include <drm/drm_probe_helper.h>
 
 #include <video/of_display_timing.h>
 
@@ -757,9 +756,13 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg)
 		hpd_detected = (irq_type & DP_IRQ_TYPE_HP_CABLE_IN) ||
 			       (irq_type & DP_IRQ_TYPE_HP_CABLE_OUT);
 	if (hpd_detected) {
+		enum drm_connector_status status;
+
 		dev_dbg(dp->dev, "Detected cable status changed!\n");
-		if (dp->drm_dev)
-			drm_helper_hpd_irq_event(dp->drm_dev);
+
+		status = analogix_dp_get_plug_in_status(dp) == 0 ? connector_status_connected :
+								   connector_status_disconnected;
+		drm_bridge_hpd_notify(&dp->bridge, status);
 	}
 
 	if (!dp->hpd_gpiod)
@@ -1293,6 +1296,14 @@ static void analogix_dp_bridge_atomic_post_disable(struct drm_bridge *bridge,
 		DRM_ERROR("Failed to enable psr (%d)\n", ret);
 }
 
+static void analogix_dp_bridge_hpd_enable(struct drm_bridge *bridge)
+{
+}
+
+static void analogix_dp_bridge_hpd_disable(struct drm_bridge *bridge)
+{
+}
+
 static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
 	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
@@ -1305,6 +1316,8 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
 	.attach = analogix_dp_bridge_attach,
 	.edid_read = analogix_dp_bridge_edid_read,
 	.detect = analogix_dp_bridge_detect,
+	.hpd_enable = analogix_dp_bridge_hpd_enable,
+	.hpd_disable = analogix_dp_bridge_hpd_disable,
 };
 
 static int analogix_dp_dt_parse_lanes_map(struct analogix_dp_device *dp)
@@ -1633,7 +1646,6 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
 		return ret;
 	}
 
-	bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
 	bridge->of_node = dp->dev->of_node;
 	bridge->type = DRM_MODE_CONNECTOR_eDP;
 	ret = devm_drm_bridge_add(dp->dev, &dp->bridge);
@@ -1646,6 +1658,10 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
 		goto err_unregister_aux;
 	}
 
+	bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
+	if (analogix_dp_supports_hpd(dp))
+		bridge->ops |= DRM_BRIDGE_OP_HPD;
+
 	if (analogix_dp_require_pm_for_hpd_irq(dp)) {
 		ret = pm_runtime_resume_and_get(dp->dev);
 		if (ret)
-- 
2.34.1


  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 ` [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 [this message]
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-19-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®