aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2009-04-01 00:25:10 -0400
committerLen Brown <len.brown@intel.com>2009-04-01 00:25:10 -0400
commit34ff4dbccccce54c83b1234d39b7ad9e548a75dd (patch)
tree206e79104550b204b840f0c4ad551c463f31e61a
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
ACPI: EC: Separate delays for MSI hardware
MSI notebooks require very strict delays, while all others are happy with msleep(). References: http://bugzilla.kernel.org/show_bug.cgi?id=9998 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/ec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 2fe15060dcdc..ac9dd3b386b1 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -67,7 +67,7 @@ enum ec_command {
67 67
68#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 68#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
69#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 69#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
70#define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ 70#define ACPI_EC_CDELAY 10 /* Wait 10us before polling EC */
71 71
72#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts 72#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
73 per one transaction */ 73 per one transaction */
@@ -236,13 +236,23 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
236 return 0; 236 return 0;
237} 237}
238 238
239static void ec_delay(void)
240{
241 /* EC in MSI notebooks don't tolerate delays other than 550 usec */
242 if (EC_FLAGS_MSI)
243 udelay(ACPI_EC_DELAY);
244 else
245 /* Use shortest sleep available */
246 msleep(1);
247}
248
239static int ec_poll(struct acpi_ec *ec) 249static int ec_poll(struct acpi_ec *ec)
240{ 250{
241 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 251 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
242 udelay(ACPI_EC_UDELAY); 252 udelay(ACPI_EC_CDELAY);
243 while (time_before(jiffies, delay)) { 253 while (time_before(jiffies, delay)) {
244 gpe_transaction(ec, acpi_ec_read_status(ec)); 254 gpe_transaction(ec, acpi_ec_read_status(ec));
245 udelay(ACPI_EC_UDELAY); 255 ec_delay();
246 if (ec_transaction_done(ec)) 256 if (ec_transaction_done(ec))
247 return 0; 257 return 0;
248 } 258 }