xref: /openbmc/linux/drivers/gpio/gpiolib-acpi.h (revision 8e7a49e0)
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_gpiochip_request_interrupts(struct gpio_chip *chip);
29 void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
30 
31 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
32 				 const char *con_id,
33 				 unsigned int idx,
34 				 enum gpiod_flags *dflags,
35 				 unsigned long *lookupflags);
36 
37 int acpi_gpio_count(struct device *dev, const char *con_id);
38 #else
39 static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
40 static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
41 
42 static inline void
43 acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
44 
45 static inline void
46 acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
47 
48 static inline struct gpio_desc *
49 acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id,
50 	       unsigned int idx, enum gpiod_flags *dflags,
51 	       unsigned long *lookupflags)
52 {
53 	return ERR_PTR(-ENOENT);
54 }
55 static inline int acpi_gpio_count(struct device *dev, const char *con_id)
56 {
57 	return -ENODEV;
58 }
59 #endif
60 
61 #endif /* GPIOLIB_ACPI_H */
62