]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
gpiolib: acpi: Respect pin bias setting
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 10 Apr 2019 15:39:21 +0000 (18:39 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Apr 2019 08:55:28 +0000 (10:55 +0200)
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>
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib.h

index 9c6ebaaa02fe34d6abfd11a0946f538a7bf4fc23..c9fc9e232aafb37d67c7b72b83183b778963d41a 100644 (file)
@@ -528,6 +528,17 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *inf
 int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
                                        struct acpi_gpio_info *info)
 {
+       switch (info->pin_config) {
+       case ACPI_PIN_CONFIG_PULLUP:
+               *lookupflags |= GPIO_PULL_UP;
+               break;
+       case ACPI_PIN_CONFIG_PULLDOWN:
+               *lookupflags |= GPIO_PULL_DOWN;
+               break;
+       default:
+               break;
+       }
+
        if (info->polarity == GPIO_ACTIVE_LOW)
                *lookupflags |= GPIO_ACTIVE_LOW;
 
@@ -567,6 +578,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
 
                lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
                                              agpio->pin_table[pin_index]);
+               lookup->info.pin_config = agpio->pin_config;
                lookup->info.gpioint = gpioint;
 
                /*
index e1636e152a6c1091e5aad477ef99ba7ee90685e2..cf79b1d78af0da3264930246d01670447e916220 100644 (file)
@@ -74,6 +74,7 @@ struct gpio_device {
  * @adev: reference to ACPI device which consumes GPIO resource
  * @flags: GPIO initialization flags
  * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
+ * @pin_config: pin bias as provided by ACPI
  * @polarity: interrupt polarity as provided by ACPI
  * @triggering: triggering type as provided by ACPI
  * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
@@ -82,6 +83,7 @@ struct acpi_gpio_info {
        struct acpi_device *adev;
        enum gpiod_flags flags;
        bool gpioint;
+       int pin_config;
        int polarity;
        int triggering;
        unsigned int quirks;