aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2013-10-10 04:01:08 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-10-19 17:30:51 -0400
commit936e15dd2128eb5aa71251766f1176552b45f43c (patch)
tree43443f12206375f6a1503c0924c7864ada8c67a4 /include/linux
parentbae48da237fcedd7ad09569025483b988635efb7 (diff)
gpiolib / ACPI: convert to gpiod interfaces
The new GPIO descriptor based interface is now preferred over the old integer based one. This patch converts the ACPI GPIO helpers to use this new interface internally. In addition to that provide compatibility function acpi_get_gpio_by_index() that converts the returned GPIO descriptor to an integer. We also drop acpi_get_gpio() as it is not used anywhere outside gpiolib-acpi and even there we use acpi_get_gpiod() instead. 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 'include/linux')
-rw-r--r--include/linux/acpi_gpio.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
index 4c120a1e0ca3..b6ce601e55a2 100644
--- a/include/linux/acpi_gpio.h
+++ b/include/linux/acpi_gpio.h
@@ -2,8 +2,10 @@
2#define _LINUX_ACPI_GPIO_H_ 2#define _LINUX_ACPI_GPIO_H_
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h>
5#include <linux/errno.h> 6#include <linux/errno.h>
6#include <linux/gpio.h> 7#include <linux/gpio.h>
8#include <linux/gpio/consumer.h>
7 9
8/** 10/**
9 * struct acpi_gpio_info - ACPI GPIO specific information 11 * struct acpi_gpio_info - ACPI GPIO specific information
@@ -15,23 +17,18 @@ struct acpi_gpio_info {
15 17
16#ifdef CONFIG_GPIO_ACPI 18#ifdef CONFIG_GPIO_ACPI
17 19
18int acpi_get_gpio(char *path, int pin); 20struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
19int acpi_get_gpio_by_index(struct device *dev, int index, 21 struct acpi_gpio_info *info);
20 struct acpi_gpio_info *info);
21void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); 22void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
22void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); 23void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
23 24
24#else /* CONFIG_GPIO_ACPI */ 25#else /* CONFIG_GPIO_ACPI */
25 26
26static inline int acpi_get_gpio(char *path, int pin) 27static inline struct gpio_desc *
28acpi_get_gpiod_by_index(struct device *dev, int index,
29 struct acpi_gpio_info *info)
27{ 30{
28 return -ENODEV; 31 return ERR_PTR(-ENOSYS);
29}
30
31static inline int acpi_get_gpio_by_index(struct device *dev, int index,
32 struct acpi_gpio_info *info)
33{
34 return -ENODEV;
35} 32}
36 33
37static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } 34static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
@@ -39,4 +36,14 @@ static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
39 36
40#endif /* CONFIG_GPIO_ACPI */ 37#endif /* CONFIG_GPIO_ACPI */
41 38
39static inline int acpi_get_gpio_by_index(struct device *dev, int index,
40 struct acpi_gpio_info *info)
41{
42 struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
43
44 if (IS_ERR(desc))
45 return PTR_ERR(desc);
46 return desc_to_gpio(desc);
47}
48
42#endif /* _LINUX_ACPI_GPIO_H_ */ 49#endif /* _LINUX_ACPI_GPIO_H_ */