Commit ba05b237 authored by John Serock's avatar John Serock Committed by Matthew Garrett

Platform: Detect samsung laptop quirk when initial level is zero

This patch depends on the "Platform: Brightness quirk for samsung
laptop driver" patch from Jason Stubbs. This patch adds a check for an
initial brightness level of 0; if the level is 0, this patch changes
the brightness level to 1 before the driver attempts to detect the
brightness quirk.

The Samsung N150 netbook experiences the brightness quirk. Without
Jason's patch, the only brightness levels available on the N150 are 0,
1, and 8. This patch ensures that, when the initial brightness level
is 0, the samsang-laptop driver detects the brightness quirk on the
N150, thereby making brightness levels 0 through 8 available.
Signed-off-by: default avatarJohn Serock <john.serock@gmail.com>
Acked-by: default avatarJason Stubbs <jasonbstubbs@gmail.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent be3128b1
...@@ -404,8 +404,9 @@ static int get_brightness(struct backlight_device *bd) ...@@ -404,8 +404,9 @@ static int get_brightness(struct backlight_device *bd)
static void check_for_stepping_quirk(void) static void check_for_stepping_quirk(void)
{ {
u8 initial_level = read_brightness(); u8 initial_level;
u8 check_level; u8 check_level;
u8 orig_level = read_brightness();
/* /*
* Some laptops exhibit the strange behaviour of stepping toward * Some laptops exhibit the strange behaviour of stepping toward
...@@ -414,6 +415,11 @@ static void check_for_stepping_quirk(void) ...@@ -414,6 +415,11 @@ static void check_for_stepping_quirk(void)
* around in set_brightness. * around in set_brightness.
*/ */
if (orig_level == 0)
set_brightness(1);
initial_level = read_brightness();
if (initial_level <= 2) if (initial_level <= 2)
check_level = initial_level + 2; check_level = initial_level + 2;
else else
...@@ -427,7 +433,7 @@ static void check_for_stepping_quirk(void) ...@@ -427,7 +433,7 @@ static void check_for_stepping_quirk(void)
pr_info("enabled workaround for brightness stepping quirk\n"); pr_info("enabled workaround for brightness stepping quirk\n");
} }
set_brightness(initial_level); set_brightness(orig_level);
} }
static int update_status(struct backlight_device *bd) static int update_status(struct backlight_device *bd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment