Commit 6b6af7bd authored by Mario Limonciello's avatar Mario Limonciello Committed by Andy Shevchenko

gpiolib: acpi: Add support to ignore programming an interrupt

gpiolib-acpi already had support for ignoring a pin for wakeup, but
if an OEM configures a floating pin as an interrupt source then
stopping it from being a wakeup won't do much good to stop the
interrupt storm.

Add support for a module parameter and quirk infrastructure to
ignore interrupts as well.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 568035b0
...@@ -32,9 +32,16 @@ MODULE_PARM_DESC(ignore_wake, ...@@ -32,9 +32,16 @@ MODULE_PARM_DESC(ignore_wake,
"controller@pin combos on which to ignore the ACPI wake flag " "controller@pin combos on which to ignore the ACPI wake flag "
"ignore_wake=controller@pin[,controller@pin[,...]]"); "ignore_wake=controller@pin[,controller@pin[,...]]");
static char *ignore_interrupt;
module_param(ignore_interrupt, charp, 0444);
MODULE_PARM_DESC(ignore_interrupt,
"controller@pin combos on which to ignore interrupt "
"ignore_interrupt=controller@pin[,controller@pin[,...]]");
struct acpi_gpiolib_dmi_quirk { struct acpi_gpiolib_dmi_quirk {
bool no_edge_events_on_boot; bool no_edge_events_on_boot;
char *ignore_wake; char *ignore_wake;
char *ignore_interrupt;
}; };
/** /**
...@@ -317,14 +324,15 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip, ...@@ -317,14 +324,15 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
return desc; return desc;
} }
static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin_in) static bool acpi_gpio_in_ignore_list(const char *ignore_list, const char *controller_in,
unsigned int pin_in)
{ {
const char *controller, *pin_str; const char *controller, *pin_str;
unsigned int pin; unsigned int pin;
char *endp; char *endp;
int len; int len;
controller = ignore_wake; controller = ignore_list;
while (controller) { while (controller) {
pin_str = strchr(controller, '@'); pin_str = strchr(controller, '@');
if (!pin_str) if (!pin_str)
...@@ -348,7 +356,7 @@ static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin ...@@ -348,7 +356,7 @@ static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin
return false; return false;
err: err:
pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_wake: %s\n", ignore_wake); pr_err_once("Error: Invalid value for gpiolib_acpi.ignore_...: %s\n", ignore_list);
return false; return false;
} }
...@@ -360,7 +368,7 @@ static bool acpi_gpio_irq_is_wake(struct device *parent, ...@@ -360,7 +368,7 @@ static bool acpi_gpio_irq_is_wake(struct device *parent,
if (agpio->wake_capable != ACPI_WAKE_CAPABLE) if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
return false; return false;
if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) { if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) {
dev_info(parent, "Ignoring wakeup on pin %u\n", pin); dev_info(parent, "Ignoring wakeup on pin %u\n", pin);
return false; return false;
} }
...@@ -427,6 +435,11 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, ...@@ -427,6 +435,11 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
goto fail_unlock_irq; goto fail_unlock_irq;
} }
if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) {
dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin);
return AE_OK;
}
event = kzalloc(sizeof(*event), GFP_KERNEL); event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event) if (!event)
goto fail_unlock_irq; goto fail_unlock_irq;
...@@ -1585,6 +1598,9 @@ static int __init acpi_gpio_setup_params(void) ...@@ -1585,6 +1598,9 @@ static int __init acpi_gpio_setup_params(void)
if (ignore_wake == NULL && quirk && quirk->ignore_wake) if (ignore_wake == NULL && quirk && quirk->ignore_wake)
ignore_wake = quirk->ignore_wake; ignore_wake = quirk->ignore_wake;
if (ignore_interrupt == NULL && quirk && quirk->ignore_interrupt)
ignore_interrupt = quirk->ignore_interrupt;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment