All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-08-02 14:47 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-08-02 14:47 UTC (permalink / raw)
  To: Maxime Coquelin, Alexandre Torgue, Rob Herring, Mark Rutland,
	linux-stm32, linux-arm-kernel, devicetree, linux-kernel,
	Benjamin Gaignard, Yannick Fertre, Philippe Cornu,
	Fabrice Gasnier

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4


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

* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-08-02 14:47 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-08-02 14:47 UTC (permalink / raw)
  To: Maxime Coquelin, Alexandre Torgue, Rob Herring, Mark Rutland,
	linux-stm32, linux-arm-kernel, devicetree, linux-kernel,
	Benjamin Gaignard, Yannick Fertre, Philippe Cornu,
	Fabrice Gasnier

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4

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

* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-08-02 14:47 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-08-02 14:47 UTC (permalink / raw)
  To: Maxime Coquelin, Alexandre Torgue, Rob Herring, Mark Rutland,
	linux-stm32, linux-arm-kernel, devicetree, linux-kernel,
	Benjamin Gaignard, Yannick Fertre, Philippe Cornu,
	Fabrice Gasnier

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
  2019-08-02 14:47 ` Yannick Fertré
@ 2019-09-02  8:47   ` Philippe CORNU
  -1 siblings, 0 replies; 14+ messages in thread
From: Philippe CORNU @ 2019-09-02  8:47 UTC (permalink / raw)
  To: Yannick FERTRE, Maxime Coquelin, Alexandre TORGUE, Rob Herring,
	Mark Rutland, linux-stm32, linux-arm-kernel, devicetree,
	linux-kernel, Benjamin GAIGNARD, Fabrice GASNIER

Hi Yannick,

On 8/2/19 4:47 PM, Yannick Fertré wrote:
> The implementation of functions encoder_enable and encoder_disable
> make possible to control the pinctrl according to the encoder type.
> The pinctrl must be activated only if the encoder type is DPI.
> This helps to move the DPI-related pinctrl configuration from
> all the panel or bridge to the LTDC dt node.
> 
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
>   1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 3ab4fbf..1c4fde0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -15,6 +15,7 @@
>   #include <linux/module.h>
>   #include <linux/of_address.h>
>   #include <linux/of_graph.h>
> +#include <linux/pinctrl/consumer.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/reset.h>
> @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>   	.destroy = drm_encoder_cleanup,
>   };
>   
> +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> +{
> +	struct drm_device *ddev = encoder->dev;
> +
> +	DRM_DEBUG_DRIVER("\n");
> +
> +	/* Set to sleep state the pinctrl whatever type of encoder */
> +	pinctrl_pm_select_sleep_state(ddev->dev);
> +}
> +
> +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> +{
> +	struct drm_device *ddev = encoder->dev;
> +
> +	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);
> +}
> +
> +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> +	.disable = ltdc_encoder_disable,
> +	.enable = ltdc_encoder_enable,
> +};
> +
>   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>   {
>   	struct drm_encoder *encoder;
> @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>   	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
>   			 DRM_MODE_ENCODER_DPI, NULL);
>   
> +	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> +
>   	ret = drm_bridge_attach(encoder, bridge, NULL);
>   	if (ret) {
>   		drm_encoder_cleanup(encoder);
> @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
>   
>   	clk_disable_unprepare(ldev->pixel_clk);
>   
> +	pinctrl_pm_select_sleep_state(ddev->dev);
> +

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

Thanks
Philippe :)

