ARM: SAMSUNG: Add clk enable/disable of pwm
authorJoonyoung Shim <jy0922.shim@samsung.com>
Fri, 4 Nov 2011 01:39:34 +0000 (10:39 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Sun, 6 Nov 2011 04:53:01 +0000 (13:53 +0900)
PWM timers use pclk("timers" clk) as parent clk. If this pclk is the
disabled state when PWM driver is probed, then it causes wrong read and
write operation about registers of PWM.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/plat-samsung/pwm.c

index f37457c52064f77b5e58139a2eb0008f695d905c..dc1185dcf80d559757d289f4490723888786c2fa 100644 (file)
@@ -299,6 +299,9 @@ static int s3c_pwm_probe(struct platform_device *pdev)
                goto err_clk_tin;
        }
 
+       clk_enable(pwm->clk);
+       clk_enable(pwm->clk_div);
+
        local_irq_save(flags);
 
        tcon = __raw_readl(S3C2410_TCON);
@@ -326,6 +329,8 @@ static int s3c_pwm_probe(struct platform_device *pdev)
        return 0;
 
  err_clk_tdiv:
+       clk_disable(pwm->clk_div);
+       clk_disable(pwm->clk);
        clk_put(pwm->clk_div);
 
  err_clk_tin:
@@ -340,6 +345,8 @@ static int __devexit s3c_pwm_remove(struct platform_device *pdev)
 {
        struct pwm_device *pwm = platform_get_drvdata(pdev);
 
+       clk_disable(pwm->clk_div);
+       clk_disable(pwm->clk);
        clk_put(pwm->clk_div);
        clk_put(pwm->clk);
        kfree(pwm);