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

source code of linux/drivers/gpio/gpiolib-acpi.h