Skip to contentSkip to conversation

drm/exynos: enable FIMD clocks

PATCH Superseded Vikas Sajjan 3 participants 5 messages Apr 1, 2013 – Apr 22, 2013

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/exynos: enable FIMD clocks

While migrating to common clock framework (CCF), found that the FIMD clocks were pulled down by the CCF.
If CCF finds any clock(s) which has NOT been claimed by any of the drivers, then such clock(s) are PULLed low by CCF.

By calling clk_prepare_enable() for FIMD clocks fixes the issue.

this patch also replaces clk_disable() with clk_disable_unprepare() during exit.

---
Changes since v2:
- moved clk_prepare_enable() and clk_disable_unprepare() from fimd_probe() to fimd_clock() as suggested by Inki Dae <[email protected]>
Changes since v1:
- added error checking for clk_prepare_enable() and also replaced clk_disable() with clk_disable_unprepare() during exit.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -7
index 9537761..f2400c8 100644
@@ -799,18 +799,18 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)
 	if (enable) {
 		int ret;
 
-		ret = clk_enable(ctx->bus_clk);
+		ret = clk_prepare_enable(ctx->bus_clk);
 		if (ret < 0)
 			return ret;
 
-		ret = clk_enable(ctx->lcd_clk);
+		ret = clk_prepare_enable(ctx->lcd_clk);
 		if  (ret < 0) {
-			clk_disable(ctx->bus_clk);
+			clk_disable_unprepare(ctx->bus_clk);
 			return ret;
 		}
 	} else {
-		clk_disable(ctx->lcd_clk);
-		clk_disable(ctx->bus_clk);
+		clk_disable_unprepare(ctx->lcd_clk);
+		clk_disable_unprepare(ctx->bus_clk);
 	}
 
 	return 0;
@@ -981,8 +981,8 @@ static int fimd_remove(struct platform_device *pdev)
 	if (ctx->suspended)
 		goto out;
 
-	clk_disable(ctx->lcd_clk);
-	clk_disable(ctx->bus_clk);
+	clk_disable_unprepare(ctx->lcd_clk);
+	clk_disable_unprepare(ctx->bus_clk);
 
 	pm_runtime_set_suspended(dev);
 	pm_runtime_put_sync(dev);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · Vikas Sajjan

While migrating to common clock framework (CCF), found that the FIMD clocks

s/found/we found/

Quoted 5 lines

were pulled down by the CCF.
If CCF finds any clock(s) which has NOT been claimed by any of the drivers, then such clock(s) are PULLed low by CCF.

By calling clk_prepare_enable() for FIMD clocks fixes the issue.

s/By calling/Calling/

and

s/the/this

Quoted 1 line

this patch also replaces clk_disable() with clk_disable_unprepare()

s/this/This

Quoted 1 line

during exit.

Sorry but your log doesn't say what you are doing. You are just adding relevant calls to clk_prepare/unprepare() before calling clk_enable/disable.

Quoted 41 lines

---
Changes since v2:
- moved clk_prepare_enable() and clk_disable_unprepare() from fimd_probe() to fimd_clock() as suggested by Inki Dae <[email protected]>
Changes since v1:
- added error checking for clk_prepare_enable() and also replaced clk_disable() with clk_disable_unprepare() during exit.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -5
index 9537761..f2400c8 100644
@@ -799,18 +799,18 @@ static int fimd_clock(struct fimd_context *ctx, bool enable)
        if (enable) {
                int ret;
 
-               ret = clk_enable(ctx->bus_clk);
+               ret = clk_prepare_enable(ctx->bus_clk);
                if (ret < 0)
                        return ret;
 
-               ret = clk_enable(ctx->lcd_clk);
+               ret = clk_prepare_enable(ctx->lcd_clk);
                if  (ret < 0) {
-                       clk_disable(ctx->bus_clk);
+                       clk_disable_unprepare(ctx->bus_clk);
                        return ret;
                }
        } else {
-               clk_disable(ctx->lcd_clk);
-               clk_disable(ctx->bus_clk);
+               clk_disable_unprepare(ctx->lcd_clk);
+               clk_disable_unprepare(ctx->bus_clk);
        }
 
        return 0;

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_remove(struct platform_device *pdev) · line 985

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
@@ -981,8 +981,8 @@ static int fimd_remove(struct platform_device *pdev)
        if (ctx->suspended)
                goto out;
 