>   	pm_runtime_enable(ddev->dev);
>   
>   	return 0;
> 

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

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-02  8:47   ` Philippe CORNU
  0 siblings, 0 replies; 14+ messages in thread
From: Philippe CORNU @ 2019-09-02  8:47 UTC (permalink / raw)
  To: Yannick FERTRE, Maxime Coquelin, Alexandre TORGUE, Rob Herring,
	Mark Rutland, linux-stm32, linux-arm-kernel, devicetree,
	linux-kernel, Benjamin GAIGNARD, Fabrice GASNIER

Hi Yannick,

On 8/2/19 4:47 PM, Yannick Fertré wrote:
> The implementation of functions encoder_enable and encoder_disable
> make possible to control the pinctrl according to the encoder type.
> The pinctrl must be activated only if the encoder type is DPI.
> This helps to move the DPI-related pinctrl configuration from
> all the panel or bridge to the LTDC dt node.
> 
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
>   1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 3ab4fbf..1c4fde0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -15,6 +15,7 @@
>   #include <linux/module.h>
>   #include <linux/of_address.h>
>   #include <linux/of_graph.h>
> +#include <linux/pinctrl/consumer.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/reset.h>
> @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>   	.destroy = drm_encoder_cleanup,
>   };
>   
> +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> +{
> +	struct drm_device *ddev = encoder->dev;
> +
> +	DRM_DEBUG_DRIVER("\n");
> +
> +	/* Set to sleep state the pinctrl whatever type of encoder */
> +	pinctrl_pm_select_sleep_state(ddev->dev);
> +}
> +
> +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> +{
> +	struct drm_device *ddev = encoder->dev;
> +
> +	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);
> +}
> +
> +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> +	.disable = ltdc_encoder_disable,
> +	.enable = ltdc_encoder_enable,
> +};
> +
>   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>   {
>   	struct drm_encoder *encoder;
> @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>   	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
>   			 DRM_MODE_ENCODER_DPI, NULL);
>   
> +	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> +
>   	ret = drm_bridge_attach(encoder, bridge, NULL);
>   	if (ret) {
>   		drm_encoder_cleanup(encoder);
> @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
>   
>   	clk_disable_unprepare(ldev->pixel_clk);
>   
> +	pinctrl_pm_select_sleep_state(ddev->dev);
> +

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

Thanks
Philippe :)

>   	pm_runtime_enable(ddev->dev);
>   
>   	return 0;
> 
_______________________________________________
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] 14+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
  2019-09-02  8:47   ` Philippe CORNU
  (?)
@ 2019-09-02  9:35     ` Benjamin Gaignard
  -1 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-02  9:35 UTC (permalink / raw)
  To: Philippe CORNU
  Cc: Yannick FERTRE, Maxime Coquelin, Alexandre TORGUE, Rob Herring,
	Mark Rutland, linux-stm32, linux-arm-kernel, devicetree,
	linux-kernel, Benjamin GAIGNARD, Fabrice GASNIER, ML dri-devel

+dri-devel mailing list

Le lun. 2 sept. 2019 à 10:47, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Hi Yannick,
>
> On 8/2/19 4:47 PM, Yannick Fertré wrote:
> > The implementation of functions encoder_enable and encoder_disable
> > make possible to control the pinctrl according to the encoder type.
> > The pinctrl must be activated only if the encoder type is DPI.
> > This helps to move the DPI-related pinctrl configuration from
> > all the panel or bridge to the LTDC dt node.
> >
> > Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
> >   1 file changed, 35 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 3ab4fbf..1c4fde0 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -15,6 +15,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of_address.h>
> >   #include <linux/of_graph.h>
> > +#include <linux/pinctrl/consumer.h>
> >   #include <linux/platform_device.h>
> >   #include <linux/pm_runtime.h>
> >   #include <linux/reset.h>
> > @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
> >       .destroy = drm_encoder_cleanup,
> >   };
> >
> > +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     DRM_DEBUG_DRIVER("\n");
> > +
> > +     /* Set to sleep state the pinctrl whatever type of encoder */
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +}
> > +
> > +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     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);
> > +}
> > +
> > +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> > +     .disable = ltdc_encoder_disable,
> > +     .enable = ltdc_encoder_enable,
> > +};
> > +
> >   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >   {
> >       struct drm_encoder *encoder;
> > @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >       drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
> >                        DRM_MODE_ENCODER_DPI, NULL);
> >
> > +     drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> > +
> >       ret = drm_bridge_attach(encoder, bridge, NULL);
> >       if (ret) {
> >               drm_encoder_cleanup(encoder);
> > @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
> >
> >       clk_disable_unprepare(ldev->pixel_clk);
> >
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Thanks
> Philippe :)
>
> >       pm_runtime_enable(ddev->dev);
> >
> >       return 0;
> >
> _______________________________________________
> 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] 14+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-02  9:35     ` Benjamin Gaignard
  0 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-02  9:35 UTC (permalink / raw)
  To: Philippe CORNU
  Cc: Mark Rutland, devicetree, Alexandre TORGUE, linux-kernel,
	ML dri-devel, Yannick FERTRE, Rob Herring, Maxime Coquelin,
	Fabrice GASNIER, linux-stm32, linux-arm-kernel,
	Benjamin GAIGNARD

+dri-devel mailing list

