mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm: mediatek: Modify dpi power on/off sequence.
@ 2022-09-05 13:53 xinlei.lee
       [not found] ` <9fe3a2381746b46bde171f01635d30da2cb93d64.camel@mediatek.com>
  0 siblings, 1 reply; 3+ messages in thread
From: xinlei.lee @ 2022-09-05 13:53 UTC (permalink / raw)
  To: chunkuang.hu, p.zabel, airlied, daniel, matthias.bgg, jitao.shi
  Cc: dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel,
	Project_Global_Chrome_Upstream_Group, Xinlei Lee

From: Xinlei Lee <xinlei.lee@mediatek.com>

Modify dpi power on/off sequence so that the first gpio operation will take effect.

Fixes: 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low to avoid leakage
current")

Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>

---
Base on the branch of Linux-next/master.
Because dpi power_on/off is protected by dpi->refcount, the first time
it cannot be powered on and off successfully, it will cause leakage.
---
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 630a4e301ef6..2ce1a39ce3bf 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -462,9 +462,6 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
 	if (--dpi->refcount != 0)
 		return;
 
-	if (dpi->pinctrl && dpi->pins_gpio)
-		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
-
 	mtk_dpi_disable(dpi);
 	clk_disable_unprepare(dpi->pixel_clk);
 	clk_disable_unprepare(dpi->engine_clk);
@@ -489,9 +486,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
 		goto err_pixel;
 	}
 
-	if (dpi->pinctrl && dpi->pins_dpi)
-		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
-
 	return 0;
 
 err_pixel:
@@ -721,6 +715,9 @@ static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)
 {
 	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
 
+	if (dpi->pinctrl && dpi->pins_gpio)
+		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
+
 	mtk_dpi_power_off(dpi);
 }
 
@@ -728,6 +725,9 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *bridge)
 {
 	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
 
+	if (dpi->pinctrl && dpi->pins_dpi)
+		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
+
 	mtk_dpi_power_on(dpi);
 	mtk_dpi_set_display_mode(dpi, &dpi->mode);
 	mtk_dpi_enable(dpi);
-- 
2.18.0


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

* Re: [PATCH] drm: mediatek: Modify dpi power on/off sequence.
       [not found] ` <9fe3a2381746b46bde171f01635d30da2cb93d64.camel@mediatek.com>
@ 2022-11-08  7:44   ` CK Hu (胡俊光)
  2022-11-09  2:27     ` Xinlei Lee (李昕磊)
  0 siblings, 1 reply; 3+ messages in thread
From: CK Hu (胡俊光) @ 2022-11-08  7:44 UTC (permalink / raw)
  To: p.zabel, daniel, matthias.bgg, chunkuang.hu,
	Xinlei Lee (李昕磊),
	airlied, Jitao Shi (石记涛)
  Cc: linux-arm-kernel, dri-devel, linux-mediatek, linux-kernel,
	Project_Global_Chrome_Upstream_Group

Hi, Xinlei:

On Wed, 2022-10-12 at 15:48 +0800, xinlei.lee wrote:
> On Mon, 2022-09-05 at 21:53 +0800, xinlei.lee@mediatek.com wrote:
> > From: Xinlei Lee <xinlei.lee@mediatek.com>
> > 
> > Modify dpi power on/off sequence so that the first gpio operation
> > will take effect.
> > 
> > Fixes: 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low to
> > avoid leakage
> > current")
> > 
> > Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
> > 
> > ---
> > Base on the branch of Linux-next/master.
> > Because dpi power_on/off is protected by dpi->refcount, the first
> > time
> > it cannot be powered on and off successfully, it will cause
> > leakage.
> > ---
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index 630a4e301ef6..2ce1a39ce3bf 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -462,9 +462,6 @@ static void mtk_dpi_power_off(struct mtk_dpi
> > *dpi)
> >  	if (--dpi->refcount != 0)
> >  		return;
> >  
> > -	if (dpi->pinctrl && dpi->pins_gpio)
> > -		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> > -
> >  	mtk_dpi_disable(dpi);
> >  	clk_disable_unprepare(dpi->pixel_clk);
> >  	clk_disable_unprepare(dpi->engine_clk);
> > @@ -489,9 +486,6 @@ static int mtk_dpi_power_on(struct mtk_dpi
> > *dpi)
> >  		goto err_pixel;
> >  	}
> >  
> > -	if (dpi->pinctrl && dpi->pins_dpi)
> > -		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> > -
> >  	return 0;
> >  
> >  err_pixel:
> > @@ -721,6 +715,9 @@ static void mtk_dpi_bridge_disable(struct
> > drm_bridge *bridge)
> >  {
> >  	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> >  
> > +	if (dpi->pinctrl && dpi->pins_gpio)
> > +		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);

I think this should be placed after mtk_dpi_power_off().

