1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * ACPI helpers for GPIO API 4 * 5 * Copyright (C) 2012,2019 Intel Corporation 6 */ 7 8 #ifndef GPIOLIB_ACPI_H 9 #define GPIOLIB_ACPI_H 10 11 #include <linux/err.h> 12 #include <linux/errno.h> 13 #include <linux/types.h> 14 15 #include <linux/gpio/consumer.h> 16 17 struct device; 18 struct fwnode_handle; 19 20 struct gpio_chip; 21 struct gpio_desc; 22 struct gpio_device; 23 24 #ifdef CONFIG_ACPI 25 void acpi_gpiochip_add(struct gpio_chip *chip); 26 void acpi_gpiochip_remove(struct gpio_chip *chip); 27 28 void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev); 29 30 void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); 31 void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); 32 33 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, 34 const char *con_id, 35 unsigned int idx, 36 enum gpiod_flags *dflags, 37 unsigned long *lookupflags); 38 39 int acpi_gpio_count(struct device *dev, const char *con_id); 40 #else 41 static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } 42 static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } 43 44 static inline void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) { } 45 46 static inline void 47 acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } 48 49 static inline void 50 acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } 51 52 static inline struct gpio_desc * 53 acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, 54 unsigned int idx, enum gpiod_flags *dflags, 55 unsigned long *lookupflags) 56 { 57 return ERR_PTR(-ENOENT); 58 } 59 static inline int acpi_gpio_count(struct device *dev, const char *con_id) 60 { 61 return -ENODEV; 62 } 63 #endif 64 65 #endif /* GPIOLIB_ACPI_H */ 66