All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karol Lewandowski <karol.k.lewandowski@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: astarikovskiy@suse.de, lenb@kernel.org,
	linux-acpi@vger.kernel.org, rjwysocki@sisk.pl
Subject: [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
Date: Mon, 7 Sep 2009 23:14:23 +0200	[thread overview]
Message-ID: <20090907211423.GA2535@bizet.domek.prywatny> (raw)

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;
 	}

             reply	other threads:[~2009-09-07 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-07 21:14 Karol Lewandowski [this message]
2009-09-07 21:57 ` [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep() Henrique de Moraes Holschuh
2009-09-07 22:04   ` Karol Lewandowski
2009-09-07 22:43     ` Henrique de Moraes Holschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090907211423.GA2535@bizet.domek.prywatny \
    --to=karol.k.lewandowski@gmail.com \
    --cc=astarikovskiy@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjwysocki@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.