diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-02-06 21:49:46 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-02-08 18:29:51 +0100 |
commit | 4d1f7a6eabd45639d9de22a8a004f3c208d13c1a (patch) | |
tree | f83bd63b85d09c898b4137c3f9f2922a20de11ad /drivers/gpio/gpiolib-acpi.c | |
parent | ASoC: msm8916-wcd-digital: convert license header to SPDX (diff) | |
download | linux-4d1f7a6eabd45639d9de22a8a004f3c208d13c1a.tar.xz linux-4d1f7a6eabd45639d9de22a8a004f3c208d13c1a.zip |
gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
New quirk enforces search for GPIO based on its type,
i.e. iterate over GpioIo resources only.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/gpio/gpiolib-acpi.c')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 259cf6ab969b..4d291b75cb9f 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -530,17 +530,24 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) if (ares->type != ACPI_RESOURCE_TYPE_GPIO) return 1; - if (lookup->n++ == lookup->index && !lookup->desc) { + if (!lookup->desc) { const struct acpi_resource_gpio *agpio = &ares->data.gpio; - int pin_index = lookup->pin_index; + bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; + int pin_index; + if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) + lookup->index++; + + if (lookup->n++ != lookup->index) + return 1; + + pin_index = lookup->pin_index; if (pin_index >= agpio->pin_table_length) return 1; lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, agpio->pin_table[pin_index]); - lookup->info.gpioint = - agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; + lookup->info.gpioint = gpioint; /* * Polarity and triggering are only specified for GpioInt |