On Rockchip platforms, the Analogix DP native HPD pin IRQ requires the DP controller to remain powered and clocked to generate plug/unplug interrupts. Without a runtime PM reference, the controller suspends when the display pipeline is inactive, disabling HPD detection.
Acquire a runtime PM reference in analogix_dp_bind() and release it in analogix_dp_unbind() for native HPD pin mode. This keeps the controller alive throughout the device lifecycle for continuous hotplug detection. Persistent power is only necessary for native HPD pin mode. It is not required for force-HPD or GPIO HPD modes, where hotplug detection does not depend on the DP controller's internal interrupt logic. Add helper analogix_dp_require_pm_for_hpd_irq() to identify Rockchip native HPD pin configurations (non-GPIO, non-force-HPD). Signed-off-by: Damon Ding <[email protected]> --- Changes in v2: - Split IRQ enable/disable logic, handle native HPD pin and GPIO/force-HPD modes separately to avoid unbalanced enable_irq() calls.(Sashiko) Changes in v3: - Modify the commit msg according to the previous commit for moving IRQ enabling/disabling. --- .../gpu/drm/bridge/analogix/analogix_dp_core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index addd319719de..38857508d939 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -39,6 +39,12 @@ static const bool verify_fast_training; +static bool analogix_dp_require_pm_for_hpd_irq(struct analogix_dp_device *dp) +{ + return analogix_dp_is_rockchip(dp->plat_data->dev_type) && !dp->hpd_gpiod && + !dp->force_hpd; +} + static void analogix_dp_init_dp(struct analogix_dp_device *dp) { analogix_dp_reset(dp); @@ -1571,6 +1577,12 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) goto err_unregister_aux; } + if (analogix_dp_require_pm_for_hpd_irq(dp)) { + ret = pm_runtime_resume_and_get(dp->dev); + if (ret) + goto err_unregister_aux; + } + enable_irq(dp->irq); return 0; @@ -1585,6 +1597,10 @@ EXPORT_SYMBOL_GPL(analogix_dp_bind); void analogix_dp_unbind(struct analogix_dp_device *dp) { disable_irq(dp->irq); + + if (analogix_dp_require_pm_for_hpd_irq(dp)) + pm_runtime_put_sync(dp->dev); + drm_dp_aux_unregister(&dp->aux); } EXPORT_SYMBOL_GPL(analogix_dp_unbind); -- 2.34.1
