drm/stm: ltdc: disable all layers before crtc shutdown
authorYannick Fertre <yannick.fertre@foss.st.com>
Fri, 3 Jun 2022 13:41:51 +0000 (15:41 +0200)
committerPhilippe Cornu <philippe.cornu@foss.st.com>
Mon, 27 Jun 2022 13:53:49 +0000 (15:53 +0200)
All plans must be disabled before the CRTC shutdown helping
the crtc to restart from a clean situation (without unwanted
planes already enable).

Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220603134151.591997-1-yannick.fertre@foss.st.com
drivers/gpu/drm/stm/ltdc.c

index 76230f775081408a318578803f1da97092353266..0de65be9cd65fc1f59b87c547e27a6686fce228f 100644 (file)
@@ -790,11 +790,17 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc,
 {
        struct ltdc_device *ldev = crtc_to_ltdc(crtc);
        struct drm_device *ddev = crtc->dev;
+       int layer_index = 0;
 
        DRM_DEBUG_DRIVER("\n");
 
        drm_crtc_vblank_off(crtc);
 
+       /* Disable all layers */
+       for (layer_index = 0; layer_index < ldev->caps.nb_layers; layer_index++)
+               regmap_write_bits(ldev->regmap, LTDC_L1CR + layer_index * LAY_OFS,
+                                 LXCR_CLUTEN | LXCR_LEN, 0);
+
        /* disable IRQ */
        regmap_clear_bits(ldev->regmap, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);