Le lun. 2 sept. 2019 à 10:47, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Hi Yannick,
>
> On 8/2/19 4:47 PM, Yannick Fertré wrote:
> > The implementation of functions encoder_enable and encoder_disable
> > make possible to control the pinctrl according to the encoder type.
> > The pinctrl must be activated only if the encoder type is DPI.
> > This helps to move the DPI-related pinctrl configuration from
> > all the panel or bridge to the LTDC dt node.
> >
> > Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
> >   1 file changed, 35 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 3ab4fbf..1c4fde0 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -15,6 +15,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of_address.h>
> >   #include <linux/of_graph.h>
> > +#include <linux/pinctrl/consumer.h>
> >   #include <linux/platform_device.h>
> >   #include <linux/pm_runtime.h>
> >   #include <linux/reset.h>
> > @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
> >       .destroy = drm_encoder_cleanup,
> >   };
> >
> > +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     DRM_DEBUG_DRIVER("\n");
> > +
> > +     /* Set to sleep state the pinctrl whatever type of encoder */
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +}
> > +
> > +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     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);
> > +}
> > +
> > +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> > +     .disable = ltdc_encoder_disable,
> > +     .enable = ltdc_encoder_enable,
> > +};
> > +
> >   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >   {
> >       struct drm_encoder *encoder;
> > @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >       drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
> >                        DRM_MODE_ENCODER_DPI, NULL);
> >
> > +     drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> > +
> >       ret = drm_bridge_attach(encoder, bridge, NULL);
> >       if (ret) {
> >               drm_encoder_cleanup(encoder);
> > @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
> >
> >       clk_disable_unprepare(ldev->pixel_clk);
> >
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Thanks
> Philippe :)
>
> >       pm_runtime_enable(ddev->dev);
> >
> >       return 0;
> >
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-02  9:35     ` Benjamin Gaignard
  0 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-02  9:35 UTC (permalink / raw)
  To: Philippe CORNU
  Cc: Mark Rutland, devicetree, Alexandre TORGUE, linux-kernel,
	ML dri-devel, Yannick FERTRE, Rob Herring, Maxime Coquelin,
	Fabrice GASNIER, linux-stm32, linux-arm-kernel,
	Benjamin GAIGNARD

+dri-devel mailing list

Le lun. 2 sept. 2019 à 10:47, Philippe CORNU <philippe.cornu@st.com> a écrit :
>
> Hi Yannick,
>
> On 8/2/19 4:47 PM, Yannick Fertré wrote:
> > The implementation of functions encoder_enable and encoder_disable
> > make possible to control the pinctrl according to the encoder type.
> > The pinctrl must be activated only if the encoder type is DPI.
> > This helps to move the DPI-related pinctrl configuration from
> > all the panel or bridge to the LTDC dt node.
> >
> > Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
> >   1 file changed, 35 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 3ab4fbf..1c4fde0 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -15,6 +15,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of_address.h>
> >   #include <linux/of_graph.h>
> > +#include <linux/pinctrl/consumer.h>
> >   #include <linux/platform_device.h>
> >   #include <linux/pm_runtime.h>
> >   #include <linux/reset.h>
> > @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
> >       .destroy = drm_encoder_cleanup,
> >   };
> >
> > +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     DRM_DEBUG_DRIVER("\n");
> > +
> > +     /* Set to sleep state the pinctrl whatever type of encoder */
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +}
> > +
> > +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> > +{
> > +     struct drm_device *ddev = encoder->dev;
> > +
> > +     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);
> > +}
> > +
> > +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> > +     .disable = ltdc_encoder_disable,
> > +     .enable = ltdc_encoder_enable,
> > +};
> > +
> >   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >   {
> >       struct drm_encoder *encoder;
> > @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
> >       drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
> >                        DRM_MODE_ENCODER_DPI, NULL);
> >
> > +     drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> > +
> >       ret = drm_bridge_attach(encoder, bridge, NULL);
> >       if (ret) {
> >               drm_encoder_cleanup(encoder);
> > @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
> >
> >       clk_disable_unprepare(ldev->pixel_clk);
> >
> > +     pinctrl_pm_select_sleep_state(ddev->dev);
> > +
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Thanks
> Philippe :)
>
> >       pm_runtime_enable(ddev->dev);
> >
> >       return 0;
> >
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
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] 14+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
  2019-09-06  9:21 ` Yannick Fertré
  (?)
