[PATCH v1 6/7] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme
Damon Ding
damon.ding at rock-chips.com
Wed Jul 29 20:27:43 PDT 2026
Hotplug detection can be implemented either via HOTPLUG_CHG interrupt,
or the combination of PLUG and HPD_LOST interrupts.
For Rockchip platforms, configure HPD deglitch to 2ms and rely on
HOTPLUG_CHG interrupt for hotplug events, which is verified as the
optimal solution through engineering tests. Other platforms continue
using PLUG + HPD_LOST pair.
Adjust analogix_dp_config_interrupt() to apply platform-specific
interrupt masking and deglitch settings. Update threaded irq handler
to check corresponding interrupt flags according to platform type.
Signed-off-by: Damon Ding <damon.ding at rock-chips.com>
---
.../gpu/drm/bridge/analogix/analogix_dp_core.c | 9 +++++++--
.../gpu/drm/bridge/analogix/analogix_dp_reg.c | 16 +++++++++++++++-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 5af4150f0e7e..a292bc881b6b 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -719,10 +719,15 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg)
{
struct analogix_dp_device *dp = arg;
u32 irq_type;
+ bool hpd_detected;
irq_type = analogix_dp_get_irq_type(dp);
- if (irq_type & DP_IRQ_TYPE_HP_CABLE_IN ||
- irq_type & DP_IRQ_TYPE_HP_CABLE_OUT) {
+ if (!dp->hpd_gpiod && analogix_dp_is_rockchip(dp->plat_data->dev_type))
+ hpd_detected = irq_type & DP_IRQ_TYPE_HP_CHANGE;
+ else
+ hpd_detected = (irq_type & DP_IRQ_TYPE_HP_CABLE_IN) ||
+ (irq_type & DP_IRQ_TYPE_HP_CABLE_OUT);
+ if (hpd_detected) {
dev_dbg(dp->dev, "Detected cable status changed!\n");
if (dp->drm_dev)
drm_helper_hpd_irq_event(dp->drm_dev);
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index 42463e18f392..981ce3810e90 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -177,7 +177,21 @@ void analogix_dp_config_interrupt(struct analogix_dp_device *dp)
writel(0, dp->reg_base + ANALOGIX_DP_COMMON_INT_MASK_2);
writel(0, dp->reg_base + ANALOGIX_DP_COMMON_INT_MASK_3);
- analogix_dp_unmute_hpd_interrupt(dp, HPD_IRQ);
+ if (analogix_dp_is_rockchip(dp->plat_data->dev_type)) {
+ /*
+ * Either HOTPLUG_CHG interrupt or PLUG + HPD_LOST interrupt
+ * pair can be used to implement hotplug detection.
+ *
+ * On Rockchip platforms, configuring HPD deglitch to 2ms and
+ * using HOTPLUG_CHG interrupt for hotplug detection is proven
+ * as a better solution via engineering verification.
+ */
+ writel(0x80, dp->reg_base + ANALOGIX_DP_HPD_DEGLITCH_L);
+ writel(0xbb, dp->reg_base + ANALOGIX_DP_HPD_DEGLITCH_H);
+ analogix_dp_unmute_hpd_interrupt(dp, DP_IRQ_TYPE_HP_CHANGE);
+ } else {
+ analogix_dp_unmute_hpd_interrupt(dp, HPD_IRQ);
+ }
}
void analogix_dp_mute_hpd_interrupt(struct analogix_dp_device *dp, u32 irq_type)
--
2.34.1
More information about the Linux-rockchip
mailing list