linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/stm: ltdc: enable/disable depends on encoder
@ 2020-01-20 13:46 Yannick Fertre
  2020-01-23  9:47 ` Philippe CORNU
  0 siblings, 1 reply; 3+ messages in thread
From: Yannick Fertre @ 2020-01-20 13:46 UTC (permalink / raw)
  To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard, David Airlie,
	Daniel Vetter, Maxime Coquelin, Alexandre Torgue, dri-devel,
	linux-stm32, linux-arm-kernel, linux-kernel

From: Yannick Fertré <yannick.fertre@st.com>

When connected to a dsi host, the ltdc display controller
must send frames only after the end of the dsi panel
initialization to avoid errors when the dsi host sends
commands to the dsi panel (dsi px fifo full).
To avoid this issue, the display controller must be
enabled/disabled when the encoder is enabled/disabled.

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
---
 drivers/gpu/drm/stm/ltdc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 719dfc5..9ef125d 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
 	/* Commit shadow registers = update planes at next vblank */
 	reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR);
 
-	/* Enable LTDC */
-	reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
-
 	drm_crtc_vblank_on(crtc);
 }
 
@@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 
-	/* disable LTDC */
-	reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
-
 	/* disable IRQ */
 	reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);
 
@@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 static void ltdc_encoder_disable(struct drm_encoder *encoder)
 {
 	struct drm_device *ddev = encoder->dev;
+	struct ltdc_device *ldev = ddev->dev_private;
 
 	DRM_DEBUG_DRIVER("\n");
 
+	/* Disable LTDC */
+	reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
+
 	/* Set to sleep state the pinctrl whatever type of encoder */
 	pinctrl_pm_select_sleep_state(ddev->dev);
 }
@@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder *encoder)
 static void ltdc_encoder_enable(struct drm_encoder *encoder)
 {
 	struct drm_device *ddev = encoder->dev;
+	struct ltdc_device *ldev = ddev->dev_private;
 
 	DRM_DEBUG_DRIVER("\n");
 
@@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder)
 	 */
 	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);
 }
 
 static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/stm: ltdc: enable/disable depends on encoder
  2020-01-20 13:46 [PATCH] drm/stm: ltdc: enable/disable depends on encoder Yannick Fertre
@ 2020-01-23  9:47 ` Philippe CORNU
  2020-02-04 10:56   ` Benjamin Gaignard
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe CORNU @ 2020-01-23  9:47 UTC (permalink / raw)
  To: Yannick FERTRE, Benjamin GAIGNARD, David Airlie, Daniel Vetter,
	Maxime Coquelin, Alexandre TORGUE, dri-devel, linux-stm32,
	linux-arm-kernel, linux-kernel

Dear Yannick,
Thank you for your patch,

Acked-by: Philippe Cornu <philippe.cornu@st.com>

Philippe :-)

On 1/20/20 2:46 PM, Yannick Fertre wrote:
> From: Yannick Fertré <yannick.fertre@st.com>
> 
> When connected to a dsi host, the ltdc display controller
> must send frames only after the end of the dsi panel
> initialization to avoid errors when the dsi host sends
> commands to the dsi panel (dsi px fifo full).
> To avoid this issue, the display controller must be
> enabled/disabled when the encoder is enabled/disabled.
> 
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 719dfc5..9ef125d 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
>   	/* Commit shadow registers = update planes at next vblank */
>   	reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR);
>   
> -	/* Enable LTDC */
> -	reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> -
>   	drm_crtc_vblank_on(crtc);
>   }
>   
> @@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc,
>   
>   	drm_crtc_vblank_off(crtc);
>   
> -	/* disable LTDC */
> -	reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> -
>   	/* disable IRQ */
>   	reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);
>   
> @@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>   static void ltdc_encoder_disable(struct drm_encoder *encoder)
>   {
>   	struct drm_device *ddev = encoder->dev;
> +	struct ltdc_device *ldev = ddev->dev_private;
>   
>   	DRM_DEBUG_DRIVER("\n");
>   
> +	/* Disable LTDC */
> +	reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> +
>   	/* Set to sleep state the pinctrl whatever type of encoder */
>   	pinctrl_pm_select_sleep_state(ddev->dev);
>   }
> @@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder *encoder)
>   static void ltdc_encoder_enable(struct drm_encoder *encoder)
>   {
>   	struct drm_device *ddev = encoder->dev;
> +	struct ltdc_device *ldev = ddev->dev_private;
>   
>   	DRM_DEBUG_DRIVER("\n");
>   
> @@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder)
>   	 */
>   	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);
>   }
>   
>   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/stm: ltdc: enable/disable depends on encoder
  2020-01-23  9:47 ` Philippe CORNU
@ 2020-02-04 10:56   ` Benjamin Gaignard
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Gaignard @ 2020-02-04 10:56 UTC (permalink / raw)
  To: Philippe CORNU
  Cc: Yannick FERTRE, Benjamin GAIGNARD, David Airlie, Daniel Vetter,
	Maxime Coquelin, Alexandre TORGUE, dri-devel, linux-stm32,
	linux-arm-kernel, linux-kernel

Le jeu. 23 janv. 2020 à 10:47, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu <philippe.cornu@st.com>
>
> Philippe :-)
>
> On 1/20/20 2:46 PM, Yannick Fertre wrote:
> > From: Yannick Fertré <yannick.fertre@st.com>
> >
> > When connected to a dsi host, the ltdc display controller
> > must send frames only after the end of the dsi panel
> > initialization to avoid errors when the dsi host sends
> > commands to the dsi panel (dsi px fifo full).
> > To avoid this issue, the display controller must be
> > enabled/disabled when the encoder is enabled/disabled.
> >

Applied on drm-misc-next.

Thanks
Benjamin

> > Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 14 ++++++++------
> >   1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 719dfc5..9ef125d 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc,
> >       /* Commit shadow registers = update planes at next vblank */
> >       reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR);
> >
> > -     /* Enable LTDC */
> > -     reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >       drm_crtc_vblank_on(crtc);
> >   }
> >
> > @@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc,
> >
> >       drm_crtc_vblank_off(crtc);
> >
> > -     /* disable LTDC */
> > -     reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >       /* disable IRQ */
> >       reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);
> >
> > @@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
> >   static void ltdc_encoder_disable(struct drm_encoder *encoder)
> >   {
> >       struct drm_device *ddev = encoder->dev;
> > +     struct ltdc_device *ldev = ddev->dev_private;
> >
> >       DRM_DEBUG_DRIVER("\n");
> >
> > +     /* Disable LTDC */
> > +     reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > +
> >       /* Set to sleep state the pinctrl whatever type of encoder */
> >       pinctrl_pm_select_sleep_state(ddev->dev);
> >   }
> > @@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder *encoder)
> >   static void ltdc_encoder_enable(struct drm_encoder *encoder)
> >   {
> >       struct drm_device *ddev = encoder->dev;
> > +     struct ltdc_device *ldev = ddev->dev_private;
> >
> >       DRM_DEBUG_DRIVER("\n");
> >
> > @@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder)
> >        */
> >       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);
> >   }
> >
> >   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> >
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-04 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 13:46 [PATCH] drm/stm: ltdc: enable/disable depends on encoder Yannick Fertre
2020-01-23  9:47 ` Philippe CORNU
2020-02-04 10:56   ` Benjamin Gaignard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).