x86: fix the delay when controlling brightness using hotkeys on ideapad laptops
PATCH 1/1 x86: fix the delay when controlling brightness using hotkeys on ideapad laptops
Fixes the lag when reading and writing hotkeys for backlight control on ideapad laptops by minimizing the timeout.
Applies to linux-3.8.2
Thanks,
drivers/platform/x86/ideapad-laptop.c 2013-03-04 23:38:47.272988333 +0100 renamed from drivers/platform/x86/ideapad-laptop.c.orig 2013-03-04 23:38:09.291989270 +0100 +0 -0
@@ -90,7 +90,7 @@ MODULE_PARM_DESC(no_bt_rfkill, "No rfkil
/*
* ACPI Helpers
*/
-#define IDEAPAD_EC_TIMEOUT (100) /* in ms */
+#define IDEAPAD_EC_TIMEOUT (1) /* in ms */
static int read_method_int(acpi_handle handle, const char *method, int *val) {
@@ -157,7 +157,7 @@ static int read_ec_data(acpi_handle hand
if (method_vpcw(handle, 1, cmd))
return -1;
- for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1;
+ for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/10000+1; time_before(jiffies, end_jiffies);) { schedule();
if (method_vpcr(handle, 1, &val))
@@ -183,7 +183,7 @@ static int write_ec_cmd(acpi_handle hand if (method_vpcw(handle, 1, cmd))
return -1;
- for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1;
+ for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/10000+1; time_before(jiffies, end_jiffies);) { schedule();
if (method_vpcr(handle, 1, &val))