2019-07-17 07:10:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef GPIOLIB_OF_H
|
|
|
|
#define GPIOLIB_OF_H
|
|
|
|
|
2022-10-07 09:53:44 +00:00
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
|
|
|
|
struct device;
|
2024-02-29 14:51:38 +00:00
|
|
|
struct fwnode_handle;
|
2022-10-07 09:53:44 +00:00
|
|
|
|
2019-07-17 07:10:01 +00:00
|
|
|
struct gpio_chip;
|
2022-10-07 09:53:44 +00:00
|
|
|
struct gpio_desc;
|
|
|
|
struct gpio_device;
|
2019-07-17 07:10:01 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_OF_GPIO
|
2022-11-15 10:16:24 +00:00
|
|
|
struct gpio_desc *of_find_gpio(struct device_node *np,
|
2019-07-17 07:10:01 +00:00
|
|
|
const char *con_id,
|
|
|
|
unsigned int idx,
|
|
|
|
unsigned long *lookupflags);
|
|
|
|
int of_gpiochip_add(struct gpio_chip *gc);
|
|
|
|
void of_gpiochip_remove(struct gpio_chip *gc);
|
2024-02-29 14:51:38 +00:00
|
|
|
int of_gpio_count(const struct fwnode_handle *fwnode, const char *con_id);
|
2019-07-17 07:10:01 +00:00
|
|
|
#else
|
2022-11-15 10:16:24 +00:00
|
|
|
static inline struct gpio_desc *of_find_gpio(struct device_node *np,
|
2019-07-17 07:10:01 +00:00
|
|
|
const char *con_id,
|
|
|
|
unsigned int idx,
|
|
|
|
unsigned long *lookupflags)
|
|
|
|
{
|
|
|
|
return ERR_PTR(-ENOENT);
|
|
|
|
}
|
|
|
|
static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
|
|
|
|
static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
|
2024-02-29 14:51:38 +00:00
|
|
|
static inline int of_gpio_count(const struct fwnode_handle *fwnode,
|
|
|
|
const char *con_id)
|
2019-07-17 07:10:01 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_OF_GPIO */
|
|
|
|
|
2020-02-20 13:01:49 +00:00
|
|
|
extern struct notifier_block gpio_of_notifier;
|
|
|
|
|
2019-07-17 07:10:01 +00:00
|
|
|
#endif /* GPIOLIB_OF_H */
|