diff options
author | Thierry Reding <thierry.reding@gmail.com> | 2016-07-25 16:23:39 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2016-07-25 16:23:39 +0200 |
commit | bd2686122d3b45db1398776921bd47fedfd6d6a5 (patch) | |
tree | a4c9e124eefb9da5434e39f628ee732a597d30c5 /include/linux/pwm.h | |
parent | 489babeae6b9386af25fe6dc3bc727a51ff5d962 (diff) | |
parent | 1a366fe9153f445e950a7a344932b7419aa83094 (diff) | |
download | talos-op-linux-bd2686122d3b45db1398776921bd47fedfd6d6a5.tar.gz talos-op-linux-bd2686122d3b45db1398776921bd47fedfd6d6a5.zip |
Merge branch 'for-4.8/capture' into for-next
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 47e66bfb8cb4..f1bbae014889 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -5,7 +5,9 @@ #include <linux/mutex.h> #include <linux/of.h> +struct pwm_capture; struct seq_file; + struct pwm_chip; /** @@ -241,6 +243,7 @@ pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, * @free: optional hook for freeing a PWM * @config: configure duty cycles and period length for this PWM * @set_polarity: configure the polarity of this PWM + * @capture: capture and report PWM signal * @enable: enable PWM output toggling * @disable: disable PWM output toggling * @apply: atomically apply a new PWM config. The state argument @@ -260,6 +263,8 @@ struct pwm_ops { int duty_ns, int period_ns); int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm, enum pwm_polarity polarity); + int (*capture)(struct pwm_chip *chip, struct pwm_device *pwm, + struct pwm_capture *result, unsigned long timeout); int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm); void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm); int (*apply)(struct pwm_chip *chip, struct pwm_device *pwm, @@ -300,6 +305,16 @@ struct pwm_chip { bool can_sleep; }; +/** + * struct pwm_capture - PWM capture data + * @period: period of the PWM signal (in nanoseconds) + * @duty_cycle: duty cycle of the PWM signal (in nanoseconds) + */ +struct pwm_capture { + unsigned int period; + unsigned int duty_cycle; +}; + #if IS_ENABLED(CONFIG_PWM) /* PWM user APIs */ struct pwm_device *pwm_request(int pwm_id, const char *label); @@ -412,6 +427,8 @@ static inline void pwm_disable(struct pwm_device *pwm) } /* PWM provider APIs */ +int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result, + unsigned long timeout); int pwm_set_chip_data(struct pwm_device *pwm, void *data); void *pwm_get_chip_data(struct pwm_device *pwm); @@ -463,6 +480,13 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns, return -EINVAL; } +static inline int pwm_capture(struct pwm_device *pwm, + struct pwm_capture *result, + unsigned long timeout) +{ + return -EINVAL; +} + static inline int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity) { |