diff options
-rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 16 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.h | 23 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-baytrail.c | 4 | ||||
-rw-r--r-- | include/linux/acpi_gpio.h | 6 |
5 files changed, 39 insertions, 14 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 137d20c70afe..739b72b6731a 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -94,7 +94,7 @@ static void acpi_gpio_evt_dh(acpi_handle handle, void *data) | |||
94 | * gpio pins have acpi event methods and assigns interrupt handlers that calls | 94 | * gpio pins have acpi event methods and assigns interrupt handlers that calls |
95 | * the acpi event methods for those pins. | 95 | * the acpi event methods for those pins. |
96 | */ | 96 | */ |
97 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | 97 | static void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) |
98 | { | 98 | { |
99 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; | 99 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; |
100 | struct acpi_resource *res; | 100 | struct acpi_resource *res; |
@@ -192,7 +192,6 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) | |||
192 | irq); | 192 | irq); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | EXPORT_SYMBOL(acpi_gpiochip_request_interrupts); | ||
196 | 195 | ||
197 | /** | 196 | /** |
198 | * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts. | 197 | * acpi_gpiochip_free_interrupts() - Free GPIO _EVT ACPI event interrupts. |
@@ -203,7 +202,7 @@ EXPORT_SYMBOL(acpi_gpiochip_request_interrupts); | |||
203 | * The remaining ACPI event interrupts associated with the chip are freed | 202 | * The remaining ACPI event interrupts associated with the chip are freed |
204 | * automatically. | 203 | * automatically. |
205 | */ | 204 | */ |
206 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | 205 | static void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) |
207 | { | 206 | { |
208 | acpi_handle handle; | 207 | acpi_handle handle; |
209 | acpi_status status; | 208 | acpi_status status; |
@@ -230,7 +229,6 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
230 | acpi_detach_data(handle, acpi_gpio_evt_dh); | 229 | acpi_detach_data(handle, acpi_gpio_evt_dh); |
231 | kfree(evt_pins); | 230 | kfree(evt_pins); |
232 | } | 231 | } |
233 | EXPORT_SYMBOL(acpi_gpiochip_free_interrupts); | ||
234 | 232 | ||
235 | struct acpi_gpio_lookup { | 233 | struct acpi_gpio_lookup { |
236 | struct acpi_gpio_info info; | 234 | struct acpi_gpio_info info; |
@@ -310,3 +308,13 @@ struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | |||
310 | return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); | 308 | return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); |
311 | } | 309 | } |
312 | EXPORT_SYMBOL_GPL(acpi_get_gpiod_by_index); | 310 | EXPORT_SYMBOL_GPL(acpi_get_gpiod_by_index); |
311 | |||
312 | void acpi_gpiochip_add(struct gpio_chip *chip) | ||
313 | { | ||
314 | acpi_gpiochip_request_interrupts(chip); | ||
315 | } | ||
316 | |||
317 | void acpi_gpiochip_remove(struct gpio_chip *chip) | ||
318 | { | ||
319 | acpi_gpiochip_free_interrupts(chip); | ||
320 | } | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c0b06a9adad9..0de4069e33ab 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
17 | #include <linux/gpio/driver.h> | 17 | #include <linux/gpio/driver.h> |
18 | 18 | ||
19 | #include "gpiolib.h" | ||
20 | |||
19 | #define CREATE_TRACE_POINTS | 21 | #define CREATE_TRACE_POINTS |
20 | #include <trace/events/gpio.h> | 22 | #include <trace/events/gpio.h> |
21 | 23 | ||
@@ -1226,6 +1228,7 @@ int gpiochip_add(struct gpio_chip *chip) | |||
1226 | #endif | 1228 | #endif |
1227 | 1229 | ||
1228 | of_gpiochip_add(chip); | 1230 | of_gpiochip_add(chip); |
1231 | acpi_gpiochip_add(chip); | ||
1229 | 1232 | ||
1230 | if (status) | 1233 | if (status) |
1231 | goto fail; | 1234 | goto fail; |
@@ -1267,6 +1270,7 @@ int gpiochip_remove(struct gpio_chip *chip) | |||
1267 | 1270 | ||
1268 | gpiochip_remove_pin_ranges(chip); | 1271 | gpiochip_remove_pin_ranges(chip); |
1269 | of_gpiochip_remove(chip); | 1272 | of_gpiochip_remove(chip); |
1273 | acpi_gpiochip_remove(chip); | ||
1270 | 1274 | ||
1271 | for (id = 0; id < chip->ngpio; id++) { | 1275 | for (id = 0; id < chip->ngpio; id++) { |
1272 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) { | 1276 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) { |
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h new file mode 100644 index 000000000000..2ed23ab8298c --- /dev/null +++ b/drivers/gpio/gpiolib.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Internal GPIO functions. | ||
3 | * | ||
4 | * Copyright (C) 2013, Intel Corporation | ||
5 | * Author: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef GPIOLIB_H | ||
13 | #define GPIOLIB_H | ||
14 | |||
15 | #ifdef CONFIG_ACPI | ||
16 | void acpi_gpiochip_add(struct gpio_chip *chip); | ||
17 | void acpi_gpiochip_remove(struct gpio_chip *chip); | ||
18 | #else | ||
19 | static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } | ||
20 | static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } | ||
21 | #endif | ||
22 | |||
23 | #endif /* GPIOLIB_H */ | ||
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 31c8b3257a94..72e6a298a1e9 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
30 | #include <linux/irqdomain.h> | 30 | #include <linux/irqdomain.h> |
31 | #include <linux/acpi.h> | 31 | #include <linux/acpi.h> |
32 | #include <linux/acpi_gpio.h> | ||
33 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
34 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
35 | #include <linux/io.h> | 34 | #include <linux/io.h> |
@@ -485,9 +484,6 @@ static int byt_gpio_probe(struct platform_device *pdev) | |||
485 | 484 | ||
486 | irq_set_handler_data(hwirq, vg); | 485 | irq_set_handler_data(hwirq, vg); |
487 | irq_set_chained_handler(hwirq, byt_gpio_irq_handler); | 486 | irq_set_chained_handler(hwirq, byt_gpio_irq_handler); |
488 | |||
489 | /* Register interrupt handlers for gpio signaled acpi events */ | ||
490 | acpi_gpiochip_request_interrupts(gc); | ||
491 | } | 487 | } |
492 | 488 | ||
493 | pm_runtime_enable(dev); | 489 | pm_runtime_enable(dev); |
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h index d875bc3dba3c..af96a0d452f6 100644 --- a/include/linux/acpi_gpio.h +++ b/include/linux/acpi_gpio.h | |||
@@ -21,9 +21,6 @@ struct acpi_gpio_info { | |||
21 | 21 | ||
22 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | 22 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, |
23 | struct acpi_gpio_info *info); | 23 | struct acpi_gpio_info *info); |
24 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); | ||
25 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | ||
26 | |||
27 | #else /* CONFIG_GPIO_ACPI */ | 24 | #else /* CONFIG_GPIO_ACPI */ |
28 | 25 | ||
29 | static inline struct gpio_desc * | 26 | static inline struct gpio_desc * |
@@ -33,9 +30,6 @@ acpi_get_gpiod_by_index(struct device *dev, int index, | |||
33 | return ERR_PTR(-ENOSYS); | 30 | return ERR_PTR(-ENOSYS); |
34 | } | 31 | } |
35 | 32 | ||
36 | static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } | ||
37 | static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } | ||
38 | |||
39 | #endif /* CONFIG_GPIO_ACPI */ | 33 | #endif /* CONFIG_GPIO_ACPI */ |
40 | 34 | ||
41 | static inline int acpi_get_gpio_by_index(struct device *dev, int index, | 35 | static inline int acpi_get_gpio_by_index(struct device *dev, int index, |