-       clk_disable(ctx->lcd_clk);
-       clk_disable(ctx->bus_clk);
+       clk_disable_unprepare(ctx->lcd_clk);
+       clk_disable_unprepare(ctx->bus_clk);

You are doing things at the right place but i have a suggestion. Are you doing anything in your clk_prepare() atleast for this device? Probably not.

If not, then its better to call clk_prepare/unprepare only once at probe/remove and keep clk_enable/disable calls as is.

--
viresh

maintainer
#2 lore raw

Hi, Mr. Vikas

Please fix the below typos Viresh pointed out and my comments.

Quoted 37 lines

-----Original Message-----
From: Viresh Kumar [mailto:[email protected]]
Sent: Monday, April 01, 2013 5:51 PM
To: Vikas Sajjan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] drm/exynos: enable FIMD clocks

Quoted 1 line · Vikas Sajjan

While migrating to common clock framework (CCF), found that the FIMD

clocks

s/found/we found/

Quoted 5 lines

were pulled down by the CCF.
If CCF finds any clock(s) which has NOT been claimed by any of the drivers, then such clock(s) are PULLed low by CCF.

By calling clk_prepare_enable() for FIMD clocks fixes the issue.

s/By calling/Calling/

and

s/the/this

Quoted 1 line

this patch also replaces clk_disable() with clk_disable_unprepare()

s/this/This

Quoted 1 line

during exit.

Sorry but your log doesn't say what you are doing. You are just adding relevant calls to clk_prepare/unprepare() before calling clk_enable/disable.

Quoted 8 lines
Quoted 5 lines

---
Changes since v2:
- moved clk_prepare_enable() and clk_disable_unprepare() from fimd_probe() to fimd_clock() as suggested by Inki Dae

<[email protected]>

Quoted 2 lines

Changes since v1:
- added error checking for clk_prepare_enable() and also

replaced

Quoted 39 lines

Review

Quoted 6 lines

clk_disable() with clk_disable_unprepare() during exit.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/exynos/exynos_drm_fimd.c

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_clock(struct fimd_context *ctx,

Quoted 4 lines

index 9537761..f2400c8 100644

drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
@@ -799,18 +799,18 @@ static int fimd_clock(struct fimd_context *ctx,

bool enable)

Quoted 27 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -5
        if (enable) {
                int ret;
 
-               ret = clk_enable(ctx->bus_clk);
+               ret = clk_prepare_enable(ctx->bus_clk);
                if (ret < 0)
                        return ret;
 
-               ret = clk_enable(ctx->lcd_clk);
+               ret = clk_prepare_enable(ctx->lcd_clk);
                if  (ret < 0) {
-                       clk_disable(ctx->bus_clk);
+                       clk_disable_unprepare(ctx->bus_clk);
                        return ret;
                }
        } else {
-               clk_disable(ctx->lcd_clk);
-               clk_disable(ctx->bus_clk);
+               clk_disable_unprepare(ctx->lcd_clk);
+               clk_disable_unprepare(ctx->bus_clk);
        }
 
        return 0;
@@ -981,8 +981,8 @@ static int fimd_remove(struct platform_device *pdev)
        if (ctx->suspended)
                goto out;
 
Quoted 4 lines

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_clock(struct fimd_context *ctx, bool enable) · line 813

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
-       clk_disable(ctx->lcd_clk);
-       clk_disable(ctx->bus_clk);
+       clk_disable_unprepare(ctx->lcd_clk);
+       clk_disable_unprepare(ctx->bus_clk);

Just remove the above codes. It seems that clk_disable(also clk_disable_unprepare) isn't needed because it will be done by pm_runtime_put_sync and please re-post it(probably patch v5??)

Thanks,
Inki Dae

Quoted 11 lines

You are doing things at the right place but i have a suggestion. Are you doing
anything in your clk_prepare() atleast for this device? Probably not.

If not, then its better to call clk_prepare/unprepare only once at probe/remove
and keep clk_enable/disable calls as is.

--
viresh

#3 lore raw

Hi Mr Dae,

Quoted 42 lines · Inki Dae

Hi, Mr. Vikas

Please fix the below typos Viresh pointed out and my comments.

Quoted 37 lines

-----Original Message-----
From: Viresh Kumar [mailto:[email protected]]
Sent: Monday, April 01, 2013 5:51 PM
To: Vikas Sajjan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] drm/exynos: enable FIMD clocks

