diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-07-01 04:21:47 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-07-20 03:46:06 -0400 |
commit | 5c31252c4a86dc591c23f1a951edd52ad791ef0e (patch) | |
tree | 4a955e92027bbf95cd5fc9222245c0e4c8810a43 /drivers/pwm/pwm-bcm-kona.c | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
pwm: Add the pwm_is_enabled() helper
Some PWM drivers are testing the PWMF_ENABLED flag. Create a helper
function to hide the logic behind enabled test. This will allow us to
smoothly move from the current approach to an atomic PWM update
approach.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-bcm-kona.c')
-rw-r--r-- | drivers/pwm/pwm-bcm-kona.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c index 7af8fea2dc5b..dfdcf88279ae 100644 --- a/drivers/pwm/pwm-bcm-kona.c +++ b/drivers/pwm/pwm-bcm-kona.c | |||
@@ -134,7 +134,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
134 | } | 134 | } |
135 | 135 | ||
136 | /* If the PWM channel is enabled, write the settings to the HW */ | 136 | /* If the PWM channel is enabled, write the settings to the HW */ |
137 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 137 | if (pwm_is_enabled(pwm)) { |
138 | value = readl(kp->base + PRESCALE_OFFSET); | 138 | value = readl(kp->base + PRESCALE_OFFSET); |
139 | value &= ~PRESCALE_MASK(chan); | 139 | value &= ~PRESCALE_MASK(chan); |
140 | value |= prescale << PRESCALE_SHIFT(chan); | 140 | value |= prescale << PRESCALE_SHIFT(chan); |
@@ -287,7 +287,7 @@ static int kona_pwmc_remove(struct platform_device *pdev) | |||
287 | unsigned int chan; | 287 | unsigned int chan; |
288 | 288 | ||
289 | for (chan = 0; chan < kp->chip.npwm; chan++) | 289 | for (chan = 0; chan < kp->chip.npwm; chan++) |
290 | if (test_bit(PWMF_ENABLED, &kp->chip.pwms[chan].flags)) | 290 | if (pwm_is_enabled(&kp->chip.pwms[chan])) |
291 | clk_disable_unprepare(kp->clk); | 291 | clk_disable_unprepare(kp->clk); |
292 | 292 | ||
293 | return pwmchip_remove(&kp->chip); | 293 | return pwmchip_remove(&kp->chip); |