Lines Matching +full:gpio +full:-
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * <linux/gpio.h>
5 * This is the LEGACY GPIO bulk include file, including legacy APIs. It is
6 * used for GPIO drivers still referencing the global GPIO numberspace,
9 * If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
10 * If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
19 /* see Documentation/driver-api/gpio/legacy.rst */
21 /* make these flag values available regardless of GPIO kconfig options */
32 /* Gpio pin is active-low */
36 * struct gpio - a structure describing a GPIO with configuration
37 * @gpio: the GPIO number
38 * @flags: GPIO configuration as specified by GPIOF_*
39 * @label: a literal description string of this GPIO
41 struct gpio {
42 unsigned gpio;
49 #include <linux/gpio/consumer.h>
52 * "valid" GPIO numbers are nonnegative and may be passed to
56 * Invalid GPIO numbers are useful for indicating no-such-GPIO in
61 /* only non-negative numbers are valid */
66 * Platforms may implement their GPIO interface with library code,
67 * at a small performance cost for non-inlined operations and some
68 * extra memory (for code and for per-GPIO table entries).
74 * Until they are all fixed, leave 0-512 space for them.
78 /* Always use the library code for GPIO management calls,
81 int gpio_request(unsigned gpio, const char *label);
82 void gpio_free(unsigned gpio);
84 static inline int gpio_direction_input(unsigned gpio)
86 return gpiod_direction_input(gpio_to_desc(gpio));
88 static inline int gpio_direction_output(unsigned gpio, int value)
90 return gpiod_direction_output_raw(gpio_to_desc(gpio), value);
93 static inline int gpio_get_value_cansleep(unsigned gpio)
95 return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
97 static inline void gpio_set_value_cansleep(unsigned gpio, int value)
99 return gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value);
102 static inline int gpio_get_value(unsigned gpio)
104 return gpiod_get_raw_value(gpio_to_desc(gpio));
106 static inline void gpio_set_value(unsigned gpio, int value)
108 return gpiod_set_raw_value(gpio_to_desc(gpio), value);
111 static inline int gpio_to_irq(unsigned gpio)
113 return gpiod_to_irq(gpio_to_desc(gpio));
116 int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
117 int gpio_request_array(const struct gpio *array, size_t num);
118 void gpio_free_array(const struct gpio *array, size_t num);
122 int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
123 int devm_gpio_request_one(struct device *dev, unsigned gpio,
138 static inline int gpio_request(unsigned gpio, const char *label)
140 return -ENOSYS;
143 static inline int gpio_request_one(unsigned gpio,
146 return -ENOSYS;
149 static inline int gpio_request_array(const struct gpio *array, size_t num)
151 return -ENOSYS;
154 static inline void gpio_free(unsigned gpio)
158 /* GPIO can never have been requested */
162 static inline void gpio_free_array(const struct gpio *array, size_t num)
166 /* GPIO can never have been requested */
170 static inline int gpio_direction_input(unsigned gpio)
172 return -ENOSYS;
175 static inline int gpio_direction_output(unsigned gpio, int value)
177 return -ENOSYS;
180 static inline int gpio_get_value(unsigned gpio)
182 /* GPIO can never have been requested or set as {in,out}put */
187 static inline void gpio_set_value(unsigned gpio, int value)
189 /* GPIO can never have been requested or set as output */
193 static inline int gpio_get_value_cansleep(unsigned gpio)
195 /* GPIO can never have been requested or set as {in,out}put */
200 static inline void gpio_set_value_cansleep(unsigned gpio, int value)
202 /* GPIO can never have been requested or set as output */
206 static inline int gpio_to_irq(unsigned gpio)
208 /* GPIO can never have been requested or set as input */
210 return -EINVAL;
213 static inline int devm_gpio_request(struct device *dev, unsigned gpio,
217 return -EINVAL;
220 static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
224 return -EINVAL;