From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>,
linux-fbdev@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
dri-devel@lists.freedesktop.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 4/5] backlight: led_bl: fix led -> backlight brightness mapping
Date: Tue, 21 Apr 2020 05:57:01 +0000 [thread overview]
Message-ID: <f1d217f3-96bf-d24c-43b0-cc98115eae8e@ti.com> (raw)
In-Reply-To: <20200420155514.lyb73ujf5fzgpvp4@holly.lan>
On 20/04/2020 18:55, Daniel Thompson wrote:
> On Fri, Apr 17, 2020 at 02:33:11PM +0300, Tomi Valkeinen wrote:
>> The code that maps the LED default brightness to backlight levels has
>> two issues: 1) if the default brightness is the first backlight level
>> (usually 0), the code fails to find it, and 2) when the code fails to
>> find a backlight level, it ends up using max_brightness + 1 as the
>> default brightness.
>>
>> Fix these two issues.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>> drivers/video/backlight/led_bl.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
>> index 63693c4f0883..021b5edd895c 100644
>> --- a/drivers/video/backlight/led_bl.c
>> +++ b/drivers/video/backlight/led_bl.c
>> @@ -159,10 +159,11 @@ static int led_bl_parse_levels(struct device *dev,
>> */
>> db = priv->default_brightness;
>> for (i = 0 ; i < num_levels; i++) {
>> - if ((i && db > levels[i - 1]) && db <= levels[i])
>> + if ((i = 0 || db > levels[i - 1]) && db <= levels[i])
>> break;
>> }
>> - priv->default_brightness = i;
>> +
>> + priv->default_brightness = i < num_levels ? i : 0;
>
> This seems a bit odd. If the LED is currently set to brighter than the
> maximum brightness level why would we choose a default brightness of
> zero?
Indeed, better to set it to max.
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next prev parent reply other threads:[~2020-04-21 5:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 11:33 [PATCH 1/5] backlight: led_bl: fix cosmetic issues Tomi Valkeinen
2020-04-17 11:33 ` [PATCH 2/5] backlight: led_bl: drop useless NULL initialization Tomi Valkeinen
2020-04-20 15:29 ` Daniel Thompson
2020-04-17 11:33 ` [PATCH 3/5] backlight: led_bl: add led_access locking Tomi Valkeinen
2020-04-20 15:45 ` Daniel Thompson
2020-04-17 11:33 ` [PATCH 4/5] backlight: led_bl: fix led -> backlight brightness mapping Tomi Valkeinen
2020-04-20 15:55 ` Daniel Thompson
2020-04-21 5:57 ` Tomi Valkeinen [this message]
2020-04-17 11:33 ` [PATCH 5/5] backlight: led_bl: rewrite led_bl_parse_levels() Tomi Valkeinen
2020-04-20 16:01 ` Daniel Thompson
2020-04-21 5:52 ` Tomi Valkeinen
2020-04-21 10:48 ` Daniel Thompson
2020-04-21 11:26 ` Tomi Valkeinen
2020-04-21 11:53 ` Tomi Valkeinen
2020-04-20 15:29 ` [PATCH 1/5] backlight: led_bl: fix cosmetic issues Daniel Thompson
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=f1d217f3-96bf-d24c-43b0-cc98115eae8e@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=b.zolnierkie@samsung.com \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).