GPIO HPD does not rely on DP controller internal native HPD interrupts. Skip native HPD register manipulations to avoid irrelevant operations.
Configure interrupt routine mutes native HPD interrupts when dp->hpd_gpiod exists. Add identical condition guards in hardirq and threaded irq handlers. Drop redundant dp->hpd_gpiod condition inside analogix_dp_clear_hotplug_interrupts(). Signed-off-by: Damon Ding <[email protected]> --- .../drm/bridge/analogix/analogix_dp_core.c | 5 +-- .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 32 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index a292bc881b6b..91fa7569950a 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -708,7 +708,8 @@ static irqreturn_t analogix_dp_hardirq(int irq, void *arg) irq_type = analogix_dp_get_irq_type(dp); if (irq_type) { - analogix_dp_mute_hpd_interrupt(dp, irq_type); + if (!dp->hpd_gpiod) + analogix_dp_mute_hpd_interrupt(dp, irq_type); ret = IRQ_WAKE_THREAD; } @@ -733,7 +734,7 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) drm_helper_hpd_irq_event(dp->drm_dev); } - if (irq_type) { + if (!dp->hpd_gpiod && irq_type) { analogix_dp_clear_hotplug_interrupts(dp, irq_type); analogix_dp_unmute_hpd_interrupt(dp, irq_type); } diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 981ce3810e90..cf1f9216c742 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -177,20 +177,24 @@ 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); - 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); + if (dp->hpd_gpiod) { + analogix_dp_mute_hpd_interrupt(dp, HPD_IRQ); } else { - 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); + } } } @@ -411,7 +415,7 @@ void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp, u32 irq { u32 reg = 0; - if (dp->hpd_gpiod || !irq_type) + if (!irq_type) return; if (irq_type & COMMON_INT_4_HPD_IRQ) { -- 2.34.1
