Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: acpi: Respect pin bias setting

For now, we don't take into account the pin bias settings supplied by ACPI.
This change is targeting the mentioned gap.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
2d3b6db1 606be344

+14
+12
drivers/gpio/gpiolib-acpi.c
··· 528 528 int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, 529 529 struct acpi_gpio_info *info) 530 530 { 531 + switch (info->pin_config) { 532 + case ACPI_PIN_CONFIG_PULLUP: 533 + *lookupflags |= GPIO_PULL_UP; 534 + break; 535 + case ACPI_PIN_CONFIG_PULLDOWN: 536 + *lookupflags |= GPIO_PULL_DOWN; 537 + break; 538 + default: 539 + break; 540 + } 541 + 531 542 if (info->polarity == GPIO_ACTIVE_LOW) 532 543 *lookupflags |= GPIO_ACTIVE_LOW; 533 544 ··· 578 567 579 568 lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, 580 569 agpio->pin_table[pin_index]); 570 + lookup->info.pin_config = agpio->pin_config; 581 571 lookup->info.gpioint = gpioint; 582 572 583 573 /*
+2
drivers/gpio/gpiolib.h
··· 74 74 * @adev: reference to ACPI device which consumes GPIO resource 75 75 * @flags: GPIO initialization flags 76 76 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo 77 + * @pin_config: pin bias as provided by ACPI 77 78 * @polarity: interrupt polarity as provided by ACPI 78 79 * @triggering: triggering type as provided by ACPI 79 80 * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping ··· 83 82 struct acpi_device *adev; 84 83 enum gpiod_flags flags; 85 84 bool gpioint; 85 + int pin_config; 86 86 int polarity; 87 87 int triggering; 88 88 unsigned int quirks;