UPSTREAM: pwm: Move the enabled/disabled info into pwm_state
[firefly-linux-kernel-4.4.55.git] / include / linux / pwm.h
index c17399a3b65433de7b15734092ee58dc7c68e629..c8348cd121211505103d378f08fbec45a4ebe998 100644 (file)
@@ -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)