aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/samsung-laptop.c
diff options
context:
space:
mode:
authorJohn Serock <john.serock@gmail.com>2011-10-13 06:42:01 -0400
committerMatthew Garrett <mjg@redhat.com>2011-10-24 10:52:37 -0400
commitba05b237372bad82533d1f717569d1d817ff3c27 (patch)
tree4ab84889713510958299ee72cea863691782584a /drivers/platform/x86/samsung-laptop.c
parentbe3128b107e36271f7973ef213ccde603a494fe8 (diff)
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: John Serock <john.serock@gmail.com> Acked-by: Jason Stubbs <jasonbstubbs@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/samsung-laptop.c')
-rw-r--r--drivers/platform/x86/samsung-laptop.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 1e436ebdcff..31ddd57e8ca 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -404,8 +404,9 @@ static int get_brightness(struct backlight_device *bd)
404 404
405static void check_for_stepping_quirk(void) 405static void check_for_stepping_quirk(void)
406{ 406{
407 u8 initial_level = read_brightness(); 407 u8 initial_level;
408 u8 check_level; 408 u8 check_level;
409 u8 orig_level = read_brightness();
409 410
410 /* 411 /*
411 * Some laptops exhibit the strange behaviour of stepping toward 412 * Some laptops exhibit the strange behaviour of stepping toward
@@ -414,6 +415,11 @@ static void check_for_stepping_quirk(void)
414 * around in set_brightness. 415 * around in set_brightness.
415 */ 416 */
416 417
418 if (orig_level == 0)
419 set_brightness(1);
420
421 initial_level = read_brightness();
422
417 if (initial_level <= 2) 423 if (initial_level <= 2)
418 check_level = initial_level + 2; 424 check_level = initial_level + 2;
419 else 425 else
@@ -427,7 +433,7 @@ static void check_for_stepping_quirk(void)
427 pr_info("enabled workaround for brightness stepping quirk\n"); 433 pr_info("enabled workaround for brightness stepping quirk\n");
428 } 434 }
429 435
430 set_brightness(initial_level); 436 set_brightness(orig_level);
431} 437}
432 438
433static int update_status(struct backlight_device *bd) 439static int update_status(struct backlight_device *bd)