diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-10-10 04:01:10 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-10-19 17:32:14 -0400 |
commit | e01f440a689aeb2d0e81c696fe2069f8d01d5d49 (patch) | |
tree | 656695ddd5ab89bf661b5d1a721d3f086328fcea /drivers/gpio | |
parent | 81f59e9d138c3ba0bd0f97d4e14f856d987e3f1d (diff) |
gpiolib / ACPI: allow passing GPIOF_ACTIVE_LOW for GpioInt resources
The ACPI GpioInt resources contain polarity field that is used to specify
whether the interrupt is active high or low. Since gpiolib supports
GPIOF_ACTIVE_LOW we can pass this information in the flags field in
acpi_find_gpio(), analogous to the DeviceTree version.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 03187d0a3045..ae0ffdce8bd5 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -253,6 +253,8 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) | |||
253 | agpio->pin_table[0]); | 253 | agpio->pin_table[0]); |
254 | lookup->info.gpioint = | 254 | lookup->info.gpioint = |
255 | agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; | 255 | agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; |
256 | lookup->info.active_low = | ||
257 | agpio->polarity == ACPI_ACTIVE_LOW; | ||
256 | } | 258 | } |
257 | 259 | ||
258 | return 1; | 260 | return 1; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index bee93c8c2361..9f3326b95e60 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -2264,7 +2264,17 @@ static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | |||
2264 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | 2264 | static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, |
2265 | unsigned int idx, unsigned long *flags) | 2265 | unsigned int idx, unsigned long *flags) |
2266 | { | 2266 | { |
2267 | return acpi_get_gpiod_by_index(dev, idx, NULL); | 2267 | struct acpi_gpio_info info; |
2268 | struct gpio_desc *desc; | ||
2269 | |||
2270 | desc = acpi_get_gpiod_by_index(dev, idx, &info); | ||
2271 | if (IS_ERR(desc)) | ||
2272 | return desc; | ||
2273 | |||
2274 | if (info.gpioint && info.active_low) | ||
2275 | *flags |= GPIOF_ACTIVE_LOW; | ||
2276 | |||
2277 | return desc; | ||
2268 | } | 2278 | } |
2269 | 2279 | ||
2270 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | 2280 | static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, |