diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-11-10 14:40:33 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-11-30 10:53:52 +0100 |
commit | 1b2ca32ab0b8311da84fe692522266b32ad4315e (patch) | |
tree | 013f02dc39d22c86eed547a7b0d25a867c3f811d /drivers/gpio/gpiolib-acpi.c | |
parent | gpiolib: acpi: Add quirks field to struct acpi_gpio_mapping (diff) | |
download | linux-1b2ca32ab0b8311da84fe692522266b32ad4315e.tar.xz linux-1b2ca32ab0b8311da84fe692522266b32ad4315e.zip |
gpiolib: acpi: Introduce NO_RESTRICTION quirk
Allow to relax IoRestriction for certain cases.
One of the use case is incorrectly cooked ACPI table where interrupt pin is
defined with GpioIo() macro with IoRestrictionOutputOnly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-acpi.c')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 711f64b9dd30..430a1475212d 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -496,11 +496,18 @@ int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info) { struct device *dev = &info->adev->dev; + enum gpiod_flags old = *flags; int ret; - ret = __acpi_gpio_update_gpiod_flags(flags, info->flags); - if (ret) - dev_dbg(dev, "Override GPIO initialization flags\n"); + ret = __acpi_gpio_update_gpiod_flags(&old, info->flags); + if (info->quirks & ACPI_GPIO_QUIRK_NO_IO_RESTRICTION) { + if (ret) + dev_warn(dev, FW_BUG "GPIO not in correct mode, fixing\n"); + } else { + if (ret) + dev_dbg(dev, "Override GPIO initialization flags\n"); + *flags = old; + } return ret; } |