* [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell
@ 2019-04-12 5:56 Stefan Mavrodiev
2019-04-12 9:02 ` Anatolij Gustschin
2019-04-17 13:34 ` Anatolij Gustschin
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Mavrodiev @ 2019-04-12 5:56 UTC (permalink / raw)
To: u-boot
This patch enables the reading of the polarity cell from a PWM
phandle and calls pwm_set_invert().
Not all platforms have polarity cell, so skip if it's not pressent.
Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
---
Changes for v2:
- Check if phandle has polarity cell
- Add missing signed-off-by
drivers/video/pwm_backlight.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index bd733f5f1c..a587977c22 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,8 @@ 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];
+ if (args.args_count > 2)
+ priv->polarity = args.args[2];
index = dev_read_u32_default(dev, "default-brightness-level", 255);
cell = dev_read_prop(dev, "brightness-levels", &len);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell
2019-04-12 5:56 [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell Stefan Mavrodiev
@ 2019-04-12 9:02 ` Anatolij Gustschin
2019-04-17 13:34 ` Anatolij Gustschin
1 sibling, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2019-04-12 9:02 UTC (permalink / raw)
To: u-boot
On Fri, 12 Apr 2019 08:56:27 +0300
Stefan Mavrodiev stefan at olimex.com wrote:
> This patch enables the reading of the polarity cell from a PWM
> phandle and calls pwm_set_invert().
>
> Not all platforms have polarity cell, so skip if it's not pressent.
>
> Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell
2019-04-12 5:56 [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell Stefan Mavrodiev
2019-04-12 9:02 ` Anatolij Gustschin
@ 2019-04-17 13:34 ` Anatolij Gustschin
1 sibling, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2019-04-17 13:34 UTC (permalink / raw)
To: u-boot
On Fri, 12 Apr 2019 08:56:27 +0300
Stefan Mavrodiev stefan at olimex.com wrote:
...
> Changes for v2:
> - Check if phandle has polarity cell
> - Add missing signed-off-by
>
> drivers/video/pwm_backlight.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
Applied to u-boot-video/master, thanks!
--
Anatolij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-17 13:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-12 5:56 [U-Boot] [PATCH v2 1/1] video: backlight: Parse PWM polarity cell Stefan Mavrodiev
2019-04-12 9:02 ` Anatolij Gustschin
2019-04-17 13:34 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox