diff options
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r-- | Documentation/gpio.txt | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 792faa3c06cf..620a07844e8c 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -271,9 +271,26 @@ Some platforms may also use knowledge about what GPIOs are active for | |||
271 | power management, such as by powering down unused chip sectors and, more | 271 | power management, such as by powering down unused chip sectors and, more |
272 | easily, gating off unused clocks. | 272 | easily, gating off unused clocks. |
273 | 273 | ||
274 | Note that requesting a GPIO does NOT cause it to be configured in any | 274 | For GPIOs that use pins known to the pinctrl subsystem, that subsystem should |
275 | way; it just marks that GPIO as in use. Separate code must handle any | 275 | be informed of their use; a gpiolib driver's .request() operation may call |
276 | pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). | 276 | pinctrl_request_gpio(), and a gpiolib driver's .free() operation may call |
277 | pinctrl_free_gpio(). The pinctrl subsystem allows a pinctrl_request_gpio() | ||
278 | to succeed concurrently with a pin or pingroup being "owned" by a device for | ||
279 | pin multiplexing. | ||
280 | |||
281 | Any programming of pin multiplexing hardware that is needed to route the | ||
282 | GPIO signal to the appropriate pin should occur within a GPIO driver's | ||
283 | .direction_input() or .direction_output() operations, and occur after any | ||
284 | setup of an output GPIO's value. This allows a glitch-free migration from a | ||
285 | pin's special function to GPIO. This is sometimes required when using a GPIO | ||
286 | to implement a workaround on signals typically driven by a non-GPIO HW block. | ||
287 | |||
288 | Some platforms allow some or all GPIO signals to be routed to different pins. | ||
289 | Similarly, other aspects of the GPIO or pin may need to be configured, such as | ||
290 | pullup/pulldown. Platform software should arrange that any such details are | ||
291 | configured prior to gpio_request() being called for those GPIOs, e.g. using | ||
292 | the pinctrl subsystem's mapping table, so that GPIO users need not be aware | ||
293 | of these details. | ||
277 | 294 | ||
278 | Also note that it's your responsibility to have stopped using a GPIO | 295 | Also note that it's your responsibility to have stopped using a GPIO |
279 | before you free it. | 296 | before you free it. |
@@ -302,6 +319,8 @@ where 'flags' is currently defined to specify the following properties: | |||
302 | 319 | ||
303 | * GPIOF_INIT_LOW - as output, set initial level to LOW | 320 | * GPIOF_INIT_LOW - as output, set initial level to LOW |
304 | * GPIOF_INIT_HIGH - as output, set initial level to HIGH | 321 | * GPIOF_INIT_HIGH - as output, set initial level to HIGH |
322 | * GPIOF_OPEN_DRAIN - gpio pin is open drain type. | ||
323 | * GPIOF_OPEN_SOURCE - gpio pin is open source type. | ||
305 | 324 | ||
306 | since GPIOF_INIT_* are only valid when configured as output, so group valid | 325 | since GPIOF_INIT_* are only valid when configured as output, so group valid |
307 | combinations as: | 326 | combinations as: |
@@ -310,8 +329,19 @@ combinations as: | |||
310 | * GPIOF_OUT_INIT_LOW - configured as output, initial level LOW | 329 | * GPIOF_OUT_INIT_LOW - configured as output, initial level LOW |
311 | * GPIOF_OUT_INIT_HIGH - configured as output, initial level HIGH | 330 | * GPIOF_OUT_INIT_HIGH - configured as output, initial level HIGH |
312 | 331 | ||
313 | In the future, these flags can be extended to support more properties such | 332 | When setting the flag as GPIOF_OPEN_DRAIN then it will assume that pins is |
314 | as open-drain status. | 333 | open drain type. Such pins will not be driven to 1 in output mode. It is |
334 | require to connect pull-up on such pins. By enabling this flag, gpio lib will | ||
335 | make the direction to input when it is asked to set value of 1 in output mode | ||
336 | to make the pin HIGH. The pin is make to LOW by driving value 0 in output mode. | ||
337 | |||
338 | When setting the flag as GPIOF_OPEN_SOURCE then it will assume that pins is | ||
339 | open source type. Such pins will not be driven to 0 in output mode. It is | ||
340 | require to connect pull-down on such pin. By enabling this flag, gpio lib will | ||
341 | make the direction to input when it is asked to set value of 0 in output mode | ||
342 | to make the pin LOW. The pin is make to HIGH by driving value 1 in output mode. | ||
343 | |||
344 | In the future, these flags can be extended to support more properties. | ||
315 | 345 | ||
316 | Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is | 346 | Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is |
317 | introduced to encapsulate all three fields as: | 347 | introduced to encapsulate all three fields as: |