@ 2019-09-09  9:32   ` Benjamin Gaignard
  -1 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-09  9:32 UTC (permalink / raw)
  To: Yannick Fertré
  Cc: Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie,
	Daniel Vetter, Maxime Coquelin, Alexandre Torgue, ML dri-devel,
	linux-stm32, Linux ARM, Linux Kernel Mailing List

Le ven. 6 sept. 2019 à 11:22, Yannick Fertré <yannick.fertre@st.com> a écrit :
>
> The implementation of functions encoder_enable and encoder_disable
> make possible to control the pinctrl according to the encoder type.
> The pinctrl must be activated only if the encoder type is DPI.
> This helps to move the DPI-related pinctrl configuration from
> all the panel or bridge to the LTDC dt node.
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>

Applied on drm-misc-next,
Thanks,
Benjamin

> ---
>  drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 3ab4fbf..1c4fde0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/of_graph.h>
> +#include <linux/pinctrl/consumer.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/reset.h>
> @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>         .destroy = drm_encoder_cleanup,
>  };
>
> +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       DRM_DEBUG_DRIVER("\n");
> +
> +       /* Set to sleep state the pinctrl whatever type of encoder */
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +}
> +
> +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       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);
> +}
> +
> +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> +       .disable = ltdc_encoder_disable,
> +       .enable = ltdc_encoder_enable,
> +};
> +
>  static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>  {
>         struct drm_encoder *encoder;
> @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>         drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
>                          DRM_MODE_ENCODER_DPI, NULL);
>
> +       drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> +
>         ret = drm_bridge_attach(encoder, bridge, NULL);
>         if (ret) {
>                 drm_encoder_cleanup(encoder);
> @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
>
>         clk_disable_unprepare(ldev->pixel_clk);
>
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +
>         pm_runtime_enable(ddev->dev);
>
>         return 0;
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-09  9:32   ` Benjamin Gaignard
  0 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-09  9:32 UTC (permalink / raw)
  To: Yannick Fertré
  Cc: Daniel Vetter, David Airlie, Philippe Cornu, ML dri-devel,
	Linux Kernel Mailing List, Alexandre Torgue, Maxime Coquelin,
	Vincent Abriou, linux-stm32, Linux ARM, Benjamin Gaignard

Le ven. 6 sept. 2019 à 11:22, Yannick Fertré <yannick.fertre@st.com> a écrit :
>
> The implementation of functions encoder_enable and encoder_disable
> make possible to control the pinctrl according to the encoder type.
> The pinctrl must be activated only if the encoder type is DPI.
> This helps to move the DPI-related pinctrl configuration from
> all the panel or bridge to the LTDC dt node.
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>

Applied on drm-misc-next,
Thanks,
Benjamin

> ---
>  drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 3ab4fbf..1c4fde0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/of_graph.h>
> +#include <linux/pinctrl/consumer.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/reset.h>
> @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>         .destroy = drm_encoder_cleanup,
>  };
>
> +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       DRM_DEBUG_DRIVER("\n");
> +
> +       /* Set to sleep state the pinctrl whatever type of encoder */
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +}
> +
> +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       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);
> +}
> +
> +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> +       .disable = ltdc_encoder_disable,
> +       .enable = ltdc_encoder_enable,
> +};
> +
>  static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>  {
>         struct drm_encoder *encoder;
> @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>         drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
>                          DRM_MODE_ENCODER_DPI, NULL);
>
> +       drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> +
>         ret = drm_bridge_attach(encoder, bridge, NULL);
>         if (ret) {
>                 drm_encoder_cleanup(encoder);
> @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
>
>         clk_disable_unprepare(ldev->pixel_clk);
>
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +
>         pm_runtime_enable(ddev->dev);
>
>         return 0;
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
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] 14+ messages in thread

* Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-09  9:32   ` Benjamin Gaignard
  0 siblings, 0 replies; 14+ messages in thread
From: Benjamin Gaignard @ 2019-09-09  9:32 UTC (permalink / raw)
  To: Yannick Fertré
  Cc: David Airlie, Philippe Cornu, ML dri-devel,
	Linux Kernel Mailing List, Alexandre Torgue, Maxime Coquelin,
	Vincent Abriou, linux-stm32, Linux ARM, Benjamin Gaignard

Le ven. 6 sept. 2019 à 11:22, Yannick Fertré <yannick.fertre@st.com> a écrit :
>
> The implementation of functions encoder_enable and encoder_disable
> make possible to control the pinctrl according to the encoder type.
> The pinctrl must be activated only if the encoder type is DPI.
> This helps to move the DPI-related pinctrl configuration from
> all the panel or bridge to the LTDC dt node.
>
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>

Applied on drm-misc-next,
Thanks,
Benjamin

> ---
>  drivers/gpu/drm/stm/ltdc.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 3ab4fbf..1c4fde0 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/of_graph.h>
> +#include <linux/pinctrl/consumer.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/reset.h>
> @@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
>         .destroy = drm_encoder_cleanup,
>  };
>
> +static void ltdc_encoder_disable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       DRM_DEBUG_DRIVER("\n");
> +
> +       /* Set to sleep state the pinctrl whatever type of encoder */
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +}
> +
> +static void ltdc_encoder_enable(struct drm_encoder *encoder)
> +{
> +       struct drm_device *ddev = encoder->dev;
> +
> +       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);
> +}
> +
> +static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> +       .disable = ltdc_encoder_disable,
> +       .enable = ltdc_encoder_enable,
> +};
> +
>  static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>  {
>         struct drm_encoder *encoder;
> @@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
>         drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
>                          DRM_MODE_ENCODER_DPI, NULL);
>
> +       drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
> +
>         ret = drm_bridge_attach(encoder, bridge, NULL);
>         if (ret) {
>                 drm_encoder_cleanup(encoder);
> @@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
>
>         clk_disable_unprepare(ldev->pixel_clk);
>
> +       pinctrl_pm_select_sleep_state(ddev->dev);
> +
>         pm_runtime_enable(ddev->dev);
>
>         return 0;
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-06  9:21 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-09-06  9:21 UTC (permalink / raw)
  To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin,
	Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel,
	linux-kernel

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4


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

* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-06  9:21 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-09-06  9:21 UTC (permalink / raw)
  To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin,
	Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel,
	linux-kernel

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
@ 2019-09-06  9:21 ` Yannick Fertré
  0 siblings, 0 replies; 14+ messages in thread
From: Yannick Fertré @ 2019-09-06  9:21 UTC (permalink / raw)
  To: Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, David Airlie, Daniel Vetter, Maxime Coquelin,
	Alexandre Torgue, dri-devel, linux-stm32, linux-arm-kernel,
	linux-kernel

The implementation of functions encoder_enable and encoder_disable
make possible to control the pinctrl according to the encoder type.
The pinctrl must be activated only if the encoder type is DPI.
This helps to move the DPI-related pinctrl configuration from
all the panel or bridge to the LTDC dt node.

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

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

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf..1c4fde0 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_graph.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
@@ -1040,6 +1041,36 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
 
+static void ltdc_encoder_disable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	DRM_DEBUG_DRIVER("\n");
+
+	/* Set to sleep state the pinctrl whatever type of encoder */
+	pinctrl_pm_select_sleep_state(ddev->dev);
+}
+
+static void ltdc_encoder_enable(struct drm_encoder *encoder)
+{
+	struct drm_device *ddev = encoder->dev;
+
+	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);
+}
+
+static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
+	.disable = ltdc_encoder_disable,
+	.enable = ltdc_encoder_enable,
+};
+
 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 {
 	struct drm_encoder *encoder;
@@ -1055,6 +1086,8 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 	drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
 			 DRM_MODE_ENCODER_DPI, NULL);
 
+	drm_encoder_helper_add(encoder, &ltdc_encoder_helper_funcs);
+
 	ret = drm_bridge_attach(encoder, bridge, NULL);
 	if (ret) {
 		drm_encoder_cleanup(encoder);
@@ -1280,6 +1313,8 @@ int ltdc_load(struct drm_device *ddev)
 
 	clk_disable_unprepare(ldev->pixel_clk);
 
+	pinctrl_pm_select_sleep_state(ddev->dev);
+
 	pm_runtime_enable(ddev->dev);
 
 	return 0;
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-09-09  9:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 14:47 [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode Yannick Fertré
2019-08-02 14:47 ` Yannick Fertré
2019-08-02 14:47 ` Yannick Fertré
2019-09-02  8:47 ` Philippe CORNU
2019-09-02  8:47   ` Philippe CORNU
2019-09-02  9:35   ` Benjamin Gaignard
2019-09-02  9:35     ` Benjamin Gaignard
2019-09-02  9:35     ` Benjamin Gaignard
2019-09-06  9:21 Yannick Fertré
2019-09-06  9:21 ` Yannick Fertré
2019-09-06  9:21 ` Yannick Fertré
2019-09-09  9:32 ` Benjamin Gaignard
2019-09-09  9:32   ` Benjamin Gaignard
2019-09-09  9:32   ` Benjamin Gaignard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.