diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-04-14 21:17:39 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2016-05-17 14:48:02 +0200 |
commit | 09a7e4a3d9fcb95ade2cb02167e85fbeb8315ce0 (patch) | |
tree | ae68e6ab54506c65b510d83aeda3c94906a7faca /include/linux/pwm.h | |
parent | 43a276b003ed2e03de9d94b02a1ba49c1849b931 (diff) | |
download | talos-obmc-linux-09a7e4a3d9fcb95ade2cb02167e85fbeb8315ce0.tar.gz talos-obmc-linux-09a7e4a3d9fcb95ade2cb02167e85fbeb8315ce0.zip |
pwm: Move the enabled/disabled info into pwm_state
Prepare the transition to PWM atomic update by moving the enabled and
disabled state into the pwm_state struct. This way we can easily update
the whole PWM state by copying the new state in the ->state field.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 51d4005418f9..150563a806d6 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -94,8 +94,7 @@ struct pwm_args { enum { PWMF_REQUESTED = 1 << 0, - PWMF_ENABLED = 1 << 1, - PWMF_EXPORTED = 1 << 2, + PWMF_EXPORTED = 1 << 1, }; /* @@ -103,11 +102,13 @@ enum { * @period: PWM period (in nanoseconds) * @duty_cycle: PWM duty cycle (in nanoseconds) * @polarity: PWM polarity + * @enabled: PWM enabled status */ struct pwm_state { unsigned int period; unsigned int duty_cycle; enum pwm_polarity polarity; + bool enabled; }; /** @@ -146,7 +147,11 @@ static inline void pwm_get_state(const struct pwm_device *pwm, static inline bool pwm_is_enabled(const struct pwm_device *pwm) { - return test_bit(PWMF_ENABLED, &pwm->flags); + struct pwm_state state; + + pwm_get_state(pwm, &state); + + return state.enabled; } static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) |