Commit | Line | Data |
---|---|---|
77cb907a AS |
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 | ||
08a149c4 | 11 | #include <linux/err.h> |
08a149c4 AS |
12 | #include <linux/types.h> |
13 | ||
14 | #include <linux/gpio/consumer.h> | |
15 | ||
08a149c4 AS |
16 | struct device; |
17 | struct fwnode_handle; | |
18 | ||
19 | struct gpio_chip; | |
20 | struct gpio_desc; | |
21 | struct gpio_device; | |
77cb907a | 22 | |
77cb907a AS |
23 | #ifdef CONFIG_ACPI |
24 | void acpi_gpiochip_add(struct gpio_chip *chip); | |
25 | void acpi_gpiochip_remove(struct gpio_chip *chip); | |
26 | ||
27 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); | |
28 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | |
29 | ||
2b6bce80 | 30 | struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, |
77cb907a AS |
31 | const char *con_id, |
32 | unsigned int idx, | |
33 | enum gpiod_flags *dflags, | |
34 | unsigned long *lookupflags); | |
77cb907a AS |
35 | |
36 | int acpi_gpio_count(struct device *dev, const char *con_id); | |
77cb907a AS |
37 | #else |
38 | static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } | |
39 | static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } | |
40 | ||
41 | static inline void | |
42 | acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } | |
43 | ||
44 | static inline void | |
45 | acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } | |
46 | ||
77cb907a | 47 | static inline struct gpio_desc * |
2b6bce80 | 48 | acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, |
77cb907a AS |
49 | unsigned int idx, enum gpiod_flags *dflags, |
50 | unsigned long *lookupflags) | |
51 | { | |
52 | return ERR_PTR(-ENOENT); | |
53 | } | |
77cb907a AS |
54 | static inline int acpi_gpio_count(struct device *dev, const char *con_id) |
55 | { | |
56 | return -ENODEV; | |
57 | } | |
77cb907a AS |
58 | #endif |
59 | ||
60 | #endif /* GPIOLIB_ACPI_H */ |