Lines Matching +full:gpio +full:-

1 /* SPDX-License-Identifier: GPL-2.0 */
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 /* make these flag values available regardless of GPIO kconfig options */
24 /* Gpio pin is active-low */
28 * struct gpio - a structure describing a GPIO with configuration
29 * @gpio: the GPIO number
30 * @flags: GPIO configuration as specified by GPIOF_*
31 * @label: a literal description string of this GPIO
33 struct gpio { struct
34 unsigned gpio; argument
41 #include <linux/gpio/consumer.h> argument
44 * "valid" GPIO numbers are nonnegative and may be passed to
48 * Invalid GPIO numbers are useful for indicating no-such-GPIO in
53 /* only non-negative numbers are valid */ in gpio_is_valid()
58 * Platforms may implement their GPIO interface with library code,
59 * at a small performance cost for non-inlined operations and some
60 * extra memory (for code and for per-GPIO table entries).
66 * Until they are all fixed, leave 0-512 space for them.
70 * Define the maximum of the possible GPIO in the global numberspace.
71 * While the GPIO base and numbers are positive, we limit it with signed
76 /* Always use the library code for GPIO management calls,
79 int gpio_request(unsigned gpio, const char *label);
80 void gpio_free(unsigned gpio);
82 static inline int gpio_direction_input(unsigned gpio) in gpio_direction_input() argument
84 return gpiod_direction_input(gpio_to_desc(gpio)); in gpio_direction_input()
86 static inline int gpio_direction_output(unsigned gpio, int value) in gpio_direction_output() argument
88 return gpiod_direction_output_raw(gpio_to_desc(gpio), value); in gpio_direction_output()
91 static inline int gpio_get_value_cansleep(unsigned gpio) in gpio_get_value_cansleep() argument
93 return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio)); in gpio_get_value_cansleep()
95 static inline void gpio_set_value_cansleep(unsigned gpio, int value) in gpio_set_value_cansleep() argument
97 return gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value); in gpio_set_value_cansleep()
100 static inline int gpio_get_value(unsigned gpio) in gpio_get_value() argument
102 return gpiod_get_raw_value(gpio_to_desc(gpio)); in gpio_get_value()
104 static inline void gpio_set_value(unsigned gpio, int value) in gpio_set_value() argument
106 return gpiod_set_raw_value(gpio_to_desc(gpio), value); in gpio_set_value()
109 static inline int gpio_to_irq(unsigned gpio) in gpio_to_irq() argument
111 return gpiod_to_irq(gpio_to_desc(gpio)); in gpio_to_irq()
114 int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
116 int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
117 int devm_gpio_request_one(struct device *dev, unsigned gpio,
132 static inline int gpio_request(unsigned gpio, const char *label) in gpio_request() argument
134 return -ENOSYS; in gpio_request()
137 static inline int gpio_request_one(unsigned gpio, in gpio_request_one() argument
140 return -ENOSYS; in gpio_request_one()
143 static inline void gpio_free(unsigned gpio) in gpio_free() argument
147 /* GPIO can never have been requested */ in gpio_free()
151 static inline int gpio_direction_input(unsigned gpio) in gpio_direction_input() argument
153 return -ENOSYS; in gpio_direction_input()
156 static inline int gpio_direction_output(unsigned gpio, int value) in gpio_direction_output() argument
158 return -ENOSYS; in gpio_direction_output()
161 static inline int gpio_get_value(unsigned gpio) in gpio_get_value() argument
163 /* GPIO can never have been requested or set as {in,out}put */ in gpio_get_value()
168 static inline void gpio_set_value(unsigned gpio, int value) in gpio_set_value() argument
170 /* GPIO can never have been requested or set as output */ in gpio_set_value()
174 static inline int gpio_get_value_cansleep(unsigned gpio) in gpio_get_value_cansleep() argument
176 /* GPIO can never have been requested or set as {in,out}put */ in gpio_get_value_cansleep()
181 static inline void gpio_set_value_cansleep(unsigned gpio, int value) in gpio_set_value_cansleep() argument
183 /* GPIO can never have been requested or set as output */ in gpio_set_value_cansleep()
187 static inline int gpio_to_irq(unsigned gpio) in gpio_to_irq() argument
189 /* GPIO can never have been requested or set as input */ in gpio_to_irq()
191 return -EINVAL; in gpio_to_irq()
194 static inline int devm_gpio_request(struct device *dev, unsigned gpio, in devm_gpio_request() argument
198 return -EINVAL; in devm_gpio_request()
201 static inline int devm_gpio_request_one(struct device *dev, unsigned gpio, in devm_gpio_request_one() argument
205 return -EINVAL; in devm_gpio_request_one()