linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Philippe CORNU <philippe.cornu@st.com>
To: Yannick FERTRE <yannick.fertre@st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Benjamin GAIGNARD <benjamin.gaignard@st.com>,
	Fabrice GASNIER <fabrice.gasnier@st.com>
Subject: Re: [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode
Date: Mon, 2 Sep 2019 08:47:06 +0000	[thread overview]
Message-ID: <ada48bc2-ac6a-8732-9aa6-03ef1c104abf@st.com> (raw)
In-Reply-To: <1564757262-6166-1-git-send-email-yannick.fertre@st.com>

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

  reply	other threads:[~2019-09-02  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 14:47 [PATCH] drm/stm: ltdc: add pinctrl for DPI encoder mode Yannick Fertré
2019-09-02  8:47 ` Philippe CORNU [this message]
2019-09-02  9:35   ` Benjamin Gaignard
  -- strict thread matches above, loose matches on Subject: below --
2019-09-06  9:21 Yannick Fertré
2019-09-09  9:32 ` Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ada48bc2-ac6a-8732-9aa6-03ef1c104abf@st.com \
    --to=philippe.cornu@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=benjamin.gaignard@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrice.gasnier@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).