Merge remote-tracking branch 'asoc/topic/compress' into asoc-next
[linux-2.6/btrfs-unstable.git] / include / linux / acpi_gpio.h
blobd875bc3dba3cd044181e29be75084f328234d129
1 #ifndef _LINUX_ACPI_GPIO_H_
2 #define _LINUX_ACPI_GPIO_H_
4 #include <linux/device.h>
5 #include <linux/err.h>
6 #include <linux/errno.h>
7 #include <linux/gpio.h>
8 #include <linux/gpio/consumer.h>
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 * @active_low: in case of @gpioint, the pin is active low
15 struct acpi_gpio_info {
16 bool gpioint;
17 bool active_low;
20 #ifdef CONFIG_GPIO_ACPI
22 struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
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);
27 #else /* CONFIG_GPIO_ACPI */
29 static inline struct gpio_desc *
30 acpi_get_gpiod_by_index(struct device *dev, int index,
31 struct acpi_gpio_info *info)
33 return ERR_PTR(-ENOSYS);
36 static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
37 static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
39 #endif /* CONFIG_GPIO_ACPI */
41 static inline int acpi_get_gpio_by_index(struct device *dev, int index,
42 struct acpi_gpio_info *info)
44 struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
46 if (IS_ERR(desc))
47 return PTR_ERR(desc);
48 return desc_to_gpio(desc);
51 #endif /* _LINUX_ACPI_GPIO_H_ */