aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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 }