All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpu: ipu-v3: pre: only use internal clock gating
@ 2017-05-02 15:38 Lucas Stach
  2017-05-03  8:16 ` Philipp Zabel
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2017-05-02 15:38 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: kernel, dri-devel, patchwork-lst

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);
-- 
2.11.0

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

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

* Re: [PATCH] gpu: ipu-v3: pre: only use internal clock gating
  2017-05-02 15:38 [PATCH] gpu: ipu-v3: pre: only use internal clock gating Lucas Stach
@ 2017-05-03  8:16 ` Philipp Zabel
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2017-05-03  8:16 UTC (permalink / raw)
  To: Lucas Stach; +Cc: kernel, dri-devel, patchwork-lst

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

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

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

end of thread, other threads:[~2017-05-03  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 15:38 [PATCH] gpu: ipu-v3: pre: only use internal clock gating Lucas Stach
2017-05-03  8:16 ` Philipp Zabel

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.