diff mbox

gpu: ipu-v3: pre: only use internal clock gating

Message ID 20170502153808.4418-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach May 2, 2017, 3:38 p.m. UTC
By setting the SFTRST bit, the PRE will be held in the lowest power state
with clocks to the internal blocks gated. When external clock gating is
used (from the external clock controller, or by setting the CLKGATE bit)
the PRE will sporadically fail to start.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
This is a fix for newly introduced functionality and should be applied
for 4.12 fixes.
---
 drivers/gpu/ipu-v3/ipu-pre.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Philipp Zabel May 3, 2017, 8:16 a.m. UTC | #1
On Tue, 2017-05-02 at 17:38 +0200, Lucas Stach wrote:
> By setting the SFTRST bit, the PRE will be held in the lowest power state
> with clocks to the internal blocks gated. When external clock gating is
> used (from the external clock controller, or by setting the CLKGATE bit)
> the PRE will sporadically fail to start.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> This is a fix for newly introduced functionality and should be applied
> for 4.12 fixes.
> ---
>  drivers/gpu/ipu-v3/ipu-pre.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/ipu-v3/ipu-pre.c b/drivers/gpu/ipu-v3/ipu-pre.c
> index c55563379e2e..e2f6acf42792 100644
> --- a/drivers/gpu/ipu-v3/ipu-pre.c
> +++ b/drivers/gpu/ipu-v3/ipu-pre.c
> @@ -131,8 +131,6 @@ int ipu_pre_get(struct ipu_pre *pre)
>  	if (pre->in_use)
>  		return -EBUSY;
>  
> -	clk_prepare_enable(pre->clk_axi);
> -
>  	/* first get the engine out of reset and remove clock gating */
>  	writel(0, pre->regs + IPU_PRE_CTRL);
>  
> @@ -149,12 +147,7 @@ int ipu_pre_get(struct ipu_pre *pre)
>  
>  void ipu_pre_put(struct ipu_pre *pre)
>  {
> -	u32 val;
> -
> -	val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE;
> -	writel(val, pre->regs + IPU_PRE_CTRL);
> -
> -	clk_disable_unprepare(pre->clk_axi);
> +	writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL);
>  
>  	pre->in_use = false;
>  }
> @@ -249,6 +242,8 @@ static int ipu_pre_probe(struct platform_device *pdev)
>  	if (!pre->buffer_virt)
>  		return -ENOMEM;
>  
> +	clk_prepare_enable(pre->clk_axi);
> +
>  	pre->dev = dev;
>  	platform_set_drvdata(pdev, pre);
>  	mutex_lock(&ipu_pre_list_mutex);

Why is there no matching clk_disable_unprepare in ipu_pre_remove?

regards
Philipp
diff mbox

Patch

diff --git a/drivers/gpu/ipu-v3/ipu-pre.c b/drivers/gpu/ipu-v3/ipu-pre.c
index c55563379e2e..e2f6acf42792 100644
--- a/drivers/gpu/ipu-v3/ipu-pre.c
+++ b/drivers/gpu/ipu-v3/ipu-pre.c
@@ -131,8 +131,6 @@  int ipu_pre_get(struct ipu_pre *pre)
 	if (pre->in_use)
 		return -EBUSY;
 
-	clk_prepare_enable(pre->clk_axi);
-
 	/* first get the engine out of reset and remove clock gating */
 	writel(0, pre->regs + IPU_PRE_CTRL);
 
@@ -149,12 +147,7 @@  int ipu_pre_get(struct ipu_pre *pre)
 
 void ipu_pre_put(struct ipu_pre *pre)
 {
-	u32 val;
-
-	val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE;
-	writel(val, pre->regs + IPU_PRE_CTRL);
-
-	clk_disable_unprepare(pre->clk_axi);
+	writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL);
 
 	pre->in_use = false;
 }
@@ -249,6 +242,8 @@  static int ipu_pre_probe(struct platform_device *pdev)
 	if (!pre->buffer_virt)
 		return -ENOMEM;
 
+	clk_prepare_enable(pre->clk_axi);
+
 	pre->dev = dev;
 	platform_set_drvdata(pdev, pre);
 	mutex_lock(&ipu_pre_list_mutex);