Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271987
b: refs/heads/master
c: ac08052
h: refs/heads/master
i:
  271985: 23170d0
  271983: 86c82e0
v: v3
  • Loading branch information
Jason Stubbs authored and Matthew Garrett committed Oct 24, 2011
1 parent 2466ec3 commit b851147
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a7ea19926ffba86f373f6050a106cd162dbb9a78
refs/heads/master: ac080523141d5bfa5f60ef2436480f645f915e9c
43 changes: 43 additions & 0 deletions trunk/drivers/platform/x86/samsung-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ static struct backlight_device *backlight_device;
static struct mutex sabi_mutex;
static struct platform_device *sdev;
static struct rfkill *rfk;
static bool has_stepping_quirk;

static int force;
module_param(force, bool, 0);
Expand Down Expand Up @@ -382,6 +383,17 @@ static void set_brightness(u8 user_brightness)
{
u8 user_level = user_brightness + sabi_config->min_brightness;

if (has_stepping_quirk && user_level != 0) {
/*
* short circuit if the specified level is what's already set
* to prevent the screen from flickering needlessly
*/
if (user_brightness == read_brightness())
return;

sabi_set_command(sabi_config->commands.set_brightness, 0);
}

sabi_set_command(sabi_config->commands.set_brightness, user_level);
}

Expand All @@ -390,6 +402,34 @@ static int get_brightness(struct backlight_device *bd)
return (int)read_brightness();
}

static void check_for_stepping_quirk(void)
{
u8 initial_level = read_brightness();
u8 check_level;

/*
* Some laptops exhibit the strange behaviour of stepping toward
* (rather than setting) the brightness except when changing to/from
* brightness level 0. This behaviour is checked for here and worked
* around in set_brightness.
*/

if (initial_level <= 2)
check_level = initial_level + 2;
else
check_level = initial_level - 2;

has_stepping_quirk = false;
set_brightness(check_level);

if (read_brightness() != check_level) {
has_stepping_quirk = true;
pr_info("enabled workaround for brightness stepping quirk\n");
}

set_brightness(initial_level);
}

static int update_status(struct backlight_device *bd)
{
set_brightness(bd->props.brightness);
Expand Down Expand Up @@ -805,6 +845,9 @@ static int __init samsung_init(void)
}
}

/* Check for stepping quirk */
check_for_stepping_quirk();

/* knock up a platform device to hang stuff off of */
sdev = platform_device_register_simple("samsung", -1, NULL, 0);
if (IS_ERR(sdev))
Expand Down

0 comments on commit b851147

Please sign in to comment.