diff mbox series

[1/2] drm: rcar-du: Add Standby Mode support

Message ID 1544772318-17408-1-git-send-email-na-hoan@jinso.co.jp (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series [1/2] drm: rcar-du: Add Standby Mode support | expand

Commit Message

グェン・アン・ホァン Dec. 14, 2018, 7:25 a.m. UTC
From: Hoan Nguyen An <na-hoan@jinso.co.jp>

Add function support for Module Standby Mode

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  1 +
 2 files changed, 27 insertions(+)

Comments

Sergei Shtylyov Dec. 14, 2018, 8:47 a.m. UTC | #1
Hello!

On 14.12.2018 10:25, Nguyen An Hoan wrote:

> From: Hoan Nguyen An <na-hoan@jinso.co.jp>
> 
> Add function support for Module Standby Mode
> 
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
> ---
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 26 ++++++++++++++++++++++++++
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  1 +
>   2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index 90dacab..935cdd1 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -651,6 +651,32 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
>   	rcar_du_group_start_stop(rcrtc->group, false);
>   }
>   
> +int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc)
> +{
> +	u32 val_reg;
> +	unsigned int i = 0;
> +
> +	/* Enter Standby mode */
> +	rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_DRES | DSYSR_DEN, 0);
> +
> +	for(i = 100; i > 0; i--)
> +	{

    Please run your patches thru scripts/checkpatch.pl before posting.

> +		val_reg = rcar_du_crtc_read(rcrtc, DSSR);
> +		if(!(val_reg & DSSR_VBK))
> +			break;
> +		udelay(10);
> +	}
> +
> +	if(!(i > 0))
> +		return -ETIMEDOUT;
> +
> +	/* Stop clock */
> +	clk_set_rate(rcrtc->extclock, 0);
> +	clk_set_rate(rcrtc->clock, 0);
> +
> +	return 0;
> +}
> +
>   /* -----------------------------------------------------------------------------
>    * CRTC Functions
>    */
[...]

MBR, Sergei
Geert Uytterhoeven Dec. 14, 2018, 7:06 p.m. UTC | #2
Hi Hoan,

On Fri, Dec 14, 2018 at 8:25 AM Nguyen An Hoan <na-hoan@jinso.co.jp> wrote:
> From: Hoan Nguyen An <na-hoan@jinso.co.jp>
>
> Add function support for Module Standby Mode
>
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>

Thanks for your patch!

> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -651,6 +651,32 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
>         rcar_du_group_start_stop(rcrtc->group, false);
>  }
>
> +int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc)
> +{
> +       u32 val_reg;
> +       unsigned int i = 0;
> +
> +       /* Enter Standby mode */
> +       rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_DRES | DSYSR_DEN, 0);
> +
> +       for(i = 100; i > 0; i--)
> +       {
> +               val_reg = rcar_du_crtc_read(rcrtc, DSSR);
> +               if(!(val_reg & DSSR_VBK))
> +                       break;
> +               udelay(10);
> +       }
> +
> +       if(!(i > 0))
> +               return -ETIMEDOUT;
> +
> +       /* Stop clock */
> +       clk_set_rate(rcrtc->extclock, 0);
> +       clk_set_rate(rcrtc->clock, 0);

That's not the API to stop a clock.
Why do you set the clock rates to 0?

> +
> +       return 0;
> +}

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 90dacab..935cdd1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -651,6 +651,32 @@  static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
 	rcar_du_group_start_stop(rcrtc->group, false);
 }
 
+int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc)
+{
+	u32 val_reg;
+	unsigned int i = 0;
+
+	/* Enter Standby mode */
+	rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_DRES | DSYSR_DEN, 0);
+
+	for(i = 100; i > 0; i--)
+	{
+		val_reg = rcar_du_crtc_read(rcrtc, DSSR);
+		if(!(val_reg & DSSR_VBK))
+			break;
+		udelay(10);
+	}
+
+	if(!(i > 0))
+		return -ETIMEDOUT;
+
+	/* Stop clock */
+	clk_set_rate(rcrtc->extclock, 0);
+	clk_set_rate(rcrtc->clock, 0);
+
+	return 0;
+}
+
 /* -----------------------------------------------------------------------------
  * CRTC Functions
  */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 59ac6e7..6e0de42 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -99,6 +99,7 @@  enum rcar_du_output {
 
 int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
 			unsigned int hwindex);
+int rcar_du_crtc_standby(struct rcar_du_crtc *rcrtc);
 void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc);
 void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc);