diff mbox

[3/9] ARM: mxc: pwm: convert to clk_prepare/clk_unprepare

Message ID 1320900854-13031-3-git-send-email-richard.zhao@linaro.org
State Changes Requested
Headers show

Commit Message

Richard Zhao Nov. 10, 2011, 4:54 a.m. UTC
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/pwm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 42d74ea..3371698 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -118,9 +118,13 @@  int pwm_enable(struct pwm_device *pwm)
 	int rc = 0;
 
 	if (!pwm->clk_enabled) {
-		rc = clk_enable(pwm->clk);
+		rc = clk_prepare(pwm->clk);
 		if (!rc)
+			rc = clk_enable(pwm->clk);
+		if (!rc) {
 			pwm->clk_enabled = 1;
+		} else
+			clk_unprepare(pwm->clk);
 	}
 	return rc;
 }
@@ -132,6 +136,7 @@  void pwm_disable(struct pwm_device *pwm)
 
 	if (pwm->clk_enabled) {
 		clk_disable(pwm->clk);
+		clk_unprepare(pwm->clk);
 		pwm->clk_enabled = 0;
 	}
 }