From: Jason Stubbs <jasonbstubbs@gmail.com>
To: Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform: fix samsung brightness min/max calculations
Date: Thu, 28 Apr 2011 18:55:50 +1000 [thread overview]
Message-ID: <201104281855.50572.jasonbstubbs@gmail.com> (raw)
In-Reply-To: <201104201358.50443.jasonbstubbs@gmail.com>
Not sure of the "bump" process, so I'll just go over each part of the patch.
Note that all the changes only affect the sabi_config where min_brightness
is 1 so you might not see in difference on your hardware.
On Wed, 20 Apr 2011 13:58:50 Jason Stubbs wrote:
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -370,15 +370,17 @@ static u8 read_brightness(void)
> &sretval);
> if (!retval) {
> user_brightness = sretval.retval[0];
> - if (user_brightness != 0)
> + if (user_brightness > sabi_config->min_brightness)
> user_brightness -= sabi_config->min_brightness;
> + else
> + user_brightness = 0;
min_brightness is (and probably will always be) only 0 or 1 in the current
sabi_configs, so this patch doesn't actually change present behaviour. Should
there ever be a min_brightness > 1, however, this patch will be required or
user_brightness will end up going below 0 and wrapping around.
> static void set_brightness(u8 user_brightness)
> {
> - u8 user_level = user_brightness - sabi_config->min_brightness;
> + u8 user_level = user_brightness + sabi_config->min_brightness;
The sign here is definitely wrong. If the user sets a brightness of 0 when
using a sabi_config with a min_brightness of 1, user_level will become -1 and
that is the value that will be passed to the hardware.
> @@ -782,7 +784,8 @@ static int __init samsung_init(void)
> /* create a backlight device to talk to this one */
> memset(&props, 0, sizeof(struct backlight_properties));
> props.type = BACKLIGHT_PLATFORM;
> - props.max_brightness = sabi_config->max_brightness;
> + props.max_brightness = sabi_config->max_brightness -
> + sabi_config->min_brightness;
Without subtracting the min_brightness, the user is offered a range of 0
through 8 for both sabi_configs. For the min_brightness == 1 case and with
set_brightness() fixed, a user setting of 8 would actually set 9 in hardware.
Regards,
Jason Stubbs
next prev parent reply other threads:[~2011-04-28 8:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 3:58 [PATCH] platform: fix samsung brightness min/max calculations Jason Stubbs
2011-04-28 8:55 ` Jason Stubbs [this message]
2011-05-10 22:39 ` Greg KH
2011-05-11 4:47 ` Jason Stubbs
2011-05-11 13:51 ` Greg KH
2011-05-12 2:13 ` Jason Stubbs
2011-05-12 16:44 ` Greg KH
2011-05-13 10:44 ` Jason Stubbs
2011-05-13 10:47 ` [PATCH] platform: add support for samsung nc210/nc110 Jason Stubbs
2011-06-13 23:55 ` [PATCH] platform: fix samsung brightness min/max calculations Greg KH
2011-06-19 21:23 ` [PATCH] platform: samsung_laptop: " Jason Stubbs
2011-06-19 21:36 ` [PATCH] platform: " Jason Stubbs
2011-08-24 23:11 ` Greg KH
2011-05-12 2:32 ` Jason Stubbs
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=201104281855.50572.jasonbstubbs@gmail.com \
--to=jasonbstubbs@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@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