]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
authorPhilip, Avinash <avinashphilip@ti.com>
Thu, 10 Jan 2013 13:05:26 +0000 (18:35 +0530)
committerThierry Reding <thierry.reding@avionic-design.de>
Mon, 14 Jan 2013 07:12:27 +0000 (08:12 +0100)
The clock framework has changed and it's now better to invoke
clock_prepare_enable() and clk_disable_unprepare() rather than the
legacy clk_enable() and clk_disable() calls. This patch converts the
pwm-tiehrpwm driver to the new framework.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
drivers/pwm/pwm-tiehrpwm.c

index 72a6dd40c9ec5a566ccdffaffe69d8d4cc13f0af..4fcafbfba60e042f7f8fd8c1453bfc976f372805 100644 (file)
@@ -318,6 +318,7 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
        struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
        unsigned short aqcsfrc_val, aqcsfrc_mask;
+       int ret;
 
        /* Leave clock enabled on enabling PWM */
        pm_runtime_get_sync(chip->dev);
@@ -341,7 +342,12 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
        configure_polarity(pc, pwm->hwpwm);
 
        /* Enable TBCLK before enabling PWM device */
-       clk_enable(pc->tbclk);
+       ret = clk_prepare_enable(pc->tbclk);
+       if (ret) {
+               pr_err("Failed to enable TBCLK for %s\n",
+                               dev_name(pc->chip.dev));
+               return ret;
+       }
 
        /* Enable time counter for free_run */
        ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_FREE_RUN);
@@ -372,7 +378,7 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
        ehrpwm_modify(pc->mmio_base, AQCSFRC, aqcsfrc_mask, aqcsfrc_val);
 
        /* Disabling TBCLK on PWM disable */
-       clk_disable(pc->tbclk);
+       clk_disable_unprepare(pc->tbclk);
 
        /* Stop Time base counter */
        ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_STOP_NEXT);