diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-07-01 10:21:49 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-07-20 09:51:27 +0200 |
commit | 011e76314818b6a24d5347b2d83b8a577e6aaae6 (patch) | |
tree | e9acaad5ccd095ba7c3a03e706556a3d600273aa /include/linux/pwm.h | |
parent | a1cf42171a2e3c33cbc12bb037795caf0589149b (diff) |
pwm: Add pwm_get_polarity() helper function
Some drivers are directly accessing the ->polarity field in pwm_device.
Add a helper to retrieve the current polarity so that we can easily move
this field elsewhere (required to support atomic update).
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 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index d8f691339a45..6f286df30021 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -124,6 +124,11 @@ static inline unsigned int pwm_get_duty_cycle(const struct pwm_device *pwm) */ int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity); +static inline enum pwm_polarity pwm_get_polarity(const struct pwm_device *pwm) +{ + return pwm ? pwm->polarity : PWM_POLARITY_NORMAL; +} + /** * struct pwm_ops - PWM controller operations * @request: optional hook for requesting a PWM |