video: backlight: fix pwm invertation
PATCH 1/1 video: backlight: fix pwm invertation
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.
--- drivers/video/pwm_backlight.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/video/pwm_backlight.c +4 -3
@@ -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
PATCH 1/1 video: backlight: fix pwm invertation
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 6 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the backlight dark. Fix this by callingpwm_set_invertonly if pwm is inverted.Signed-off-by Marc Dietrich <[email protected]>
ping?
Quoted 27 lines
--- drivers/video/pwm_backlight.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/video/pwm_backlight.c +4
-4@@ -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
PATCH 1/1 video: backlight: fix pwm invertation
This patch fixes the panel on my device (paz00).
Can it be applied to 2019-07 ?
Thx in advance
Quoted 36 lines · Marc Dietrich
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 6 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the backlight dark. Fix this by callingpwm_set_invertonly if pwm is inverted.Signed-off-by Marc Dietrich <[email protected]>ping?
Quoted 25 lines
--- drivers/video/pwm_backlight.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/video/pwm_backlight.c +4
-3@@ -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); }
Quoted 10 lines
Quoted 2 lines
--
2.17.1_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
--
-
Nicolas (kwizart)
A message that is not in the archive (sent off-list or not yet received): 1714255.XLXxeDuSEK@ax5200p
PATCH 1/1 video: backlight: fix pwm invertation
Hi,
Quoted 5 lines · On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 4 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the backlight dark. Fix this by callingpwm_set_invertonly 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?
Quoted 23 lines
Quoted 2 lines
Signed-off-by Marc Dietrich <[email protected]>ping?
Quoted 18 lines
--- drivers/video/pwm_backlight.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/video/pwm_backlight.c +1
-2@@ -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);
Quoted 3 lines
drivers/video/pwm_backlight.c static int set_pwm(struct pwm_backlight_priv *priv) · line 69
Quoted 3 lines
drivers/video/pwm_backlight.c +2
-1- 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.
Quoted 6 lines
Quoted 6 lines
drivers/video/pwm_backlight.c +1
-1+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
PATCH 1/1 video: backlight: fix pwm invertation
Quoted 11 lines · Stefan Mavrodiev
Hi,
Quoted 5 lines · On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 4 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the backlight dark. Fix this by callingpwm_set_invertonly 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.
Signature · 3 lines
- Nicolas (kwizart)
PATCH 1/1 video: backlight: fix pwm invertation
Hi,
Quoted 7 lines · Nicolas Chauvet
Quoted 6 lines · Stefan Mavrodiev
Hi,
Quoted 3 lines · On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 2 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the backlight dark. Fix this by callingpwm_set_invertonly 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
PATCH 1/1 video: backlight: fix pwm invertation
Quoted 29 lines · Stefan Mavrodiev
Hi,
Quoted 12 lines · Nicolas Chauvet
Le mar. 2 juil. 2019 à 09:41, Stefan Mavrodiev <[email protected]> a écrit :
Quoted 10 lines
Hi,
Quoted 7 lines · On 6/27/19 9:56 PM, marvin24 at posteo.de wrote:
Am Freitag, 21. Juni 2019, 22:01:35 CEST schrieb Marc Dietrich:
Quoted 6 lines
Fixes 57e7775413 ("video: backlight: Parse PWM polarity cell")
set_pwmwill always fail ifpwm_set_invertis not implemented, leaving the
backlight dark. Fix this by callingpwm_set_invertonly if pwm is inverted.Quoted 7 lines
Quoted 2 lines
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:
Quoted 5 lines
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.
Quoted 5 lines
This will not return error if
set_invertedis not implemented.Stefan