ACPI: EC: Don't disable EC GPE completely at detected storm From: Alexey Starikovskiy Signed-off-by: Alexey Starikovskiy --- drivers/acpi/ec.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index e7e197e..461acd1 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -527,17 +527,30 @@ static void acpi_ec_gpe_query(void *ec_cxt) mutex_unlock(&ec->lock); } +static void acpi_ec_enable_gpe(void *context) +{ + struct acpi_ec *ec = context; + acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); + atomic_set(&ec->irq_count, 0); + set_bit(EC_FLAGS_GPE_MODE, &ec->flags); +} + static u32 acpi_ec_gpe_handler(void *data) { acpi_status status = AE_OK; struct acpi_ec *ec = data; + static bool gpe_storm = 0; pr_debug(PREFIX "~~~> interrupt\n"); atomic_inc(&ec->irq_count); - if (atomic_read(&ec->irq_count) > 5) { - pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); + if (atomic_read(&ec->irq_count) > 2) { + if (!gpe_storm) { + pr_err(PREFIX "GPE storm detected, throttle EC GPE\n"); + gpe_storm = 1; + } acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR); clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); + acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_enable_gpe, ec); return ACPI_INTERRUPT_HANDLED; } clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);