All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
@ 2014-05-22  5:16 Rahul Sharma
  2014-05-22  6:21 ` Sachin Kamat
  0 siblings, 1 reply; 6+ messages in thread
From: Rahul Sharma @ 2014-05-22  5:16 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-samsung-soc, inki.dae, kgene.kim, joshi, r.sh.open, Rahul Sharma

From: Rahul Sharma <Rahul.Sharma@samsung.com>

Fimd probe is accessing fimd Registers without enabling the fimd
gate clocks. If FIMD clocks are kept disabled in Uboot or disbaled
during kernel boottime, the system hangs during boottime.

This issue got surfaced when verifying with sysmmu enabled. Probe of
fimd Sysmmu enables the master clock before accessing sysmmu regs and
then disables. Later fimd probe tries to read the register without
enabling the clock which is wrong and hangs the system.

Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
---
Rebased on exynos-drm-next branch.

 drivers/gpu/drm/exynos/exynos_drm_fimd.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 173ee97..a79ba0a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -891,9 +891,15 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
 	if (ctx->display)
 		exynos_drm_create_enc_conn(drm_dev, ctx->display);
 
+	clk_prepare_enable(ctx->bus_clk);
+	clk_prepare_enable(ctx->lcd_clk);
+
 	for (win = 0; win < WINDOWS_NR; win++)
 		fimd_clear_win(ctx, win);
 
+	clk_disable_unprepare(ctx->lcd_clk);
+	clk_disable_unprepare(ctx->bus_clk);
+
 	return 0;
 
 }
-- 
1.7.9.5

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

* Re: [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
  2014-05-22  5:16 [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers Rahul Sharma
@ 2014-05-22  6:21 ` Sachin Kamat
  2014-05-22  6:36   ` Rahul Sharma
  0 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2014-05-22  6:21 UTC (permalink / raw)
  To: Rahul Sharma
  Cc: dri-devel, linux-samsung-soc, Inki Dae, Kukjin Kim, sunil joshi,
	Rahul Sharma

Hi Rahul,

On 22 May 2014 10:46, Rahul Sharma <rahul.sharma@samsung.com> wrote:
> From: Rahul Sharma <Rahul.Sharma@samsung.com>
>
> Fimd probe is accessing fimd Registers without enabling the fimd
> gate clocks. If FIMD clocks are kept disabled in Uboot or disbaled
> during kernel boottime, the system hangs during boottime.
>
> This issue got surfaced when verifying with sysmmu enabled. Probe of
> fimd Sysmmu enables the master clock before accessing sysmmu regs and
> then disables. Later fimd probe tries to read the register without
> enabling the clock which is wrong and hangs the system.
>
> Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
> ---
> Rebased on exynos-drm-next branch.
>
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 173ee97..a79ba0a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -891,9 +891,15 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
>         if (ctx->display)
>                 exynos_drm_create_enc_conn(drm_dev, ctx->display);
>
> +       clk_prepare_enable(ctx->bus_clk);

Probably a check for its success?

> +       clk_prepare_enable(ctx->lcd_clk);

ditto.

-- 
With warm regards,
Sachin

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

* Re: [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
  2014-05-22  6:21 ` Sachin Kamat
@ 2014-05-22  6:36   ` Rahul Sharma
  2014-05-22  7:01     ` Sachin Kamat
  2014-05-22  8:03     ` Thierry Reding
  0 siblings, 2 replies; 6+ messages in thread
From: Rahul Sharma @ 2014-05-22  6:36 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: dri-devel, linux-samsung-soc, Inki Dae, Kukjin Kim, sunil joshi

On 22 May 2014 11:51, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> Hi Rahul,
[snip]
>>
>> +       clk_prepare_enable(ctx->bus_clk);
>
> Probably a check for its success?
>
>> +       clk_prepare_enable(ctx->lcd_clk);
>

Generally we don't check this in any of the driver. It will be
quite unnecessary.

Regards,
Rahul Sharma

> ditto.
>
> --
> With warm regards,
> Sachin

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

* Re: [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
  2014-05-22  6:36   ` Rahul Sharma
