0001
0002
0003 #ifndef GPIOLIB_OF_H
0004 #define GPIOLIB_OF_H
0005
0006 struct gpio_chip;
0007 enum of_gpio_flags;
0008
0009 #ifdef CONFIG_OF_GPIO
0010 struct gpio_desc *of_find_gpio(struct device *dev,
0011 const char *con_id,
0012 unsigned int idx,
0013 unsigned long *lookupflags);
0014 int of_gpiochip_add(struct gpio_chip *gc);
0015 void of_gpiochip_remove(struct gpio_chip *gc);
0016 int of_gpio_get_count(struct device *dev, const char *con_id);
0017 bool of_gpio_need_valid_mask(const struct gpio_chip *gc);
0018 void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev);
0019 #else
0020 static inline struct gpio_desc *of_find_gpio(struct device *dev,
0021 const char *con_id,
0022 unsigned int idx,
0023 unsigned long *lookupflags)
0024 {
0025 return ERR_PTR(-ENOENT);
0026 }
0027 static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
0028 static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
0029 static inline int of_gpio_get_count(struct device *dev, const char *con_id)
0030 {
0031 return 0;
0032 }
0033 static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
0034 {
0035 return false;
0036 }
0037 static inline void of_gpio_dev_init(struct gpio_chip *gc,
0038 struct gpio_device *gdev)
0039 {
0040 }
0041 #endif
0042
0043 extern struct notifier_block gpio_of_notifier;
0044
0045 #endif