提交 1b2ca32a 编写于 作者: A Andy Shevchenko 提交者: Linus Walleij

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: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 ce0929d2
...@@ -496,11 +496,18 @@ int ...@@ -496,11 +496,18 @@ int
acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info) acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
{ {
struct device *dev = &info->adev->dev; struct device *dev = &info->adev->dev;
enum gpiod_flags old = *flags;
int ret; int ret;
ret = __acpi_gpio_update_gpiod_flags(flags, info->flags); ret = __acpi_gpio_update_gpiod_flags(&old, info->flags);
if (ret) if (info->quirks & ACPI_GPIO_QUIRK_NO_IO_RESTRICTION) {
dev_dbg(dev, "Override GPIO initialization flags\n"); 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; return ret;
} }
......
...@@ -978,6 +978,10 @@ struct acpi_gpio_mapping { ...@@ -978,6 +978,10 @@ struct acpi_gpio_mapping {
const char *name; const char *name;
const struct acpi_gpio_params *data; const struct acpi_gpio_params *data;
unsigned int size; unsigned int size;
/* Ignore IoRestriction field */
#define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0)
unsigned int quirks; unsigned int quirks;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册