2019-07-17 09:10:01 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef GPIOLIB_OF_H
|
|
|
|
#define GPIOLIB_OF_H
|
|
|
|
|
2022-10-07 12:53:44 +03:00
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
|
2025-07-21 17:57:37 +02:00
|
|
|
struct device_node;
|
2024-02-29 16:51:38 +02:00
|
|
|
struct fwnode_handle;
|
2022-10-07 12:53:44 +03:00
|
|
|
|
2019-07-17 09:10:01 +02:00
|
|
|
struct gpio_chip;
|
2022-10-07 12:53:44 +03:00
|
|
|
struct gpio_desc;
|
|
|
|
struct gpio_device;
|
2019-07-17 09:10:01 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_OF_GPIO
|
2022-11-15 11:16:24 +01:00
|
|
|
struct gpio_desc *of_find_gpio(struct device_node *np,
|
2019-07-17 09:10:01 +02: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);
|
2025-04-08 23:11:20 +08:00
|
|
|
bool of_gpiochip_instance_match(struct gpio_chip *gc, unsigned int index);
|
2024-02-29 16:51:38 +02:00
|
|
|
int of_gpio_count(const struct fwnode_handle *fwnode, const char *con_id);
|
2019-07-17 09:10:01 +02:00
|
|
|
#else
|
2022-11-15 11:16:24 +01:00
|
|
|
static inline struct gpio_desc *of_find_gpio(struct device_node *np,
|
2019-07-17 09:10:01 +02: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) { }
|
2025-04-08 23:11:20 +08:00
|
|
|
static inline bool of_gpiochip_instance_match(struct gpio_chip *gc,
|
|
|
|
unsigned int index)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2024-02-29 16:51:38 +02:00
|
|
|
static inline int of_gpio_count(const struct fwnode_handle *fwnode,
|
|
|
|
const char *con_id)
|
2019-07-17 09:10:01 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_OF_GPIO */
|
|
|
|
|
2020-02-20 14:01:49 +01:00
|
|
|
extern struct notifier_block gpio_of_notifier;
|
|
|
|
|
2019-07-17 09:10:01 +02:00
|
|
|
#endif /* GPIOLIB_OF_H */
|