Quoted 1 line · Vikas Sajjan

While migrating to common clock framework (CCF), found that the FIMD

clocks

s/found/we found/

Quoted 5 lines

were pulled down by the CCF.
If CCF finds any clock(s) which has NOT been claimed by any of the drivers, then such clock(s) are PULLed low by CCF.

By calling clk_prepare_enable() for FIMD clocks fixes the issue.

s/By calling/Calling/

and

s/the/this

Quoted 1 line

this patch also replaces clk_disable() with clk_disable_unprepare()

s/this/This

Quoted 1 line

during exit.

Sorry but your log doesn't say what you are doing. You are just adding relevant calls to clk_prepare/unprepare() before calling clk_enable/disable.

I shall modify the commit message as below as suggested by tomaz figa,

" Common Clock Framework introduced the need to prepare clocks before
enabling them, otherwise clk_enable() fails. This patch adds clk_prepare calls to the driver. This patch also removes clk_disable() from fimd_remove() as it will be done by pm_runtime_put_sync".

Quoted 54 lines
Quoted 8 lines
Quoted 5 lines

---
Changes since v2:
- moved clk_prepare_enable() and clk_disable_unprepare() from fimd_probe() to fimd_clock() as suggested by Inki Dae

<[email protected]>

Quoted 2 lines

Changes since v1:
- added error checking for clk_prepare_enable() and also

replaced

Quoted 34 lines

Review

Quoted 6 lines

