* [U-Boot] [PATCH] video: backlight: fix pwm invertation
@ 2019-06-21 20:01 Marc Dietrich
2019-06-27 19:51 ` Marc Dietrich
[not found] ` <1714255.XLXxeDuSEK@ax5200p>
0 siblings, 2 replies; 7+ messages in thread
From: Marc Dietrich @ 2019-06-21 20:01 UTC (permalink / raw)
To: u-boot
Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwm will always fail if pwm_set_invert is not implemented, leaving the
backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
drivers/video/pwm_backlight.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index a587977c22..26bcbeb42b 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -61,12 +61,13 @@ static int set_pwm(struct pwm_backlight_priv *priv)
duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
(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);
+ if (!ret && priv->polarity)
+ ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
+
return log_ret(ret);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
2019-06-21 20:01 [U-Boot] [PATCH] video: backlight: fix pwm invertation Marc Dietrich
@ 2019-06-27 19:51 ` Marc Dietrich
2019-07-02 6:12 ` Nicolas Chauvet
[not found] ` <1714255.XLXxeDuSEK@ax5200p>
1 sibling, 1 reply; 7+ messages in thread
From: Marc Dietrich @ 2019-06-27 19:51 UTC (permalink / raw)
To: u-boot
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
> Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
>
> set_pwm will always fail if pwm_set_invert is not implemented, leaving the
> backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
>
> Signed-off-by: Marc Dietrich <marvin24@gmx.de>
ping?
> ---
> drivers/video/pwm_backlight.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
> index a587977c22..26bcbeb42b 100644
> --- a/drivers/video/pwm_backlight.c
> +++ b/drivers/video/pwm_backlight.c
> @@ -61,12 +61,13 @@ static int set_pwm(struct pwm_backlight_priv *priv)
>
> duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
> (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);
> + if (!ret && priv->polarity)
> + ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
> +
> return log_ret(ret);
> }
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
2019-06-27 19:51 ` Marc Dietrich
@ 2019-07-02 6:12 ` Nicolas Chauvet
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Chauvet @ 2019-07-02 6:12 UTC (permalink / raw)
To: u-boot
This patch fixes the panel on my device (paz00).
Can it be applied to 2019-07 ?
Thx in advance
Le jeu. 27 juin 2019 à 21:52, Marc Dietrich <marvin24@gmx.de> a écrit :
>
> Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
> > Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
> >
> > set_pwm will always fail if pwm_set_invert is not implemented, leaving the
> > backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
> >
> > Signed-off-by: Marc Dietrich <marvin24@gmx.de>
>
> ping?
>
> > ---
> > drivers/video/pwm_backlight.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
> > index a587977c22..26bcbeb42b 100644
> > --- a/drivers/video/pwm_backlight.c
> > +++ b/drivers/video/pwm_backlight.c
> > @@ -61,12 +61,13 @@ static int set_pwm(struct pwm_backlight_priv *priv)
> >
> > duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
> > (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);
> > + if (!ret && priv->polarity)
> > + ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
> > +
> > return log_ret(ret);
> > }
> >
> > --
> > 2.17.1
>
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
--
-
Nicolas (kwizart)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
[not found] ` <1714255.XLXxeDuSEK@ax5200p>
@ 2019-07-02 7:40 ` Stefan Mavrodiev
2019-07-02 8:42 ` Nicolas Chauvet
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Mavrodiev @ 2019-07-02 7:40 UTC (permalink / raw)
To: u-boot
Hi,
On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
> Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
>> Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
>>
>> set_pwm will always fail if pwm_set_invert is not implemented, leaving the
>> backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
I'm not sure if this is true. pwm_set_invert() checks for .set_invert.
Which pwm driver you're using?
>>
>> Signed-off-by: Marc Dietrich <marvin24@gmx.de>
> ping?
>
>
>> ---
>> drivers/video/pwm_backlight.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
>> index a587977c22..26bcbeb42b 100644
>> --- a/drivers/video/pwm_backlight.c
>> +++ b/drivers/video/pwm_backlight.c
>> @@ -61,12 +61,13 @@ static int set_pwm(struct pwm_backlight_priv *priv)
>>
>> duty_cycle = priv->period_ns * (priv->cur_level - priv->min_level) /
>> (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);
>> + if (!ret && priv->polarity)
>> + ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
This shouldn't be a problem. Rather the driver doesn't handle polarity
correctly.
>> +
>> return log_ret(ret);
>> }
>>
>> --
>> 2.17.1
P.S.
You should cc to all maintainers. You can use ./scripts/get_maintainer.pl.
Best regards,
Stefan Mavrodiev
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
2019-07-02 7:40 ` Stefan Mavrodiev
@ 2019-07-02 8:42 ` Nicolas Chauvet
2019-07-02 9:05 ` Stefan Mavrodiev
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Chauvet @ 2019-07-02 8:42 UTC (permalink / raw)
To: u-boot
Le mar. 2 juil. 2019 à 09:41, Stefan Mavrodiev <stefan@olimex.com> a écrit :
>
> Hi,
>
> On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
> > Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
> >> Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
> >>
> >> set_pwm will always fail if pwm_set_invert is not implemented, leaving the
> >> backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
> I'm not sure if this is true. pwm_set_invert() checks for .set_invert.
> Which pwm driver you're using?
This is drivers/pwm/pwm_tegra.c
Here .set_invert is not implemented.
Thx for the review.
--
-
Nicolas (kwizart)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
2019-07-02 8:42 ` Nicolas Chauvet
@ 2019-07-02 9:05 ` Stefan Mavrodiev
2019-07-02 9:08 ` Stefan Mavrodiev
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Mavrodiev @ 2019-07-02 9:05 UTC (permalink / raw)
To: u-boot
Hi,
On 7/2/19 11:42 AM, Nicolas Chauvet wrote:
> Le mar. 2 juil. 2019 à 09:41, Stefan Mavrodiev <stefan@olimex.com> a écrit :
>> Hi,
>>
>> On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
>>> Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
>>>> Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
>>>>
>>>> set_pwm will always fail if pwm_set_invert is not implemented, leaving the
>>>> backlight dark. Fix this by calling pwm_set_invert only if pwm is inverted.
>> I'm not sure if this is true. pwm_set_invert() checks for .set_invert.
>> Which pwm driver you're using?
> This is drivers/pwm/pwm_tegra.c
> Here .set_invert is not implemented.
>
> Thx for the review.
>
You're right. Some drivers has #pwm-cells = <2> and in this case
polarity is 0.
However your approach is wrong. You will break other drivers with
#pwm-cells = <3>.
I think your patch should look something like this:
ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
if (ret == -ENOSYS)
ret = 0;
return log_ret(ret);
This will not return error if set_inverted is not implemented.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] video: backlight: fix pwm invertation
2019-07-02 9:05 ` Stefan Mavrodiev
@ 2019-07-02 9:08 ` Stefan Mavrodiev
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Mavrodiev @ 2019-07-02 9:08 UTC (permalink / raw)
To: u-boot
On 7/2/19 12:05 PM, Stefan Mavrodiev wrote:
> Hi,
>
> On 7/2/19 11:42 AM, Nicolas Chauvet wrote:
>> Le mar. 2 juil. 2019 à 09:41, Stefan Mavrodiev <stefan@olimex.com> a
>> écrit :
>>> Hi,
>>>
>>> On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
>>>> Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
>>>>> Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell")
>>>>>
>>>>> set_pwm will always fail if pwm_set_invert is not implemented,
>>>>> leaving the
>>>>> backlight dark. Fix this by calling pwm_set_invert only if pwm is
>>>>> inverted.
>>> I'm not sure if this is true. pwm_set_invert() checks for .set_invert.
>>> Which pwm driver you're using?
>> This is drivers/pwm/pwm_tegra.c
>> Here .set_invert is not implemented.
>>
>> Thx for the review.
>>
> You're right. Some drivers has #pwm-cells = <2> and in this case
> polarity is 0.
>
> However your approach is wrong. You will break other drivers with
> #pwm-cells = <3>.
> I think your patch should look something like this:
>
> ret = pwm_set_invert(priv->pwm, priv->channel, priv->polarity);
> if (ret == -ENOSYS)
> ret = 0;
>
> return log_ret(ret);
You should ask the custodians to review this.
>
> This will not return error if set_inverted is not implemented.
> Stefan
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-07-02 9:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21 20:01 [U-Boot] [PATCH] video: backlight: fix pwm invertation Marc Dietrich
2019-06-27 19:51 ` Marc Dietrich
2019-07-02 6:12 ` Nicolas Chauvet
[not found] ` <1714255.XLXxeDuSEK@ax5200p>
2019-07-02 7:40 ` Stefan Mavrodiev
2019-07-02 8:42 ` Nicolas Chauvet
2019-07-02 9:05 ` Stefan Mavrodiev
2019-07-02 9:08 ` Stefan Mavrodiev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.