]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/pwm.h
Merge remote-tracking branch 'regulator/fix/doc' into tmp
[karo-tx-linux.git] / include / linux / pwm.h
index 6d661f32e0e4675681cf8fd3b1284e6a684b6dbe..a4df2042b79c15f75bf53dd8d185fd6c80426b05 100644 (file)
@@ -146,6 +146,8 @@ struct pwm_ops {
  * @base: number of first PWM controlled by this chip
  * @npwm: number of PWMs controlled by this chip
  * @pwms: array of PWM devices allocated by the framework
+ * @can_sleep: must be true if the .config(), .enable() or .disable()
+ *             operations may sleep
  */
 struct pwm_chip {
        struct device           *dev;
@@ -159,6 +161,7 @@ struct pwm_chip {
        struct pwm_device *     (*of_xlate)(struct pwm_chip *pc,
                                            const struct of_phandle_args *args);
        unsigned int            of_pwm_n_cells;
+       bool                    can_sleep;
 };
 
 #if IS_ENABLED(CONFIG_PWM)
@@ -174,11 +177,16 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
 struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
                const struct of_phandle_args *args);
 
-struct pwm_device *pwm_get(struct device *dev, const char *consumer);
+struct pwm_device *pwm_get(struct device *dev, const char *con_id);
+struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
 void pwm_put(struct pwm_device *pwm);
 
-struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer);
+struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
+struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
+                                  const char *con_id);
 void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
+
+bool pwm_can_sleep(struct pwm_device *pwm);
 #else
 static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
 {
@@ -213,6 +221,12 @@ static inline struct pwm_device *pwm_get(struct device *dev,
        return ERR_PTR(-ENODEV);
 }
 
+static inline struct pwm_device *of_pwm_get(struct device_node *np,
+                                           const char *con_id)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 static inline void pwm_put(struct pwm_device *pwm)
 {
 }
@@ -223,9 +237,21 @@ static inline struct pwm_device *devm_pwm_get(struct device *dev,
        return ERR_PTR(-ENODEV);
 }
 
+static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
+                                                struct device_node *np,
+                                                const char *con_id)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
 {
 }
+
+static inline bool pwm_can_sleep(struct pwm_device *pwm)
+{
+       return false;
+}
 #endif
 
 struct pwm_lookup {