From 0b60111aa66f51d05473a375070ca72d073a6fd3 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 24 Apr 2017 10:27:49 +0800 Subject: 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 Signed-off-by: Kever Yang Acked-by: Simon Glass --- drivers/pwm/pwm-uclass.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/pwm/pwm-uclass.c') diff --git a/drivers/pwm/pwm-uclass.c b/drivers/pwm/pwm-uclass.c index c2200af8a55..69051fe1b56 100644 --- a/drivers/pwm/pwm-uclass.c +++ b/drivers/pwm/pwm-uclass.c @@ -9,6 +9,16 @@ #include #include +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) { -- cgit v1.2.3