diff options
Diffstat (limited to 'include/linux/acpi_gpio.h')
-rw-r--r-- | include/linux/acpi_gpio.h | 29 |
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 | ||
18 | int acpi_get_gpio(char *path, int pin); | 20 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, |
19 | int acpi_get_gpio_by_index(struct device *dev, int index, | 21 | struct acpi_gpio_info *info); |
20 | struct acpi_gpio_info *info); | ||
21 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); | 22 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); |
22 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | 23 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); |
23 | 24 | ||
24 | #else /* CONFIG_GPIO_ACPI */ | 25 | #else /* CONFIG_GPIO_ACPI */ |
25 | 26 | ||
26 | static inline int acpi_get_gpio(char *path, int pin) | 27 | static inline struct gpio_desc * |
28 | acpi_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 | |||
31 | static 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 | ||
37 | static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } | 34 | static 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 | ||
39 | static 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_ */ |