From: Alexey Starikovskiy <astarikovskiy@suse.de>
Subject: ACPI: EC: Don't degrade to poll mode at storm automatically.
References: bnc#446142
Patch-Mainline: no

Signed-off-by: Thomas Renninger <trenn@suse.de>

Not all users of semi-broken EC devices want to degrade to poll mode, so
give them right to choose.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 Documentation/kernel-parameters.txt |    5 +++++
 drivers/acpi/ec.c                   |   15 +++++++++++++++
 2 files changed, 20 insertions(+)


--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -691,6 +691,11 @@ and is between 256 and 4096 characters.
 
 	eata=		[HW,SCSI]
 
+	ec_intr=	[HW,ACPI] ACPI Embedded Controller interrupt mode
+			Format: <int>
+			0: polling mode
+			non-0: interrupt mode (default)
+
 	edd=		[EDD]
 			Format: {"off" | "on" | "skip[mbr]"}
 
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -118,6 +118,8 @@ static struct acpi_ec {
 	spinlock_t curr_lock;
 } *boot_ec, *first_ec;
 
+int acpi_ec_intr = 1; /* Default is interrupt mode */
+
 static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
 
 /* --------------------------------------------------------------------------
@@ -754,6 +756,8 @@ static int ec_install_handlers(struct ac
 				  &acpi_ec_gpe_handler, ec);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
+	if (!acpi_ec_intr)
+		set_bit(EC_FLAGS_NO_GPE, &ec->flags);
 	acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
 	acpi_enable_gpe(NULL, ec->gpe);
 	status = acpi_install_address_space_handler(ec->handle,
@@ -1034,3 +1038,14 @@ static void __exit acpi_ec_exit(void)
 	return;
 }
 #endif	/* 0 */
+
+static int __init acpi_ec_set_intr_mode(char *str)
+{
+	if (!get_option(&str, &acpi_ec_intr)) {
+		acpi_ec_intr = 0;
+		return 0;
+	}
+	return 1;
+}
+
+__setup("ec_intr=", acpi_ec_set_intr_mode);
