From ee40bbe630856820beb6070cae8a51e5f4083689 Mon Sep 17 00:00:00 2001 From: Zhang Yubing Date: Mon, 18 Nov 2024 11:38:57 +0800 Subject: [PATCH] drm/rockchip: dw-dp: update gpio hpd state when init stage The gpio hpd state will be mismatch the real state if the cable plug before init the dp controller. So it need updage the gpio hpd state when dp controller init. Fixes: 601aff23373b ("drm/rockchip: dw-dp: optimize the logic to deal with hpd") Change-Id: I6b7a3d88e2ef70e54ad9465859c1a55205f10c4f Signed-off-by: Zhang Yubing --- drivers/gpu/drm/rockchip/dw-dp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-dp.c b/drivers/gpu/drm/rockchip/dw-dp.c index a7400bf99953..ea9e6335b2d0 100644 --- a/drivers/gpu/drm/rockchip/dw-dp.c +++ b/drivers/gpu/drm/rockchip/dw-dp.c @@ -2843,7 +2843,6 @@ static irqreturn_t dw_dp_hpd_irq_handler(int irq, void *arg) dp->hotplug.long_hpd = true; dp->hotplug.status = hpd; dp->hotplug.state = GPIO_STATE_PLUG; - schedule_work(&dp->hpd_work); } } else if (dp->hotplug.state == GPIO_STATE_PLUG) { if (!hpd) { @@ -2858,9 +2857,12 @@ static irqreturn_t dw_dp_hpd_irq_handler(int irq, void *arg) dp->hotplug.long_hpd = false; dp->hotplug.status = hpd; dp->hotplug.state = GPIO_STATE_PLUG; - schedule_work(&dp->hpd_work); } } + + if (hpd) + schedule_work(&dp->hpd_work); + mutex_unlock(&dp->irq_lock); @@ -2870,6 +2872,10 @@ static irqreturn_t dw_dp_hpd_irq_handler(int irq, void *arg) static void dw_dp_hpd_init(struct dw_dp *dp) { dp->hotplug.status = dw_dp_detect_no_power(dp); + if (dp->hpd_gpio && dp->hotplug.status) { + dp->hotplug.state = GPIO_STATE_PLUG; + dp->hotplug.long_hpd = true; + } if (dp->hpd_gpio || dp->force_hpd || dp->usbdp_hpd) { regmap_update_bits(dp->regmap, DPTX_CCTL, FORCE_HPD,