clk_disable() with clk_disable_unprepare() during exit.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/exynos/exynos_drm_fimd.c

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_clock(struct fimd_context *ctx,

Quoted 4 lines

index 9537761..f2400c8 100644

drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
@@ -799,18 +799,18 @@ static int fimd_clock(struct fimd_context *ctx,

bool enable)

Quoted 22 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -5
        if (enable) {
                int ret;
 
-               ret = clk_enable(ctx->bus_clk);
+               ret = clk_prepare_enable(ctx->bus_clk);
                if (ret < 0)
                        return ret;
 
-               ret = clk_enable(ctx->lcd_clk);
+               ret = clk_prepare_enable(ctx->lcd_clk);
                if  (ret < 0) {
-                       clk_disable(ctx->bus_clk);
+                       clk_disable_unprepare(ctx->bus_clk);
                        return ret;
                }
        } else {
-               clk_disable(ctx->lcd_clk);
-               clk_disable(ctx->bus_clk);
+               clk_disable_unprepare(ctx->lcd_clk);
+               clk_disable_unprepare(ctx->bus_clk);
        }
 
Quoted 2 lines

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_remove(struct platform_device

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
        return 0;
@@ -981,8 +981,8 @@ static int fimd_remove(struct platform_device

*pdev)

Quoted 7 lines

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_remove(struct platform_device *pdev) · line 985

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
        if (ctx->suspended)
                goto out;
 
-       clk_disable(ctx->lcd_clk);
-       clk_disable(ctx->bus_clk);
+       clk_disable_unprepare(ctx->lcd_clk);
+       clk_disable_unprepare(ctx->bus_clk);
Quoted 5 lines

Just remove the above codes. It seems that clk_disable(also clk_disable_unprepare) isn't needed because it will be done by pm_runtime_put_sync and please re-post it(probably patch v5??)

So you mean I should work on v3 version, and keep the

clk_prepare_enable() code as is in fimd_clock() and just remove the clk_disable_unprepare() and also clk_disable() from fimd_remove(), right?

Viresh and Tomaz Figa, let me know if these changes are fine with you guys.

Thanks,

Quoted 15 lines

Inki Dae

Quoted 11 lines

You are doing things at the right place but i have a suggestion. Are you doing
anything in your clk_prepare() atleast for this device? Probably not.

If not, then its better to call clk_prepare/unprepare only once at probe/remove
and keep clk_enable/disable calls as is.

--
viresh

Signature · 2 lines
Thanks and Regards
 Vikas Sajjan

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#4 lore raw

2013/4/22 Vikas Sajjan <[email protected]>

Quoted 110 lines

Hi Mr Dae,

Quoted 42 lines · Inki Dae

Hi, Mr. Vikas

Please fix the below typos Viresh pointed out and my comments.

Quoted 37 lines

-----Original Message-----
From: Viresh Kumar [mailto:[email protected]]
Sent: Monday, April 01, 2013 5:51 PM
To: Vikas Sajjan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] drm/exynos: enable FIMD clocks

Quoted 1 line · Vikas Sajjan

While migrating to common clock framework (CCF), found that the FIMD

clocks

s/found/we found/

Quoted 5 lines

were pulled down by the CCF.
If CCF finds any clock(s) which has NOT been claimed by any of the drivers, then such clock(s) are PULLed low by CCF.

By calling clk_prepare_enable() for FIMD clocks fixes the issue.

s/By calling/Calling/

and

s/the/this

Quoted 1 line

this patch also replaces clk_disable() with clk_disable_unprepare()

s/this/This

Quoted 1 line

during exit.

Sorry but your log doesn't say what you are doing. You are just adding relevant calls to clk_prepare/unprepare() before calling clk_enable/disable.

I shall modify the commit message as below as suggested by tomaz figa,

" Common Clock Framework introduced the need to prepare clocks before
enabling them, otherwise clk_enable() fails. This patch adds clk_prepare calls to the driver. This patch also removes clk_disable() from fimd_remove() as it will be done by pm_runtime_put_sync".

Quoted 54 lines
Quoted 8 lines
Quoted 5 lines

---
Changes since v2:
- moved clk_prepare_enable() and clk_disable_unprepare() from fimd_probe() to fimd_clock() as suggested by Inki Dae

<[email protected]>

Quoted 2 lines

Changes since v1:
- added error checking for clk_prepare_enable() and also

replaced

Quoted 34 lines

Review

Quoted 6 lines

clk_disable() with clk_disable_unprepare() during exit.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/exynos/exynos_drm_fimd.c

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_clock(struct fimd_context *ctx,

Quoted 4 lines

index 9537761..f2400c8 100644

drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
@@ -799,18 +799,18 @@ static int fimd_clock(struct fimd_context *ctx,

bool enable)

Quoted 22 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -5
        if (enable) {
                int ret;
 
-               ret = clk_enable(ctx->bus_clk);
+               ret = clk_prepare_enable(ctx->bus_clk);
                if (ret < 0)
                        return ret;
 
-               ret = clk_enable(ctx->lcd_clk);
+               ret = clk_prepare_enable(ctx->lcd_clk);
                if  (ret < 0) {
-                       clk_disable(ctx->bus_clk);
+                       clk_disable_unprepare(ctx->bus_clk);
                        return ret;
                }
        } else {
-               clk_disable(ctx->lcd_clk);
-               clk_disable(ctx->bus_clk);
+               clk_disable_unprepare(ctx->lcd_clk);
+               clk_disable_unprepare(ctx->bus_clk);
        }
 
Quoted 2 lines

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int fimd_remove(struct platform_device

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
        return 0;
@@ -981,8 +981,8 @@ static int fimd_remove(struct platform_device

*pdev)

Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
        if (ctx->suspended)
                goto out;
 
-       clk_disable(ctx->lcd_clk);
-       clk_disable(ctx->bus_clk);
+       clk_disable_unprepare(ctx->lcd_clk);
+       clk_disable_unprepare(ctx->bus_clk);
Quoted 9 lines
Quoted 5 lines

Just remove the above codes. It seems that clk_disable(also clk_disable_unprepare) isn't needed because it will be done by pm_runtime_put_sync and please re-post it(probably patch v5??)

So you mean I should work on v3 version, and keep the

clk_prepare_enable() code as is in fimd_clock() and just remove the clk_disable_unprepare() and also clk_disable() from fimd_remove(), right?

Right, please post it. And adding clk_enable() to probe() is another issue so this could be discussed later. As is this patch is needed for CCF support.

Quoted 20 lines

Viresh and Tomaz Figa, let me know if these changes are fine with you guys.

Thanks,

Quoted 15 lines

Inki Dae

Quoted 11 lines

You are doing things at the right place but i have a suggestion. Are you doing
anything in your clk_prepare() atleast for this device? Probably not.

If not, then its better to call clk_prepare/unprepare only once at probe/remove
and keep clk_enable/disable calls as is.

--
viresh

Quoted 10 lines

--
Thanks and Regards
Vikas Sajjan

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel