[PATCH] x86: fix the delay when controlling brightness using hotkeys on ideapad laptops

From: Hamed Abdelli
Date: Mon Mar 04 2013 - 18:39:36 EST


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,

Signed-off-by: Hamed ABDELLI <abdelli.hamed@xxxxxxxx>

--- linux-3.8.2/drivers/platform/x86/ideapad-laptop.c.orig      2013-03-04 23:38:09.291989270 +0100
+++ linux-3.8.2/drivers/platform/x86/ideapad-laptop.c   2013-03-04 23:38:47.272988333 +0100
@@ -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))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/