--- /usr/src/linux/drivers/acpi/ec.c 2011-07-22 04:17:23.000000000 +0200 +++ /usr/src/linux/ec-3.0.0_patched.c 2011-11-30 16:09:36.687638000 +0100 @@ -222,6 +222,7 @@ if (ec_transaction_done(ec)) return 0; } else { + msleep(1); if (wait_event_timeout(ec->wait, ec_transaction_done(ec), msecs_to_jiffies(1))) @@ -229,8 +230,8 @@ } advance_transaction(ec, acpi_ec_read_status(ec)); } while (time_before(jiffies, delay)); - if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) - break; + //if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) + // break; pr_debug(PREFIX "controller reset, restart transaction\n"); spin_lock_irqsave(&ec->curr_lock, flags); start_transaction(ec); @@ -267,6 +268,15 @@ return (status & ACPI_EC_FLAG_IBF) == 0; } +/* try to clean input buffer with burst_disable transaction */ +static int acpi_ec_clean_buffer(struct acpi_ec *ec) +{ + struct transaction t = {.command = ACPI_EC_BURST_DISABLE, + .wdata = NULL, .rdata = NULL, + .wlen = 0, .rlen = 0}; + return acpi_ec_transaction_unlocked(ec, &t); +} + static int ec_wait_ibf0(struct acpi_ec *ec) { unsigned long delay = jiffies + msecs_to_jiffies(ec_delay); @@ -275,7 +285,8 @@ if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), msecs_to_jiffies(1))) return 0; - return -ETIME; + //return -ETIME; + return acpi_ec_clean_buffer(ec); } static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)