Skip to content

Commit

Permalink
gpiolib: acpi: Make acpi_gpio_to_gpiod_flags() usable for GpioInt()
Browse files Browse the repository at this point in the history
GpioInt() implies input configuration of the pin. Add this to
the acpi_gpio_to_gpiod_flags() and make usable for GpioInt().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  • Loading branch information
Andy Shevchenko committed Nov 16, 2020
1 parent 56f7058 commit bca4048
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpio/gpiolib-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
static enum gpiod_flags
acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio, int polarity)
{
/* GpioInt() implies input configuration */
if (agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)
return GPIOD_IN;

switch (agpio->io_restriction) {
case ACPI_IO_RESTRICT_INPUT:
return GPIOD_IN;
Expand Down Expand Up @@ -681,13 +685,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
* - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH
*/
if (lookup->info.gpioint) {
lookup->info.flags = GPIOD_IN;
lookup->info.polarity = agpio->polarity;
lookup->info.triggering = agpio->triggering;
} else {
lookup->info.polarity = lookup->active_low;
lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity);
}

lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity);
}

return 1;
Expand Down

0 comments on commit bca4048

Please sign in to comment.