GPIO HPD does not rely on DP controller internal native HPD interrupts.
Skip native HPD register manipulations to avoid irrelevant operations.

Move the hpd_gpiod guard to its caller so the helper operates purely on
the given bitmask, and mute all native HPD interrupts for GPIO mode.

Signed-off-by: Damon Ding <[email protected]>

---

Changes in v2:
- Adapt to the newly added IRQF_ONESHOT related commit and expand the
  commit msg.

Changes in v3:
- Reorganize the branch layout for hpd_gpiod check.
- Simplify the commit msg.
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  | 7 ++++++-
 2 files changed, 7 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 287fc16125ef..b92d28546192 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -717,7 +717,7 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void 
*arg)
        bool hpd_detected;
 
        irq_type = analogix_dp_get_irq_type(dp);
-       if (irq_type)
+       if (!dp->hpd_gpiod && irq_type)
                analogix_dp_clear_hotplug_interrupts(dp, irq_type);
 
        if (!dp->hpd_gpiod && analogix_dp_is_rockchip(dp->plat_data->dev_type))
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index 025da25463a8..af5e5a8ec88d 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -193,6 +193,11 @@ 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 (dp->hpd_gpiod) {
+               analogix_dp_mute_hpd_interrupt(dp, HPD_IRQ_ALL);
+               return;
+       }
+
        /*
         * Either HOTPLUG_CHG interrupt or PLUG + HPD_LOST interrupt
         * pair can be used to implement hotplug detection.
@@ -415,7 +420,7 @@ void analogix_dp_clear_hotplug_interrupts(struct 
analogix_dp_device *dp, u32 irq
 {
        u32 reg;
 
-       if (dp->hpd_gpiod || !irq_type)
+       if (!irq_type)
                return;
 
        reg = analogix_dp_irq_type_to_common_int_sta4(irq_type);
-- 
2.34.1

Reply via email to