All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
@ 2009-09-07 21:14 Karol Lewandowski
  2009-09-07 21:57 ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Lewandowski @ 2009-09-07 21:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: astarikovskiy, lenb, linux-acpi, rjwysocki

Hello,

Following patch reverts commit that changed usleep() to mleep()
in ACPI's EC driver. That change made hotkeys on my Thinkpad T21
unusable after resume.  

This time, it's regression from 2.6.29 (it was repeadly broken and
fixed in older kernels too).
See http://bugzilla.kernel.org/show_bug.cgi?id=11674 for reference.

I've tested this patch with 2.6.31-rc9 -- hotkeys work again.

Please consider applying this to 2.6.31-tree and maybe 2.6.30-stable
as well.


Thanks.


commit 215c964fcccedc3f8967d57f7051e803e746a38d
Author: Karol Lewandowski <karol.k.lewandowski@gmail.com>
Date:   Mon Sep 7 21:13:02 2009 +0200

    Revert "ACPI: EC: Separate delays for MSI hardware"
    
    This reverts commit 34ff4dbccccce54c83b1234d39b7ad9e548a75dd.

    Revert timeout to old value (larger than spec requires[*]) instead
    of using vendor-dependent delays.

    Without this revert my Thinkpad T21 stops generating hotkey events
    after resume (with 2.6.31-rc9).  See bug #11674 for reference.

    [*] ACPI spec at http://www.acpi.info/DOWNLOADS/ACPIspec30b.pdf
    page 386, "Burst Enable Embedded Controller" defines EC's
    response timeout as =< 50us.

Signed-off-by: Karol Lewandowski <karol.k.lewandowski@gmail.com>

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 391f331..20eed99 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -67,7 +67,7 @@ enum ec_command {
 
 #define ACPI_EC_DELAY		500	/* Wait 500ms max. during EC ops */
 #define ACPI_EC_UDELAY_GLK	1000	/* Wait 1ms max. to get global lock */
-#define ACPI_EC_CDELAY		10	/* Wait 10us before polling EC */
+#define ACPI_EC_UDELAY		100	/* Wait 100us before polling EC again */
 
 #define ACPI_EC_STORM_THRESHOLD 8	/* number of false interrupts
 					   per one transaction */
@@ -236,23 +236,13 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
 	return 0;
 }
 
-static void ec_delay(void)
-{
-	/* EC in MSI notebooks don't tolerate delays other than 550 usec */
-	if (EC_FLAGS_MSI)
-		udelay(ACPI_EC_DELAY);
-	else
-		/* Use shortest sleep available */
-		msleep(1);
-}
-
 static int ec_poll(struct acpi_ec *ec)
 {
 	unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
-	udelay(ACPI_EC_CDELAY);
+	udelay(ACPI_EC_UDELAY);
 	while (time_before(jiffies, delay)) {
 		gpe_transaction(ec, acpi_ec_read_status(ec));
-		ec_delay();
+		udelay(ACPI_EC_UDELAY);
 		if (ec_transaction_done(ec))
 			return 0;
 	}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-07 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-07 21:14 [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep() Karol Lewandowski
2009-09-07 21:57 ` Henrique de Moraes Holschuh
2009-09-07 22:04   ` Karol Lewandowski
2009-09-07 22:43     ` Henrique de Moraes Holschuh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.