summaryrefslogtreecommitdiff
path: root/include/pwm.h
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-03-30 16:57:09 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-31 09:48:34 +0200
commit2c1df3a6df7d99d96bcb353070bad45d16c8fb31 (patch)
tree95edc55d3b7f1383ce1f91d8e9fa2ea5a20bbf66 /include/pwm.h
parent4d46eeaac14239aa82d09d1c75a56f1785e1d425 (diff)
downloadbarebox-2c1df3a6df7d99d96bcb353070bad45d16c8fb31.tar.gz
PWM: core: group PWM state into new struct pwm_state
As a prerequisite for moving to the new apply API, we need to group all state into one struct that we can apply at once. Prepare for this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/pwm.h')
-rw-r--r--include/pwm.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/include/pwm.h b/include/pwm.h
index 9897e86545..c0ce414cb5 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -37,6 +37,18 @@ unsigned int pwm_get_period(struct pwm_device *pwm);
struct pwm_chip;
+/*
+ * struct pwm_state - state of a PWM channel
+ * @period_ns: PWM period (in nanoseconds)
+ * @duty_ns: PWM duty cycle (in nanoseconds)
+ * @p_enable: PWM enabled status
+ */
+struct pwm_state {
+ unsigned int period_ns;
+ unsigned int duty_ns;
+ unsigned int p_enable;
+};
+
/**
* struct pwm_ops - PWM operations
* @request: optional hook for requesting a PWM
@@ -59,17 +71,14 @@ struct pwm_ops {
* @id: The id of this pwm
* @devname: unique identifier for this pwm
* @ops: The callbacks for this PWM
- * @duty_ns: The duty cycle of the PWM, in nano-seconds
- * @period_ns: The period of the PWM, in nano-seconds
- * @p_enable: whether the PWM is enabled
+ * @state: current state of the PWM
*/
struct pwm_chip {
int id;
const char *devname;
const struct pwm_ops *ops;
- int duty_ns;
- int period_ns;
- int p_enable;
+
+ struct pwm_state state;
};
int pwmchip_add(struct pwm_chip *chip, struct device_d *dev);