From patchwork Tue Aug 20 11:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: drm/xe/display: Handle HPD polling on runtime suspend From: Vinod Govindapillai X-Patchwork-Id: 609517 Message-Id: <20240820110617.95587-1-vinod.govindapillai@intel.com> To: intel-gfx-trybot@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, imre.deak@intel.com Date: Tue, 20 Aug 2024 14:06:17 +0300 Have a separate function to handle the HPD polling on runtime suspend Signed-off-by: Vinod Govindapillai --- drivers/gpu/drm/xe/display/xe_display.c | 21 +++++++++++++++++++++ drivers/gpu/drm/xe/display/xe_display.h | 4 ++++ drivers/gpu/drm/xe/xe_pm.c | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c index 982b9c5b440f..63f19e4c75b7 100644 --- a/drivers/gpu/drm/xe/display/xe_display.c +++ b/drivers/gpu/drm/xe/display/xe_display.c @@ -287,6 +287,18 @@ static bool suspend_to_idle(void) return false; } +void xe_display_pm_runtime_suspend(struct xe_device *xe) +{ + if (!has_display(xe)) + return; + + /* Avoid d3hot? */ + if (xe->d3cold.capable && !xe->d3cold.allowed) + return; + + intel_hpd_poll_enable(xe); +} + void xe_display_pm_suspend(struct xe_device *xe, bool runtime) { struct intel_display *display = &xe->display; @@ -339,6 +351,15 @@ void xe_display_pm_resume_early(struct xe_device *xe) intel_power_domains_resume(xe); } +void xe_display_pm_runtime_resume(struct xe_device *xe) +{ + if (!has_display(xe)) + return; + + intel_hpd_init(xe); + intel_hpd_poll_disable(xe); +} + void xe_display_pm_resume(struct xe_device *xe, bool runtime) { struct intel_display *display = &xe->display; diff --git a/drivers/gpu/drm/xe/display/xe_display.h b/drivers/gpu/drm/xe/display/xe_display.h index 000fb5799df5..06037f4b2b5e 100644 --- a/drivers/gpu/drm/xe/display/xe_display.h +++ b/drivers/gpu/drm/xe/display/xe_display.h @@ -36,8 +36,10 @@ void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt); void xe_display_pm_suspend(struct xe_device *xe, bool runtime); void xe_display_pm_suspend_late(struct xe_device *xe); +void xe_display_pm_runtime_suspend(struct xe_device *xe); void xe_display_pm_resume_early(struct xe_device *xe); void xe_display_pm_resume(struct xe_device *xe, bool runtime); +void xe_display_pm_runtime_resume(struct xe_device *xe); #else @@ -65,8 +67,10 @@ static inline void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt static inline void xe_display_pm_suspend(struct xe_device *xe, bool runtime) {} static inline void xe_display_pm_suspend_late(struct xe_device *xe) {} +void xe_display_pm_suspend(struct xe_device *xe, bool runtime) {} static inline void xe_display_pm_resume_early(struct xe_device *xe) {} static inline void xe_display_pm_resume(struct xe_device *xe, bool runtime) {} +void xe_display_pm_runtime_resume(struct xe_device *xe) {} #endif /* CONFIG_DRM_XE_DISPLAY */ #endif /* _XE_DISPLAY_H_ */ diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 9f3c14fd9f33..29d3425bf893 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -383,6 +383,8 @@ int xe_pm_runtime_suspend(struct xe_device *xe) if (xe->d3cold.allowed) xe_display_pm_suspend_late(xe); + + xe_display_pm_runtime_suspend(xe); out: if (err) xe_display_pm_resume(xe, true); @@ -436,6 +438,8 @@ int xe_pm_runtime_resume(struct xe_device *xe) if (err) goto out; } + + xe_display_pm_runtime_resume(xe); out: lock_map_release(&xe_pm_runtime_lockdep_map); xe_pm_write_callback_task(xe, NULL);