From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] video: backlight: fix the value of 'brightness_max'
Date: Mon, 29 Aug 2016 17:36:55 +0200 [thread overview]
Message-ID: <1472485015-16010-1-git-send-email-s.hauer@pengutronix.de> (raw)
Fixes: 87c6a88 video/backlight-pwm: fix the value of 'brightness_max'.
brightness_max should really contain the number of brightness steps, so
the number of elements in the brightness array.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/video/backlight-pwm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index 7f1715d..2915dba 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -156,6 +156,8 @@ static int pwm_backlight_parse_dt(struct device_d *dev,
if (ret < 0)
return ret;
+ pwm_backlight->backlight.brightness_max = length - 1;
+
for (i = 0; i < length; i++)
if (pwm_backlight->levels[i] > pwm_backlight->scale)
pwm_backlight->scale = pwm_backlight->levels[i];
@@ -165,8 +167,8 @@ static int pwm_backlight_parse_dt(struct device_d *dev,
} else {
/* We implicitly assume here a linear levels array { 0, 1, 2, ... 100 } */
pwm_backlight->scale = 100;
+ pwm_backlight->backlight.brightness_max = pwm_backlight->scale;
}
- pwm_backlight->backlight.brightness_max = pwm_backlight->scale;
pwm_backlight->enable_gpio = of_get_named_gpio_flags(node, "enable-gpios", 0, &flags);
--
2.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2016-08-29 15:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472485015-16010-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox