summaryrefslogtreecommitdiff
path: root/include/pwm.h
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2017-04-24 02:27:49 (GMT)
committerSimon Glass <sjg@chromium.org>2017-05-10 19:37:21 (GMT)
commit0b60111aa66f51d05473a375070ca72d073a6fd3 (patch)
tree48068d473dd00ed00a70b4a68cc956a04f049a62 /include/pwm.h
parenta66726838e9227ea8b9c6a1402d6ca89384c1b56 (diff)
downloadu-boot-fsl-qoriq-0b60111aa66f51d05473a375070ca72d073a6fd3.tar.xz
power: regulator: pwm: support pwm polarity setting
The latest kernel PWM drivers enable the polarity settings. When system run from U-Boot to kerenl, if there are differences in polarity set or duty cycle, the PMW will re-init: close -> set polarity and duty cycle -> enable the PWM. The power supply controled by pwm regulator may have voltage shaking, which lead to the system not stable. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/pwm.h')
-rw-r--r--include/pwm.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/pwm.h b/include/pwm.h
index 851915e..ebee227 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -34,6 +34,15 @@ struct pwm_ops {
* @return 0 if OK, -ve on error
*/
int (*set_enable)(struct udevice *dev, uint channel, bool enable);
+ /**
+ * set_invert() - Set the PWM invert
+ *
+ * @dev: PWM device to update
+ * @channel: PWM channel to update
+ * @polarity: true to invert, false to keep normal polarity
+ * @return 0 if OK, -ve on error
+ */
+ int (*set_invert)(struct udevice *dev, uint channel, bool polarity);
};
#define pwm_get_ops(dev) ((struct pwm_ops *)(dev)->driver->ops)
@@ -60,6 +69,16 @@ int pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
*/
int pwm_set_enable(struct udevice *dev, uint channel, bool enable);
+/**
+ * pwm_set_invert() - Set pwm default polarity
+ *
+ * @dev: PWM device to update
+ * @channel: PWM channel to update
+ * @polarity: true to invert, false to keep normal polarity
+ * @return 0 if OK, -ve on error
+ */
+int pwm_set_invert(struct udevice *dev, uint channel, bool polarity);
+
/* Legacy interface */
#ifndef CONFIG_DM_PWM
int pwm_init (int pwm_id, int div, int invert);