From: Andy Shevchenko Date: Mon, 9 Nov 2020 20:53:28 +0000 (+0200) Subject: gpiolib: acpi: Make acpi_gpio_to_gpiod_flags() usable for GpioInt() X-Git-Tag: accepted/tizen/unified/20230118.172025~8222^2~33^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bca404802ceade19d7649a840178c415316814cc;p=platform%2Fkernel%2Flinux-rpi.git gpiolib: acpi: Make acpi_gpio_to_gpiod_flags() usable for GpioInt() 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 Acked-by: Linus Walleij Reviewed-by: Hans de Goede Reviewed-by: Mika Westerberg --- diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index b47d5e8..644067c 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -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; @@ -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;