> > +
> >  	mtk_dpi_power_off(dpi);
> >  }
> >  
> > @@ -728,6 +725,9 @@ static void mtk_dpi_bridge_enable(struct
> > drm_bridge *bridge)
> >  {
> >  	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> >  
> > +	if (dpi->pinctrl && dpi->pins_dpi)
> > +		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> > +
> >  	mtk_dpi_power_on(dpi);
> >  	mtk_dpi_set_display_mode(dpi, &dpi->mode);
> >  	mtk_dpi_enable(dpi);
> 
> Hi CK,
> 
> Gentle ping for this patch, if there is anything I need to modify,
> please kindly let me know.
> 
> Best Regards!
> xinlei
> 

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

* Re: [PATCH] drm: mediatek: Modify dpi power on/off sequence.
  2022-11-08  7:44   ` CK Hu (胡俊光)
@ 2022-11-09  2:27     ` Xinlei Lee (李昕磊)
  0 siblings, 0 replies; 3+ messages in thread
From: Xinlei Lee (李昕磊) @ 2022-11-09  2:27 UTC (permalink / raw)
  To: CK Hu (胡俊光),
	p.zabel, matthias.bgg, daniel, chunkuang.hu, airlied,
	Jitao Shi (石记涛)
  Cc: linux-arm-kernel, dri-devel, linux-mediatek, linux-kernel,
	Project_Global_Chrome_Upstream_Group

On Tue, 2022-11-08 at 07:44 +0000, CK Hu (胡俊光) wrote:
> Hi, Xinlei:
> 
> On Wed, 2022-10-12 at 15:48 +0800, xinlei.lee wrote:
> > On Mon, 2022-09-05 at 21:53 +0800, xinlei.lee@mediatek.com wrote:
> > > From: Xinlei Lee <xinlei.lee@mediatek.com>
> > > 
> > > Modify dpi power on/off sequence so that the first gpio operation
> > > will take effect.
> > > 
> > > Fixes: 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low
> > > to
> > > avoid leakage
> > > current")
> > > 
> > > Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
> > > 
> > > ---
> > > Base on the branch of Linux-next/master.
> > > Because dpi power_on/off is protected by dpi->refcount, the first
> > > time
> > > it cannot be powered on and off successfully, it will cause
> > > leakage.
> > > ---
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > index 630a4e301ef6..2ce1a39ce3bf 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > @@ -462,9 +462,6 @@ static void mtk_dpi_power_off(struct mtk_dpi
> > > *dpi)
> > >  	if (--dpi->refcount != 0)
> > >  		return;
> > >  
> > > -	if (dpi->pinctrl && dpi->pins_gpio)
> > > -		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> > > -
> > >  	mtk_dpi_disable(dpi);
> > >  	clk_disable_unprepare(dpi->pixel_clk);
> > >  	clk_disable_unprepare(dpi->engine_clk);
> > > @@ -489,9 +486,6 @@ static int mtk_dpi_power_on(struct mtk_dpi
> > > *dpi)
> > >  		goto err_pixel;
> > >  	}
> > >  
> > > -	if (dpi->pinctrl && dpi->pins_dpi)
> > > -		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> > > -
> > >  	return 0;
> > >  
> > >  err_pixel:
> > > @@ -721,6 +715,9 @@ static void mtk_dpi_bridge_disable(struct
> > > drm_bridge *bridge)
> > >  {
> > >  	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > >  
> > > +	if (dpi->pinctrl && dpi->pins_gpio)
> > > +		pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
> 
> I think this should be placed after mtk_dpi_power_off().
> 
> > > +
> > >  	mtk_dpi_power_off(dpi);
> > >  }
> > >  
> > > @@ -728,6 +725,9 @@ static void mtk_dpi_bridge_enable(struct
> > > drm_bridge *bridge)
> > >  {
> > >  	struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > >  
> > > +	if (dpi->pinctrl && dpi->pins_dpi)
> > > +		pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
> > > +
> > >  	mtk_dpi_power_on(dpi);
> > >  	mtk_dpi_set_display_mode(dpi, &dpi->mode);
> > >  	mtk_dpi_enable(dpi);
> > 
> > Hi CK,
> > 
> > Gentle ping for this patch, if there is anything I need to modify,
> > please kindly let me know.
> > 
> > Best Regards!
> > xinlei
> > 

Hi CK:

Yes, this pacth is mainly to remove the control of the pin from 
dpi_power_on/off, because dpi_power_on/off is protected by refcount.

I will modify the position of the pull-down gpio in the next version.

Best Regards!
xinlei

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

end of thread, other threads:[~2022-11-09  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 13:53 [PATCH] drm: mediatek: Modify dpi power on/off sequence xinlei.lee
     [not found] ` <9fe3a2381746b46bde171f01635d30da2cb93d64.camel@mediatek.com>
2022-11-08  7:44   ` CK Hu (胡俊光)
2022-11-09  2:27     ` Xinlei Lee (李昕磊)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®