diff mbox series

drm/stm: ltdc: disable all layers before crtc shutdown

Message ID 20220603134151.591997-1-yannick.fertre@foss.st.com (mailing list archive)
State New, archived
Headers show
Series drm/stm: ltdc: disable all layers before crtc shutdown | expand

Commit Message

Yannick Fertre June 3, 2022, 1:41 p.m. UTC
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>
---
 drivers/gpu/drm/stm/ltdc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Philippe CORNU June 27, 2022, 2:10 p.m. UTC | #1
On 6/3/22 15:41, Yannick Fertre wrote:
> 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>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 6bd45df8f5a7..eeefc3260c07 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -787,11 +787,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);
>   

Dear Yannick,
Many thanks for your patch,
Applied on drm-misc-next.
Have a good day
Philippe :-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 6bd45df8f5a7..eeefc3260c07 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -787,11 +787,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);