From ec19b8ea1e7cb2e324f8a4ff331d1c04c89233f4 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 23 Jul 2021 16:17:52 +0200 Subject: [PATCH 520/552] drm/vc4: crtc: Make sure the HDMI controller is powered at boot If vc4_crtc_disable_at_boot runs, we call into the HDMI controller hooks to disable it but we never made sure it was running and the core clock was running either. This doesn't fix any known bugs, but it's still something we should make sure of. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 6bb52539a5a6..8817af8c88bf 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include "vc4_drv.h" +#include "vc4_hdmi.h" #include "vc4_regs.h" #define HVS_FIFO_LATENCY_PIX 6 @@ -501,8 +503,10 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) enum vc4_encoder_type encoder_type; const struct vc4_pv_data *pv_data; struct drm_encoder *encoder; + struct vc4_hdmi *vc4_hdmi; unsigned encoder_sel; int channel; + int ret; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || @@ -530,7 +534,14 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (WARN_ON(!encoder)) return 0; - return vc4_crtc_disable(crtc, encoder, NULL, channel); + vc4_hdmi = encoder_to_vc4_hdmi(encoder); + WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); + + ret = vc4_crtc_disable(crtc, encoder, NULL, channel); + + pm_runtime_put(&vc4_hdmi->pdev->dev); + + return ret; } static void vc4_crtc_atomic_disable(struct drm_crtc *crtc, -- 2.33.0