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