diff mbox series

[U-Boot,1/1] video: backlight: Parse PWM polarity cell

Message ID 20190325075348.2665-1-stefan@olimex.com
State Superseded
Delegated to: Anatolij Gustschin
Headers show
Series [U-Boot,1/1] video: backlight: Parse PWM polarity cell | expand

Commit Message

Stefan Mavrodiev March 25, 2019, 7:53 a.m. UTC
This patch enables the reading of the polarity cell from a PWM
phandle and calls pwm_set_invert().
---
 drivers/video/pwm_backlight.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Anatolij Gustschin April 9, 2019, 9:21 p.m. UTC | #1
On Mon, 25 Mar 2019 09:53:48 +0200
Stefan Mavrodiev stefan@olimex.com wrote:

> This patch enables the reading of the polarity cell from a PWM
> phandle and calls pwm_set_invert().
> ---
>  drivers/video/pwm_backlight.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Applied to u-boot-video/master, added SoB. Please next time don't
forget to add Signed-off-by tag. Thanks!

--
Anatolij
Anatolij Gustschin April 11, 2019, 12:09 p.m. UTC | #2
On Tue, 9 Apr 2019 23:21:09 +0200
Anatolij Gustschin agust@denx.de wrote:
...
> Applied to u-boot-video/master, added SoB. Please next time don't
> forget to add Signed-off-by tag. Thanks!

Unfortunately this patch introduced dm panel test error [1], so
I've dropped the patch from master. Please fix and resubmit. Thanks!

[1] https://travis-ci.org/vdsao/u-boot-video/jobs/517944146#L1058

--
Anatolij
diff mbox series

Patch

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index bd733f5f1c..0a08a76af1 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -39,6 +39,12 @@  struct pwm_backlight_priv {
 	struct udevice *pwm;
 	uint channel;
 	uint period_ns;
+	/*
+	 * the polarity of one PWM
+	 * 0: normal polarity
+	 * 1: inverted polarity
+	 */
+	bool polarity;
 	u32 *levels;
 	int num_levels;
 	uint default_level;
@@ -57,7 +63,10 @@  static int set_pwm(struct pwm_backlight_priv *priv)
 		(priv->max_level - priv->min_level + 1);
 	ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns,
 			     duty_cycle);
+	if (ret)
+		return log_ret(ret);
 
+	ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
 	return log_ret(ret);
 }
 
@@ -202,6 +211,7 @@  static int pwm_backlight_ofdata_to_platdata(struct udevice *dev)
 		return log_msg_ret("Not enough arguments to pwm\n", -EINVAL);
 	priv->channel = args.args[0];
 	priv->period_ns = args.args[1];
+	priv->polarity = args.args[2];
 
 	index = dev_read_u32_default(dev, "default-brightness-level", 255);
 	cell = dev_read_prop(dev, "brightness-levels", &len);