diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5a2d5372ea39..03107bce03ed 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 | ||
239 | static 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 | |||
239 | static int ec_poll(struct acpi_ec *ec) | 249 | static 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 | } |
@@ -1073,13 +1083,10 @@ static struct acpi_driver acpi_ec_driver = { | |||
1073 | }, | 1083 | }, |
1074 | }; | 1084 | }; |
1075 | 1085 | ||
1076 | static int __init acpi_ec_init(void) | 1086 | int __init acpi_ec_init(void) |
1077 | { | 1087 | { |
1078 | int result = 0; | 1088 | int result = 0; |
1079 | 1089 | ||
1080 | if (acpi_disabled) | ||
1081 | return 0; | ||
1082 | |||
1083 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); | 1090 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); |
1084 | if (!acpi_ec_dir) | 1091 | if (!acpi_ec_dir) |
1085 | return -ENODEV; | 1092 | return -ENODEV; |
@@ -1094,8 +1101,6 @@ static int __init acpi_ec_init(void) | |||
1094 | return result; | 1101 | return result; |
1095 | } | 1102 | } |
1096 | 1103 | ||
1097 | subsys_initcall(acpi_ec_init); | ||
1098 | |||
1099 | /* EC driver currently not unloadable */ | 1104 | /* EC driver currently not unloadable */ |
1100 | #if 0 | 1105 | #if 0 |
1101 | static void __exit acpi_ec_exit(void) | 1106 | static void __exit acpi_ec_exit(void) |