drm/stm: ltdc: move pinctrl to encoder mode set
diff mbox series

Message ID 1574850218-13257-1-git-send-email-yannick.fertre@st.com
State New
Headers show
Series
  • drm/stm: ltdc: move pinctrl to encoder mode set
Related show

Commit Message

Yannick Fertre Nov. 27, 2019, 10:23 a.m. UTC
From: Yannick Fertré <yannick.fertre@st.com>

The pin control must be set to default as soon as possible to
establish a good video link between tv & bridge hdmi
(encoder mode set is call before encoder enable).

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

Comments

Philippe CORNU Dec. 2, 2019, 5:18 p.m. UTC | #1
Dear Yannick,
Thank you for your patch,

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

Philippe :-)

On 11/27/19 11:23 AM, Yannick Fertre wrote:
> From: Yannick Fertré <yannick.fertre@st.com>
> 
> The pin control must be set to default as soon as possible to
> establish a good video link between tv & bridge hdmi
> (encoder mode set is call before encoder enable).
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 24 ++++++++++++++++++------
>   1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 49ef406..dba8e7f 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -435,9 +435,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);
>   }
>   
> @@ -451,9 +448,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);
>   
> @@ -1042,9 +1036,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);
>   }
> @@ -1052,6 +1050,19 @@ 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");
> +
> +	/* Enable LTDC */
> +	reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> +}
> +
> +static void ltdc_encoder_mode_set(struct drm_encoder *encoder,
> +				  struct drm_display_mode *mode,
> +				  struct drm_display_mode *adjusted_mode)
> +{
> +	struct drm_device *ddev = encoder->dev;
>   
>   	DRM_DEBUG_DRIVER("\n");
>   
> @@ -1067,6 +1078,7 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder)
>   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
>   	.disable = ltdc_encoder_disable,
>   	.enable = ltdc_encoder_enable,
> +	.mode_set = ltdc_encoder_mode_set,
>   };
>   
>   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>
Benjamin Gaignard Dec. 20, 2019, 12:33 p.m. UTC | #2
Le lun. 2 déc. 2019 à 18:19, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu <philippe.cornu@st.com>
>

Applied on drm-misc-next,

Thanks,
Benjamin

> Philippe :-)
>
> On 11/27/19 11:23 AM, Yannick Fertre wrote:
> > From: Yannick Fertré <yannick.fertre@st.com>
> >
> > The pin control must be set to default as soon as possible to
> > establish a good video link between tv & bridge hdmi
> > (encoder mode set is call before encoder enable).
> >
> > Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 24 ++++++++++++++++++------
> >   1 file changed, 18 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 49ef406..dba8e7f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -435,9 +435,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);
> >   }
> >
> > @@ -451,9 +448,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);
> >
> > @@ -1042,9 +1036,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);
> >   }
> > @@ -1052,6 +1050,19 @@ 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");
> > +
> > +     /* Enable LTDC */
> > +     reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > +}
> > +
> > +static void ltdc_encoder_mode_set(struct drm_encoder *encoder,
> > +                               struct drm_display_mode *mode,
> > +                               struct drm_display_mode *adjusted_mode)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> >
> >       DRM_DEBUG_DRIVER("\n");
> >
> > @@ -1067,6 +1078,7 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder)
> >   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> >       .disable = ltdc_encoder_disable,
> >       .enable = ltdc_encoder_enable,
> > +     .mode_set = ltdc_encoder_mode_set,
> >   };
> >
> >   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 49ef406..dba8e7f 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -435,9 +435,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);
 }
 
@@ -451,9 +448,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);
 
@@ -1042,9 +1036,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);
 }
@@ -1052,6 +1050,19 @@  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");
+
+	/* Enable LTDC */
+	reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
+}
+
+static void ltdc_encoder_mode_set(struct drm_encoder *encoder,
+				  struct drm_display_mode *mode,
+				  struct drm_display_mode *adjusted_mode)
+{
+	struct drm_device *ddev = encoder->dev;
 
 	DRM_DEBUG_DRIVER("\n");
 
@@ -1067,6 +1078,7 @@  static void ltdc_encoder_enable(struct drm_encoder *encoder)
 static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
 	.disable = ltdc_encoder_disable,
 	.enable = ltdc_encoder_enable,
+	.mode_set = ltdc_encoder_mode_set,
 };
 
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)