@ 2014-05-22  7:01     ` Sachin Kamat
  2014-05-22  8:03     ` Thierry Reding
  1 sibling, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2014-05-22  7:01 UTC (permalink / raw)
  To: Rahul Sharma
  Cc: dri-devel, linux-samsung-soc, Inki Dae, Kukjin Kim, sunil joshi

On 22 May 2014 12:06, Rahul Sharma <rahul.sharma@samsung.com> wrote:
> On 22 May 2014 11:51, Sachin Kamat <sachin.kamat@linaro.org> wrote:
>> Hi Rahul,
> [snip]
>>>
>>> +       clk_prepare_enable(ctx->bus_clk);
>>
>> Probably a check for its success?
>>
>>> +       clk_prepare_enable(ctx->lcd_clk);
>>
>
> Generally we don't check this in any of the driver. It will be
> quite unnecessary.

However in your case, since you mentioned if the clock is not enabled, it
will hang the system when fimd probe tries to read the register, this check
would ensure it doesn't happen (hang) even if clk_prepare_enable fails for
whatever reasons.

-- 
With warm regards,
Sachin

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

* Re: [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
  2014-05-22  6:36   ` Rahul Sharma
  2014-05-22  7:01     ` Sachin Kamat
@ 2014-05-22  8:03     ` Thierry Reding
  2014-05-22 13:17       ` Rahul Sharma
  1 sibling, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2014-05-22  8:03 UTC (permalink / raw)
  To: Rahul Sharma
  Cc: Sachin Kamat, linux-samsung-soc, Kukjin Kim, sunil joshi, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 587 bytes --]

On Thu, May 22, 2014 at 12:06:16PM +0530, Rahul Sharma wrote:
> On 22 May 2014 11:51, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> > Hi Rahul,
> [snip]
> >>
> >> +       clk_prepare_enable(ctx->bus_clk);
> >
> > Probably a check for its success?
> >
> >> +       clk_prepare_enable(ctx->lcd_clk);
> >
> 
> Generally we don't check this in any of the driver. It will be
> quite unnecessary.

Then those drivers are all buggy. There's a reason why this function
returns an int rather than void. Just because you've never seen it fail
doesn't mean it can't.

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

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

* Re: [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers
  2014-05-22  8:03     ` Thierry Reding
@ 2014-05-22 13:17       ` Rahul Sharma
  0 siblings, 0 replies; 6+ messages in thread
From: Rahul Sharma @ 2014-05-22 13:17 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Sachin Kamat, linux-samsung-soc, Kukjin Kim, sunil joshi, dri-devel

On 22 May 2014 13:33, Thierry Reding <thierry.reding@gmail.com> wrote:
> On Thu, May 22, 2014 at 12:06:16PM +0530, Rahul Sharma wrote:
>> On 22 May 2014 11:51, Sachin Kamat <sachin.kamat@linaro.org> wrote:
>> > Hi Rahul,
>> [snip]
>> >>
>> >> +       clk_prepare_enable(ctx->bus_clk);
>> >
>> > Probably a check for its success?
>> >
>> >> +       clk_prepare_enable(ctx->lcd_clk);
>> >
>>
>> Generally we don't check this in any of the driver. It will be
>> quite unnecessary.
>
> Then those drivers are all buggy. There's a reason why this function
> returns an int rather than void. Just because you've never seen it fail
> doesn't mean it can't.

Okay... I don't mind putting extra checks. V3 is coming :).

Best Regards,
Rahul Sharma

>
> Thierry
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

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

end of thread, other threads:[~2014-05-22 13:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-22  5:16 [PATCH V2] drm/exynos: enable fimd clocks in probe before accessing fimd registers Rahul Sharma
2014-05-22  6:21 ` Sachin Kamat
2014-05-22  6:36   ` Rahul Sharma
2014-05-22  7:01     ` Sachin Kamat
2014-05-22  8:03     ` Thierry Reding
2014-05-22 13:17       ` Rahul Sharma

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.