]>
Commit | Line | Data |
---|---|---|
e29482e8 MN |
1 | #ifndef _LINUX_ACPI_GPIO_H_ |
2 | #define _LINUX_ACPI_GPIO_H_ | |
3 | ||
12028d2d | 4 | #include <linux/device.h> |
936e15dd | 5 | #include <linux/err.h> |
e29482e8 | 6 | #include <linux/errno.h> |
0d1c28a4 | 7 | #include <linux/gpio.h> |
936e15dd | 8 | #include <linux/gpio/consumer.h> |
e29482e8 | 9 | |
12028d2d MW |
10 | /** |
11 | * struct acpi_gpio_info - ACPI GPIO specific information | |
12 | * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo | |
13 | */ | |
14 | struct acpi_gpio_info { | |
15 | bool gpioint; | |
16 | }; | |
17 | ||
e29482e8 MN |
18 | #ifdef CONFIG_GPIO_ACPI |
19 | ||
936e15dd MW |
20 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, |
21 | struct acpi_gpio_info *info); | |
0d1c28a4 | 22 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); |
7fc7acb9 | 23 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); |
e29482e8 MN |
24 | |
25 | #else /* CONFIG_GPIO_ACPI */ | |
26 | ||
936e15dd MW |
27 | static inline struct gpio_desc * |
28 | acpi_get_gpiod_by_index(struct device *dev, int index, | |
29 | struct acpi_gpio_info *info) | |
e29482e8 | 30 | { |
936e15dd | 31 | return ERR_PTR(-ENOSYS); |
12028d2d MW |
32 | } |
33 | ||
0d1c28a4 | 34 | static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } |
7fc7acb9 | 35 | static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } |
0d1c28a4 | 36 | |
e29482e8 MN |
37 | #endif /* CONFIG_GPIO_ACPI */ |
38 | ||
936e15dd MW |
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 | ||
e29482e8 | 49 | #endif /* _LINUX_ACPI_GPIO_H_ */ |