Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / gpio / gpiolib-acpi.h
blobe2edb632b2cc9bf8ecc809548ac4e1dc35e5b596
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * ACPI helpers for GPIO API
5 * Copyright (C) 2012,2019 Intel Corporation
6 */
8 #ifndef GPIOLIB_ACPI_H
9 #define GPIOLIB_ACPI_H
11 struct acpi_device;
13 /**
14 * struct acpi_gpio_info - ACPI GPIO specific information
15 * @adev: reference to ACPI device which consumes GPIO resource
16 * @flags: GPIO initialization flags
17 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
18 * @pin_config: pin bias as provided by ACPI
19 * @polarity: interrupt polarity as provided by ACPI
20 * @triggering: triggering type as provided by ACPI
21 * @debounce: debounce timeout as provided by ACPI
22 * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
24 struct acpi_gpio_info {
25 struct acpi_device *adev;
26 enum gpiod_flags flags;
27 bool gpioint;
28 int pin_config;
29 int polarity;
30 int triggering;
31 unsigned int debounce;
32 unsigned int quirks;
35 #ifdef CONFIG_ACPI
36 void acpi_gpiochip_add(struct gpio_chip *chip);
37 void acpi_gpiochip_remove(struct gpio_chip *chip);
39 void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
40 void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
42 int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags,
43 struct acpi_gpio_info *info);
44 int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
45 struct acpi_gpio_info *info);
47 struct gpio_desc *acpi_find_gpio(struct device *dev,
48 const char *con_id,
49 unsigned int idx,
50 enum gpiod_flags *dflags,
51 unsigned long *lookupflags);
52 struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode,
53 const char *propname, int index,
54 struct acpi_gpio_info *info);
56 int acpi_gpio_count(struct device *dev, const char *con_id);
57 #else
58 static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
59 static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
61 static inline void
62 acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
64 static inline void
65 acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
67 static inline int
68 acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
70 return 0;
72 static inline int
73 acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
74 struct acpi_gpio_info *info)
76 return 0;
79 static inline struct gpio_desc *
80 acpi_find_gpio(struct device *dev, const char *con_id,
81 unsigned int idx, enum gpiod_flags *dflags,
82 unsigned long *lookupflags)
84 return ERR_PTR(-ENOENT);
86 static inline struct gpio_desc *
87 acpi_node_get_gpiod(struct fwnode_handle *fwnode, const char *propname,
88 int index, struct acpi_gpio_info *info)
90 return ERR_PTR(-ENXIO);
92 static inline int acpi_gpio_count(struct device *dev, const char *con_id)
94 return -ENODEV;
96 #endif
98 #endif /* GPIOLIB_ACPI_H */