]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/ec.c
Merge branch 'ec' into test
[linux-2.6-omap-h63xx.git] / drivers / acpi / ec.c
index 453ba1e534ef986b9e593579e89ab7d895ec560d..4178d17aa0edc2bc8576d44ee6d4bae184c6dcfb 100644 (file)
@@ -298,6 +298,18 @@ static int ec_check_ibf0(struct acpi_ec *ec)
        return (status & ACPI_EC_FLAG_IBF) == 0;
 }
 
+static int ec_wait_ibf0(struct acpi_ec *ec)
+{
+       unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
+       /* interrupt wait manually if GPE mode is not active */
+       unsigned long timeout = test_bit(EC_FLAGS_GPE_MODE, &ec->flags) ?
+               msecs_to_jiffies(ACPI_EC_DELAY) : msecs_to_jiffies(1);
+       while (time_before(jiffies, delay))
+               if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), timeout))
+                       return 0;
+       return -ETIME;
+}
+
 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t,
                               int force_poll)
 {
@@ -315,8 +327,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t,
                        goto unlock;
                }
        }
-       if (!wait_event_timeout(ec->wait, ec_check_ibf0(ec),
-                               msecs_to_jiffies(ACPI_EC_DELAY))) {
+       if (ec_wait_ibf0(ec)) {
                pr_err(PREFIX "input buffer is not empty, "
                                "aborting transaction\n");
                status = -ETIME;
@@ -860,8 +871,19 @@ static int ec_install_handlers(struct acpi_ec *ec)
                                                    &acpi_ec_space_handler,
                                                    NULL, ec);
        if (ACPI_FAILURE(status)) {
-               acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
-               return -ENODEV;
+               if (status == AE_NOT_FOUND) {
+                       /*
+                        * Maybe OS fails in evaluating the _REG object.
+                        * The AE_NOT_FOUND error will be ignored and OS
+                        * continue to initialize EC.
+                        */
+                       printk(KERN_ERR "Fail in evaluating the _REG object"
+                               " of EC device. Broken bios is suspected.\n");
+               } else {
+                       acpi_remove_gpe_handler(NULL, ec->gpe,
+                               &acpi_ec_gpe_handler);
+                       return -ENODEV;
+               }
        }
 
        set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);