aboutsummaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2017-04-24 10:27:49 +0800
committerSimon Glass <sjg@chromium.org>2017-05-10 13:37:21 -0600
commit0b60111aa66f51d05473a375070ca72d073a6fd3 (patch)
tree48068d473dd00ed00a70b4a68cc956a04f049a62 /drivers/pwm
parenta66726838e9227ea8b9c6a1402d6ca89384c1b56 (diff)
downloadu-boot-0b60111aa66f51d05473a375070ca72d073a6fd3.zip
u-boot-0b60111aa66f51d05473a375070ca72d073a6fd3.tar.gz
u-boot-0b60111aa66f51d05473a375070ca72d073a6fd3.tar.bz2
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 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-uclass.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-uclass.c b/drivers/pwm/pwm-uclass.c
index c2200af..69051fe 100644
--- a/drivers/pwm/pwm-uclass.c
+++ b/drivers/pwm/pwm-uclass.c
@@ -9,6 +9,16 @@
#include <dm.h>
#include <pwm.h>
+int pwm_set_invert(struct udevice *dev, uint channel, bool polarity)
+{
+ struct pwm_ops *ops = pwm_get_ops(dev);
+
+ if (!ops->set_invert)
+ return -ENOSYS;
+
+ return ops->set_invert(dev, channel, polarity);
+}
+
int pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
uint duty_ns)
{