Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 2 | /* |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 3 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@com> |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __PINCTRL_H |
| 7 | #define __PINCTRL_H |
| 8 | |
Max Krummenacher | 0e226eb | 2024-01-18 19:10:47 +0100 | [diff] [blame] | 9 | #include <linux/errno.h> |
| 10 | |
Patrice Chotard | c4b4ef0 | 2018-10-24 14:10:17 +0200 | [diff] [blame] | 11 | #define PINNAME_SIZE 10 |
Venkatesh Yadav Abbarapu | 0b9d992 | 2023-09-20 08:30:06 +0530 | [diff] [blame] | 12 | #define PINMUX_SIZE 90 |
Patrice Chotard | c4b4ef0 | 2018-10-24 14:10:17 +0200 | [diff] [blame] | 13 | |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 14 | /** |
| 15 | * struct pinconf_param - pin config parameters |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 16 | * @property: Property name in DT nodes |
| 17 | * @param: ID for this config parameter |
| 18 | * @default_value: default value for this config parameter used in case |
| 19 | * no value is specified in DT nodes |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 20 | */ |
| 21 | struct pinconf_param { |
| 22 | const char * const property; |
| 23 | unsigned int param; |
| 24 | u32 default_value; |
| 25 | }; |
| 26 | |
| 27 | /** |
| 28 | * struct pinctrl_ops - pin control operations, to be implemented by |
| 29 | * pin controller drivers. |
| 30 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 31 | * set_state() is the only mandatory operation. You can implement your pinctrl |
| 32 | * driver with its own @set_state. In this case, the other callbacks are not |
| 33 | * required. Otherwise, generic pinctrl framework is also available; use |
| 34 | * pinctrl_generic_set_state for @set_state, and implement other operations |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 35 | * depending on your necessity. |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 36 | */ |
| 37 | struct pinctrl_ops { |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 38 | /** |
| 39 | * @get_pins_count: Get the number of selectable pins |
| 40 | * |
| 41 | * @dev: Pinctrl device to use |
| 42 | * |
| 43 | * This function is necessary to parse the "pins" property in DTS. |
| 44 | * |
| 45 | * @Return: |
| 46 | * number of selectable named pins available in this driver |
| 47 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 48 | int (*get_pins_count)(struct udevice *dev); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * @get_pin_name: Get the name of a pin |
| 52 | * |
| 53 | * @dev: Pinctrl device of the pin |
| 54 | * |
| 55 | * @selector: The pin selector |
| 56 | * |
| 57 | * This function is called by the core to figure out which pin it will |
| 58 | * do operations to. This function is necessary to parse the "pins" |
| 59 | * property in DTS. |
| 60 | * |
| 61 | * @Return: const pointer to the name of the pin |
| 62 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 63 | const char *(*get_pin_name)(struct udevice *dev, unsigned selector); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 64 | |
| 65 | /** |
| 66 | * @get_groups_count: Get the number of selectable groups |
| 67 | * |
| 68 | * @dev: Pinctrl device to use |
| 69 | * |
| 70 | * This function is necessary to parse the "groups" property in DTS. |
| 71 | * |
| 72 | * @Return: |
| 73 | * number of selectable named groups available in the driver |
| 74 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 75 | int (*get_groups_count)(struct udevice *dev); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * @get_group_name: Get the name of a group |
| 79 | * |
| 80 | * @dev: Pinctrl device of the group |
| 81 | * |
| 82 | * @selector: The group selector |
| 83 | * |
| 84 | * This function is called by the core to figure out which group it |
| 85 | * will do operations to. This function is necessary to parse the |
| 86 | * "groups" property in DTS. |
| 87 | * |
| 88 | * @Return: Pointer to the name of the group |
| 89 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 90 | const char *(*get_group_name)(struct udevice *dev, unsigned selector); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 91 | |
| 92 | /** |
| 93 | * @get_functions_count: Get the number of selectable functions |
| 94 | * |
| 95 | * @dev: Pinctrl device to use |
| 96 | * |
| 97 | * This function is necessary for pin-muxing. |
| 98 | * |
| 99 | * @Return: |
| 100 | * number of selectable named functions available in this driver |
| 101 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 102 | int (*get_functions_count)(struct udevice *dev); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * @get_function_name: Get the name of a function |
| 106 | * |
| 107 | * @dev: Pinmux device of the function |
| 108 | * |
| 109 | * @selector: The function selector |
| 110 | * |
| 111 | * This function is called by the core to figure out which mux setting |
| 112 | * it will map a certain device to. This function is necessary for |
| 113 | * pin-muxing. |
| 114 | * |
| 115 | * @Return: |
| 116 | * Pointer to the function name of the muxing selector |
| 117 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 118 | const char *(*get_function_name)(struct udevice *dev, |
| 119 | unsigned selector); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 120 | |
| 121 | /** |
| 122 | * @pinmux_set: Mux a pin to a function |
| 123 | * |
| 124 | * @dev: Pinctrl device to use |
| 125 | * |
| 126 | * @pin_selector: The pin selector |
| 127 | * |
| 128 | * @func_selector: The func selector |
| 129 | * |
| 130 | * On simple controllers one of @pin_selector or @func_selector may be |
| 131 | * ignored. This function is necessary for pin-muxing against a single |
| 132 | * pin. |
| 133 | * |
| 134 | * @Return: 0 if OK, or negative error code on failure |
| 135 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 136 | int (*pinmux_set)(struct udevice *dev, unsigned pin_selector, |
| 137 | unsigned func_selector); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * @pinmux_group_set: Mux a group of pins to a function |
| 141 | * |
| 142 | * @dev: Pinctrl device to use |
| 143 | * |
| 144 | * @group_selector: The group selector |
| 145 | * |
| 146 | * @func_selector: The func selector |
| 147 | * |
| 148 | * On simple controllers one of @group_selector or @func_selector may be |
| 149 | * ignored. This function is necessary for pin-muxing against a group of |
| 150 | * pins. |
| 151 | * |
| 152 | * @Return: 0 if OK, or negative error code on failure |
| 153 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 154 | int (*pinmux_group_set)(struct udevice *dev, unsigned group_selector, |
| 155 | unsigned func_selector); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 156 | |
| 157 | /** |
| 158 | * @pinmux_property_set: Enable a pinmux group |
| 159 | * |
| 160 | * @dev: Pinctrl device to use |
| 161 | * |
| 162 | * @pinmux_group: A u32 representing the pin identifier and mux |
| 163 | * settings. The exact format of a pinmux group is left |
| 164 | * up to the driver. |
| 165 | * |
| 166 | * Mux a single pin to a single function based on a driver-specific |
| 167 | * pinmux group. This function is necessary for parsing the "pinmux" |
| 168 | * property in DTS, and for pin-muxing against a pinmux group. |
| 169 | * |
| 170 | * @Return: |
| 171 | * Pin selector for the muxed pin if OK, or negative error code on |
| 172 | * failure |
| 173 | */ |
Sean Anderson | 319ca70 | 2020-09-14 11:01:55 -0400 | [diff] [blame] | 174 | int (*pinmux_property_set)(struct udevice *dev, u32 pinmux_group); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 175 | |
| 176 | /** |
| 177 | * @pinconf_num_params: |
| 178 | * Number of driver-specific parameters to be parsed from device |
| 179 | * trees. This member is necessary for pin configuration. |
| 180 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 181 | unsigned int pinconf_num_params; |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 182 | |
| 183 | /** |
| 184 | * @pinconf_params: |
| 185 | * List of driver-specific parameters to be parsed from the device |
| 186 | * tree. This member is necessary for pin configuration. |
| 187 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 188 | const struct pinconf_param *pinconf_params; |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 189 | |
| 190 | /** |
| 191 | * @pinconf_set: Configure an individual pin with a parameter |
| 192 | * |
| 193 | * @dev: Pinctrl device to use |
| 194 | * |
| 195 | * @pin_selector: The pin selector |
| 196 | * |
| 197 | * @param: An &enum pin_config_param from @pinconf_params |
| 198 | * |
| 199 | * @argument: The argument to this param from the device tree, or |
| 200 | * @pinconf_params.default_value |
| 201 | * |
| 202 | * This function is necessary for pin configuration against a single |
| 203 | * pin. |
| 204 | * |
| 205 | * @Return: 0 if OK, or negative error code on failure |
| 206 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 207 | int (*pinconf_set)(struct udevice *dev, unsigned pin_selector, |
| 208 | unsigned param, unsigned argument); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * @pinconf_group_set: Configure all pins in a group with a parameter |
| 212 | * |
| 213 | * @dev: Pinctrl device to use |
| 214 | * |
| 215 | * @pin_selector: The group selector |
| 216 | * |
| 217 | * @param: A &enum pin_config_param from |
| 218 | * @pinconf_params |
| 219 | * |
| 220 | * @argument: The argument to this param from the device tree, or |
| 221 | * @pinconf_params.default_value |
| 222 | * |
| 223 | * This function is necessary for pin configuration against a group of |
| 224 | * pins. |
| 225 | * |
| 226 | * @Return: 0 if OK, or negative error code on failure |
| 227 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 228 | int (*pinconf_group_set)(struct udevice *dev, unsigned group_selector, |
| 229 | unsigned param, unsigned argument); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 230 | |
| 231 | /** |
| 232 | * @set_state: Configure a pinctrl device |
| 233 | * |
| 234 | * @dev: Pinctrl device to use |
| 235 | * |
| 236 | * @config: Pseudo device pointing a config node |
| 237 | * |
| 238 | * This function is required to be implemented by all pinctrl drivers. |
| 239 | * Drivers may set this member to pinctrl_generic_set_state(), which |
| 240 | * will call other functions in &struct pinctrl_ops to parse |
| 241 | * @config. |
| 242 | * |
| 243 | * @Return: 0 if OK, or negative error code on failure |
| 244 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 245 | int (*set_state)(struct udevice *dev, struct udevice *config); |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 246 | |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 247 | /** |
| 248 | * @set_state_simple: Configure a pinctrl device |
| 249 | * |
| 250 | * @dev: Pinctrl device to use |
| 251 | * |
| 252 | * @config: Pseudo-device pointing a config node |
| 253 | * |
| 254 | * This function is usually a simpler version of set_state(). Only the |
| 255 | * first pinctrl device on the system is supported by this function. |
| 256 | * |
| 257 | * @Return: 0 if OK, or negative error code on failure |
| 258 | */ |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 259 | int (*set_state_simple)(struct udevice *dev, struct udevice *periph); |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 260 | |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 261 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 262 | * @request: Request a particular pinctrl function |
| 263 | * |
| 264 | * @dev: Device to adjust (%UCLASS_PINCTRL) |
| 265 | * |
| 266 | * @func: Function number (driver-specific) |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 267 | * |
| 268 | * This activates the selected function. |
| 269 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 270 | * @Return: 0 if OK, or negative error code on failure |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 271 | */ |
| 272 | int (*request)(struct udevice *dev, int func, int flags); |
| 273 | |
| 274 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 275 | * @get_periph_id: Get the peripheral ID for a device |
| 276 | * |
| 277 | * @dev: Pinctrl device to use for decoding |
| 278 | * |
| 279 | * @periph: Device to check |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 280 | * |
| 281 | * This generally looks at the peripheral's device tree node to work |
| 282 | * out the peripheral ID. The return value is normally interpreted as |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 283 | * &enum periph_id. so long as this is defined by the platform (which it |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 284 | * should be). |
| 285 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 286 | * @Return: |
| 287 | * Peripheral ID of @periph, or %-ENOENT on error |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 288 | */ |
| 289 | int (*get_periph_id)(struct udevice *dev, struct udevice *periph); |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 290 | |
| 291 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 292 | * @get_gpio_mux: Get the mux value for a particular GPIO |
| 293 | * |
| 294 | * @dev: Pinctrl device to use |
| 295 | * |
| 296 | * @banknum: GPIO bank number |
| 297 | * |
| 298 | * @index: GPIO index within the bank |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 299 | * |
| 300 | * This allows the raw mux value for a GPIO to be obtained. It is |
| 301 | * useful for displaying the function being used by that GPIO, such |
| 302 | * as with the 'gpio' command. This function is internal to the GPIO |
| 303 | * subsystem and should not be used by generic code. Typically it is |
| 304 | * used by a GPIO driver with knowledge of the SoC pinctrl setup. |
| 305 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 306 | * @Return: |
| 307 | * Mux value (SoC-specific, e.g. 0 for input, 1 for output) |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 308 | */ |
| 309 | int (*get_gpio_mux)(struct udevice *dev, int banknum, int index); |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 310 | |
| 311 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 312 | * @get_pin_muxing: Show pin muxing |
| 313 | * |
| 314 | * @dev: Pinctrl device to use |
| 315 | * |
| 316 | * @selector: Pin selector |
| 317 | * |
| 318 | * @buf: Buffer to fill with pin muxing description |
| 319 | * |
| 320 | * @size: Size of @buf |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 321 | * |
| 322 | * This allows to display the muxing of a given pin. It's useful for |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 323 | * debug purposes to know if a pin is configured as GPIO or as an |
| 324 | * alternate function and which one. Typically it is used by a PINCTRL |
| 325 | * driver with knowledge of the SoC pinctrl setup. |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 326 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 327 | * @Return: 0 if OK, or negative error code on failure |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 328 | */ |
| 329 | int (*get_pin_muxing)(struct udevice *dev, unsigned int selector, |
| 330 | char *buf, int size); |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 331 | |
| 332 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 333 | * @gpio_request_enable: Request and enable GPIO on a certain pin. |
| 334 | * |
| 335 | * @dev: Pinctrl device to use |
| 336 | * |
| 337 | * @selector: Pin selector |
| 338 | * |
| 339 | * Implement this only if you can mux every pin individually as GPIO. |
| 340 | * The affected GPIO range is passed along with an offset(pin number) |
| 341 | * into that specific GPIO range - function selectors and pin groups are |
| 342 | * orthogonal to this, the core will however make sure the pins do not |
| 343 | * collide. |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 344 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 345 | * @Return: |
| 346 | * 0 if OK, or negative error code on failure |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 347 | */ |
| 348 | int (*gpio_request_enable)(struct udevice *dev, unsigned int selector); |
| 349 | |
| 350 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 351 | * @gpio_disable_free: Free up GPIO muxing on a certain pin. |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 352 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 353 | * @dev: Pinctrl device to use |
| 354 | * |
| 355 | * @selector: Pin selector |
| 356 | * |
| 357 | * This function is the reverse of @gpio_request_enable. |
| 358 | * |
| 359 | * @Return: 0 if OK, or negative error code on failure |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 360 | */ |
| 361 | int (*gpio_disable_free)(struct udevice *dev, unsigned int selector); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 362 | }; |
| 363 | |
| 364 | #define pinctrl_get_ops(dev) ((struct pinctrl_ops *)(dev)->driver->ops) |
| 365 | |
| 366 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 367 | * enum pin_config_param - Generic pin configuration parameters |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 368 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 369 | * @PIN_CONFIG_BIAS_BUS_HOLD: The pin will be set to weakly latch so that it |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 370 | * weakly drives the last value on a tristate bus, also known as a "bus |
| 371 | * holder", "bus keeper" or "repeater". This allows another device on the |
| 372 | * bus to change the value by driving the bus high or low and switching to |
| 373 | * tristate. The argument is ignored. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 374 | * @PIN_CONFIG_BIAS_DISABLE: Disable any pin bias on the pin, a |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 375 | * transition from say pull-up to pull-down implies that you disable |
| 376 | * pull-up in the process, this setting disables all biasing. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 377 | * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: The pin will be set to a high impedance |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 378 | * mode, also know as "third-state" (tristate) or "high-Z" or "floating". |
| 379 | * On output pins this effectively disconnects the pin, which is useful |
| 380 | * if for example some other pin is going to drive the signal connected |
| 381 | * to it for a while. Pins used for input are usually always high |
| 382 | * impedance. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 383 | * @PIN_CONFIG_BIAS_PULL_DOWN: The pin will be pulled down (usually with high |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 384 | * impedance to GROUND). If the argument is != 0 pull-down is enabled, |
| 385 | * if it is 0, pull-down is total, i.e. the pin is connected to GROUND. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 386 | * @PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: The pin will be pulled up or down based |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 387 | * on embedded knowledge of the controller hardware, like current mux |
| 388 | * function. The pull direction and possibly strength too will normally |
| 389 | * be decided completely inside the hardware block and not be readable |
| 390 | * from the kernel side. |
| 391 | * If the argument is != 0 pull up/down is enabled, if it is 0, the |
| 392 | * configuration is ignored. The proper way to disable it is to use |
| 393 | * @PIN_CONFIG_BIAS_DISABLE. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 394 | * @PIN_CONFIG_BIAS_PULL_UP: The pin will be pulled up (usually with high |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 395 | * impedance to VDD). If the argument is != 0 pull-up is enabled, |
| 396 | * if it is 0, pull-up is total, i.e. the pin is connected to VDD. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 397 | * @PIN_CONFIG_DRIVE_OPEN_DRAIN: The pin will be driven with open drain (open |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 398 | * collector) which means it is usually wired with other output ports |
| 399 | * which are then pulled up with an external resistor. Setting this |
| 400 | * config will enable open drain mode, the argument is ignored. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 401 | * @PIN_CONFIG_DRIVE_OPEN_SOURCE: The pin will be driven with open source |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 402 | * (open emitter). Setting this config will enable open source mode, the |
| 403 | * argument is ignored. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 404 | * @PIN_CONFIG_DRIVE_PUSH_PULL: The pin will be driven actively high and |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 405 | * low, this is the most typical case and is typically achieved with two |
| 406 | * active transistors on the output. Setting this config will enable |
| 407 | * push-pull mode, the argument is ignored. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 408 | * @PIN_CONFIG_DRIVE_STRENGTH: The pin will sink or source at most the current |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 409 | * passed as argument. The argument is in mA. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 410 | * @PIN_CONFIG_DRIVE_STRENGTH_UA: The pin will sink or source at most the |
| 411 | * current passed as argument. The argument is in uA. |
| 412 | * @PIN_CONFIG_INPUT_DEBOUNCE: This will configure the pin to debounce mode, |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 413 | * which means it will wait for signals to settle when reading inputs. The |
| 414 | * argument gives the debounce time in usecs. Setting the |
| 415 | * argument to zero turns debouncing off. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 416 | * @PIN_CONFIG_INPUT_ENABLE: Enable the pin's input. Note that this does not |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 417 | * affect the pin's ability to drive output. 1 enables input, 0 disables |
| 418 | * input. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 419 | * @PIN_CONFIG_INPUT_SCHMITT: This will configure an input pin to run in |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 420 | * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, |
| 421 | * the threshold value is given on a custom format as argument when |
| 422 | * setting pins to this mode. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 423 | * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: Control schmitt-trigger mode on the pin. |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 424 | * If the argument != 0, schmitt-trigger mode is enabled. If it's 0, |
| 425 | * schmitt-trigger mode is disabled. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 426 | * @PIN_CONFIG_LOW_POWER_MODE: This will configure the pin for low power |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 427 | * operation, if several modes of operation are supported these can be |
| 428 | * passed in the argument on a custom form, else just use argument 1 |
| 429 | * to indicate low power mode, argument 0 turns low power mode off. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 430 | * @PIN_CONFIG_OUTPUT_ENABLE: This will enable the pin's output mode |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 431 | * without driving a value there. For most platforms this reduces to |
| 432 | * enable the output buffers and then let the pin controller current |
| 433 | * configuration (eg. the currently selected mux function) drive values on |
| 434 | * the line. Use argument 1 to enable output mode, argument 0 to disable |
| 435 | * it. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 436 | * @PIN_CONFIG_OUTPUT: This will configure the pin as an output and drive a |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 437 | * value on the line. Use argument 1 to indicate high level, argument 0 to |
| 438 | * indicate low level. (Please see Documentation/driver-api/pinctl.rst, |
| 439 | * section "GPIO mode pitfalls" for a discussion around this parameter.) |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 440 | * @PIN_CONFIG_POWER_SOURCE: If the pin can select between different power |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 441 | * supplies, the argument to this parameter (on a custom format) tells |
| 442 | * the driver which alternative power source to use. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 443 | * @PIN_CONFIG_SLEEP_HARDWARE_STATE: Indicate this is sleep related state. |
| 444 | * @PIN_CONFIG_SLEW_RATE: If the pin can select slew rate, the argument to |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 445 | * this parameter (on a custom format) tells the driver which alternative |
| 446 | * slew rate to use. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 447 | * @PIN_CONFIG_SKEW_DELAY: If the pin has programmable skew rate (on inputs) |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 448 | * or latch delay (on outputs) this parameter (in a custom format) |
| 449 | * specifies the clock skew or latch delay. It typically controls how |
| 450 | * many double inverters are put in front of the line. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 451 | * @PIN_CONFIG_END: This is the last enumerator for pin configurations, if |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 452 | * you need to pass in custom configurations to the pin controller, use |
| 453 | * PIN_CONFIG_END+1 as the base offset. |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 454 | * @PIN_CONFIG_MAX: This is the maximum configuration value that can be |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 455 | * presented using the packed format. |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 456 | */ |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 457 | enum pin_config_param { |
Ashok Reddy Soma | 9ee52fb | 2022-02-23 15:02:51 +0100 | [diff] [blame] | 458 | PIN_CONFIG_BIAS_BUS_HOLD = 0, |
| 459 | PIN_CONFIG_BIAS_DISABLE = 1, |
| 460 | PIN_CONFIG_BIAS_HIGH_IMPEDANCE = 2, |
| 461 | PIN_CONFIG_BIAS_PULL_DOWN = 3, |
| 462 | PIN_CONFIG_BIAS_PULL_PIN_DEFAULT = 4, |
| 463 | PIN_CONFIG_BIAS_PULL_UP = 5, |
| 464 | PIN_CONFIG_DRIVE_OPEN_DRAIN = 6, |
| 465 | PIN_CONFIG_DRIVE_OPEN_SOURCE = 7, |
| 466 | PIN_CONFIG_DRIVE_PUSH_PULL = 8, |
| 467 | PIN_CONFIG_DRIVE_STRENGTH = 9, |
| 468 | PIN_CONFIG_DRIVE_STRENGTH_UA = 10, |
| 469 | PIN_CONFIG_INPUT_DEBOUNCE = 11, |
| 470 | PIN_CONFIG_INPUT_ENABLE = 12, |
| 471 | PIN_CONFIG_INPUT_SCHMITT = 13, |
| 472 | PIN_CONFIG_INPUT_SCHMITT_ENABLE = 14, |
| 473 | PIN_CONFIG_LOW_POWER_MODE = 15, |
| 474 | PIN_CONFIG_OUTPUT_ENABLE = 16, |
| 475 | PIN_CONFIG_OUTPUT = 17, |
| 476 | PIN_CONFIG_POWER_SOURCE = 18, |
| 477 | PIN_CONFIG_SLEEP_HARDWARE_STATE = 19, |
| 478 | PIN_CONFIG_SLEW_RATE = 20, |
| 479 | PIN_CONFIG_SKEW_DELAY = 21, |
| 480 | PIN_CONFIG_END = 127, /* 0x7F */ |
| 481 | PIN_CONFIG_MAX = 255, /* 0xFF */ |
Peng Fan | 99490a7 | 2018-01-05 14:05:17 +0800 | [diff] [blame] | 482 | }; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 483 | |
| 484 | #if CONFIG_IS_ENABLED(PINCTRL_GENERIC) |
| 485 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 486 | * pinctrl_generic_set_state() - Generic set_state operation |
| 487 | * @pctldev: Pinctrl device to use |
| 488 | * @config: Config device (pseudo device), pointing a config node in DTS |
| 489 | * |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 490 | * Parse the DT node of @config and its children and handle generic properties |
| 491 | * such as "pins", "groups", "functions", and pin configuration parameters. |
| 492 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 493 | * Return: 0 on success, or negative error code on failure |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 494 | */ |
| 495 | int pinctrl_generic_set_state(struct udevice *pctldev, struct udevice *config); |
Pali Rohár | d80ed17 | 2022-07-25 13:56:08 +0200 | [diff] [blame] | 496 | int pinctrl_generic_set_state_prefix(struct udevice *pctldev, struct udevice *config, |
| 497 | const char *prefix); |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 498 | #else |
| 499 | static inline int pinctrl_generic_set_state(struct udevice *pctldev, |
| 500 | struct udevice *config) |
| 501 | { |
Patrick Delaunay | e8e001e | 2021-11-19 10:02:26 +0100 | [diff] [blame] | 502 | return -ENOSYS; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 503 | } |
| 504 | #endif |
| 505 | |
| 506 | #if CONFIG_IS_ENABLED(PINCTRL) |
| 507 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 508 | * pinctrl_select_state() - Set a device to a given state |
| 509 | * @dev: Peripheral device |
| 510 | * @statename: State name, like "default" |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 511 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 512 | * Return: 0 on success, or negative error code on failure |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 513 | */ |
| 514 | int pinctrl_select_state(struct udevice *dev, const char *statename); |
| 515 | #else |
| 516 | static inline int pinctrl_select_state(struct udevice *dev, |
| 517 | const char *statename) |
| 518 | { |
Patrick Delaunay | e8e001e | 2021-11-19 10:02:26 +0100 | [diff] [blame] | 519 | return -ENOSYS; |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 520 | } |
| 521 | #endif |
| 522 | |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 523 | /** |
| 524 | * pinctrl_request() - Request a particular pinctrl function |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 525 | * @dev: Pinctrl device to use |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 526 | * @func: Function number (driver-specific) |
| 527 | * @flags: Flags (driver-specific) |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 528 | * |
| 529 | * Return: 0 if OK, or negative error code on failure |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 530 | */ |
| 531 | int pinctrl_request(struct udevice *dev, int func, int flags); |
| 532 | |
| 533 | /** |
| 534 | * pinctrl_request_noflags() - Request a particular pinctrl function |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 535 | * @dev: Pinctrl device to use |
| 536 | * @func: Function number (driver-specific) |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 537 | * |
| 538 | * This is similar to pinctrl_request() but uses 0 for @flags. |
| 539 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 540 | * Return: 0 if OK, or negative error code on failure |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 541 | */ |
| 542 | int pinctrl_request_noflags(struct udevice *dev, int func); |
| 543 | |
| 544 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 545 | * pinctrl_get_periph_id() - Get the peripheral ID for a device |
| 546 | * @dev: Pinctrl device to use for decoding |
| 547 | * @periph: Device to check |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 548 | * |
| 549 | * This generally looks at the peripheral's device tree node to work out the |
| 550 | * peripheral ID. The return value is normally interpreted as enum periph_id. |
| 551 | * so long as this is defined by the platform (which it should be). |
| 552 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 553 | * Return: Peripheral ID of @periph, or -ENOENT on error |
Simon Glass | ac2ee65 | 2015-08-30 16:55:13 -0600 | [diff] [blame] | 554 | */ |
| 555 | int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph); |
| 556 | |
Simon Glass | a098447 | 2016-01-21 19:43:26 -0700 | [diff] [blame] | 557 | /** |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 558 | * pinctrl_get_gpio_mux() - get the mux value for a particular GPIO |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 559 | * @dev: Pinctrl device to use |
| 560 | * @banknum: GPIO bank number |
| 561 | * @index: GPIO index within the bank |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 562 | * |
| 563 | * This allows the raw mux value for a GPIO to be obtained. It is |
| 564 | * useful for displaying the function being used by that GPIO, such |
| 565 | * as with the 'gpio' command. This function is internal to the GPIO |
| 566 | * subsystem and should not be used by generic code. Typically it is |
| 567 | * used by a GPIO driver with knowledge of the SoC pinctrl setup. |
| 568 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 569 | * Return: Mux value (SoC-specific, e.g. 0 for input, 1 for output) |
Simon Glass | 2d4fa3c | 2016-01-21 19:43:56 -0700 | [diff] [blame] | 570 | */ |
| 571 | int pinctrl_get_gpio_mux(struct udevice *dev, int banknum, int index); |
| 572 | |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 573 | /** |
| 574 | * pinctrl_get_pin_muxing() - Returns the muxing description |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 575 | * @dev: Pinctrl device to use |
| 576 | * @selector: Pin index within pin-controller |
| 577 | * @buf: Pin's muxing description |
| 578 | * @size: Pin's muxing description length |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 579 | * |
| 580 | * This allows to display the muxing description of the given pin for |
| 581 | * debug purpose |
| 582 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 583 | * Return: 0 if OK, or negative error code on failure |
Patrice Chotard | 74ba3f2 | 2018-10-24 14:10:13 +0200 | [diff] [blame] | 584 | */ |
| 585 | int pinctrl_get_pin_muxing(struct udevice *dev, int selector, char *buf, |
| 586 | int size); |
| 587 | |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 588 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 589 | * pinctrl_get_pins_count() - Display pin-controller pins number |
| 590 | * @dev: Pinctrl device to use |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 591 | * |
| 592 | * This allows to know the number of pins owned by a given pin-controller |
| 593 | * |
Patrick Delaunay | da45368 | 2021-05-21 09:47:31 +0200 | [diff] [blame] | 594 | * Return: Number of pins if OK, or -ENOSYS when not supported |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 595 | */ |
| 596 | int pinctrl_get_pins_count(struct udevice *dev); |
| 597 | |
| 598 | /** |
| 599 | * pinctrl_get_pin_name() - Returns the pin's name |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 600 | * @dev: Pinctrl device to use |
| 601 | * @selector: Pin index within pin-controller |
| 602 | * @buf: Buffer to fill with the name of the pin |
| 603 | * @size: Size of @buf |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 604 | * |
| 605 | * This allows to display the pin's name for debug purpose |
| 606 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 607 | * Return: 0 if OK, or negative error code on failure |
Patrice Chotard | fbf8082 | 2018-10-24 14:10:14 +0200 | [diff] [blame] | 608 | */ |
| 609 | int pinctrl_get_pin_name(struct udevice *dev, int selector, char *buf, |
| 610 | int size); |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 611 | |
| 612 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 613 | * pinctrl_gpio_request() - Request a single pin to be used as GPIO |
| 614 | * @dev: GPIO peripheral device |
| 615 | * @offset: GPIO pin offset from the GPIO controller |
Pali Rohár | 69cee50 | 2022-07-25 13:56:11 +0200 | [diff] [blame] | 616 | * @label: GPIO label |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 617 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 618 | * Return: 0 on success, or negative error code on failure |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 619 | */ |
Pali Rohár | 69cee50 | 2022-07-25 13:56:11 +0200 | [diff] [blame] | 620 | int pinctrl_gpio_request(struct udevice *dev, unsigned offset, const char *label); |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 621 | |
| 622 | /** |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 623 | * pinctrl_gpio_free() - Free a single pin used as GPIO |
| 624 | * @dev: GPIO peripheral device |
| 625 | * @offset: GPIO pin offset from the GPIO controller |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 626 | * |
Sean Anderson | abe2a6b | 2020-09-14 11:01:56 -0400 | [diff] [blame] | 627 | * Return: 0 on success, or negative error code on failure |
Marek Vasut | 8751096 | 2019-04-21 23:57:23 +0200 | [diff] [blame] | 628 | */ |
| 629 | int pinctrl_gpio_free(struct udevice *dev, unsigned offset); |
| 630 | |
Masahiro Yamada | f8efa63 | 2015-08-27 12:44:29 +0900 | [diff] [blame] | 631 | #endif /* __PINCTRL_H */ |