From cfc42fef9c354933091bc14b82fb6fbad9a6cb74 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Wed, 27 Apr 2022 21:43:02 -0700 Subject: [PATCH] drm/stm: ltdc: fix pinctrl recovery after sleep When the encoder is disabled, the pinctrl goes to sleep state. If the encoder is re-enabled after that, the pinctrl needs to go back to default state. This wasn't happening after the pinctrl setup was moved to ltdc_encoder_mode_set. Without this fix, if the framebuffer is put to sleep and then awakened (e.g. using /sys/class/graphics/fb0/blank), it doesn't recover properly. Signed-off-by: Doug Brown Fixes: f412af187ae1 ("drm/stm: ltdc: move pinctrl to encoder mode set") --- drivers/gpu/drm/stm/ltdc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index a7c85a92221d4f..104dcefe43712b 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1134,6 +1134,14 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder) DRM_DEBUG_DRIVER("\n"); + /* + * Set to default state the pinctrl only with DPI type. + * Others types like DSI, don't need pinctrl due to + * internal bridge (the signals do not come out of the chipset). + */ + if (encoder->encoder_type == DRM_MODE_ENCODER_DPI) + pinctrl_pm_select_default_state(ddev->dev); + /* Enable LTDC */ reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); } @@ -1146,11 +1154,7 @@ static void ltdc_encoder_mode_set(struct drm_encoder *encoder, DRM_DEBUG_DRIVER("\n"); - /* - * Set to default state the pinctrl only with DPI type. - * Others types like DSI, don't need pinctrl due to - * internal bridge (the signals do not come out of the chipset). - */ + /* Set pinctrl to default as soon as possible */ if (encoder->encoder_type == DRM_MODE_ENCODER_DPI) pinctrl_pm_select_default_state(ddev->dev); }