diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 51 |
2 files changed, 16 insertions, 40 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index a13d69b2217d..727cc08f0f3b 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -586,11 +586,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
586 | 586 | ||
587 | eata= [HW,SCSI] | 587 | eata= [HW,SCSI] |
588 | 588 | ||
589 | ec_intr= [HW,ACPI] ACPI Embedded Controller interrupt mode | ||
590 | Format: <int> | ||
591 | 0: polling mode | ||
592 | non-0: interrupt mode (default) | ||
593 | |||
594 | edd= [EDD] | 589 | edd= [EDD] |
595 | Format: {"of[f]" | "sk[ipmbr]"} | 590 | Format: {"of[f]" | "sk[ipmbr]"} |
596 | See comment in arch/i386/boot/edd.S | 591 | See comment in arch/i386/boot/edd.S |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5ce90ce22b58..50d55fe71a30 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -71,14 +71,10 @@ enum ec_event { | |||
71 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 71 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
72 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 72 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
73 | 73 | ||
74 | static enum ec_mode { | ||
75 | EC_INTR = 1, /* Output buffer full */ | ||
76 | EC_POLL, /* Input buffer empty */ | ||
77 | } acpi_ec_mode = EC_INTR; | ||
78 | |||
79 | enum { | 74 | enum { |
80 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
81 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | ||
82 | }; | 78 | }; |
83 | 79 | ||
84 | static int acpi_ec_remove(struct acpi_device *device, int type); | 80 | static int acpi_ec_remove(struct acpi_device *device, int type); |
@@ -169,21 +165,23 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
169 | 165 | ||
170 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 166 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
171 | { | 167 | { |
172 | if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { | 168 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
173 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 169 | likely(!force_poll)) { |
174 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
175 | while (time_before(jiffies, delay)) { | ||
176 | if (acpi_ec_check_status(ec, event)) | ||
177 | return 0; | ||
178 | } | ||
179 | } else { | ||
180 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 170 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
181 | msecs_to_jiffies(ACPI_EC_DELAY))) | 171 | msecs_to_jiffies(ACPI_EC_DELAY))) |
182 | return 0; | 172 | return 0; |
183 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 173 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
184 | if (acpi_ec_check_status(ec, event)) { | 174 | if (acpi_ec_check_status(ec, event)) { |
175 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
185 | return 0; | 176 | return 0; |
186 | } | 177 | } |
178 | } else { | ||
179 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | ||
180 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | ||
181 | while (time_before(jiffies, delay)) { | ||
182 | if (acpi_ec_check_status(ec, event)) | ||
183 | return 0; | ||
184 | } | ||
187 | } | 185 | } |
188 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 186 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," |
189 | " status = %d, expect_event = %d\n", | 187 | " status = %d, expect_event = %d\n", |
@@ -481,18 +479,17 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
481 | struct acpi_ec *ec = data; | 479 | struct acpi_ec *ec = data; |
482 | 480 | ||
483 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 481 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
484 | 482 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | |
485 | if (acpi_ec_mode == EC_INTR) { | ||
486 | wake_up(&ec->wait); | 483 | wake_up(&ec->wait); |
487 | } | ||
488 | 484 | ||
489 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { | 485 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { |
490 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 486 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
491 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, | 487 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
492 | acpi_ec_gpe_query, ec); | 488 | acpi_ec_gpe_query, ec); |
493 | } | 489 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) |
490 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
494 | 491 | ||
495 | return status == AE_OK ? | 492 | return ACPI_SUCCESS(status) ? |
496 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 493 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
497 | } | 494 | } |
498 | 495 | ||
@@ -923,20 +920,4 @@ static void __exit acpi_ec_exit(void) | |||
923 | 920 | ||
924 | return; | 921 | return; |
925 | } | 922 | } |
926 | #endif /* 0 */ | 923 | #endif /* 0 */ |
927 | |||
928 | static int __init acpi_ec_set_intr_mode(char *str) | ||
929 | { | ||
930 | int intr; | ||
931 | |||
932 | if (!get_option(&str, &intr)) | ||
933 | return 0; | ||
934 | |||
935 | acpi_ec_mode = (intr) ? EC_INTR : EC_POLL; | ||
936 | |||
937 | printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling"); | ||
938 | |||
939 | return 1; | ||
940 | } | ||
941 | |||
942 | __setup("ec_intr=", acpi_ec_set_intr_mode); | ||