| .. | .. |
|---|
| 101 | 101 | } |
|---|
| 102 | 102 | |
|---|
| 103 | 103 | For more information about the ACPI GPIO bindings see |
|---|
| 104 | | -Documentation/acpi/gpio-properties.txt. |
|---|
| 104 | +Documentation/firmware-guide/acpi/gpio-properties.rst. |
|---|
| 105 | 105 | |
|---|
| 106 | 106 | Platform Data |
|---|
| 107 | 107 | ------------- |
|---|
| .. | .. |
|---|
| 113 | 113 | GPIOs are mapped by the means of tables of lookups, containing instances of the |
|---|
| 114 | 114 | gpiod_lookup structure. Two macros are defined to help declaring such mappings:: |
|---|
| 115 | 115 | |
|---|
| 116 | | - GPIO_LOOKUP(chip_label, chip_hwnum, con_id, flags) |
|---|
| 117 | | - GPIO_LOOKUP_IDX(chip_label, chip_hwnum, con_id, idx, flags) |
|---|
| 116 | + GPIO_LOOKUP(key, chip_hwnum, con_id, flags) |
|---|
| 117 | + GPIO_LOOKUP_IDX(key, chip_hwnum, con_id, idx, flags) |
|---|
| 118 | 118 | |
|---|
| 119 | 119 | where |
|---|
| 120 | 120 | |
|---|
| 121 | | - - chip_label is the label of the gpiod_chip instance providing the GPIO |
|---|
| 122 | | - - chip_hwnum is the hardware number of the GPIO within the chip |
|---|
| 121 | + - key is either the label of the gpiod_chip instance providing the GPIO, or |
|---|
| 122 | + the GPIO line name |
|---|
| 123 | + - chip_hwnum is the hardware number of the GPIO within the chip, or U16_MAX |
|---|
| 124 | + to indicate that key is a GPIO line name |
|---|
| 123 | 125 | - con_id is the name of the GPIO function from the device point of view. It |
|---|
| 124 | 126 | can be NULL, in which case it will match any function. |
|---|
| 125 | 127 | - idx is the index of the GPIO within the function. |
|---|
| .. | .. |
|---|
| 135 | 137 | |
|---|
| 136 | 138 | In the future, these flags might be extended to support more properties. |
|---|
| 137 | 139 | |
|---|
| 138 | | -Note that GPIO_LOOKUP() is just a shortcut to GPIO_LOOKUP_IDX() where idx = 0. |
|---|
| 140 | +Note that: |
|---|
| 141 | + 1. GPIO line names are not guaranteed to be globally unique, so the first |
|---|
| 142 | + match found will be used. |
|---|
| 143 | + 2. GPIO_LOOKUP() is just a shortcut to GPIO_LOOKUP_IDX() where idx = 0. |
|---|
| 139 | 144 | |
|---|
| 140 | 145 | A lookup table can then be defined as follows, with an empty entry defining its |
|---|
| 141 | 146 | end. The 'dev_id' field of the table is the identifier of the device that will |
|---|
| .. | .. |
|---|
| 193 | 198 | |
|---|
| 194 | 199 | The line will be hogged as soon as the gpiochip is created or - in case the |
|---|
| 195 | 200 | chip was created earlier - when the hog table is registered. |
|---|
| 201 | + |
|---|
| 202 | +Arrays of pins |
|---|
| 203 | +-------------- |
|---|
| 204 | +In addition to requesting pins belonging to a function one by one, a device may |
|---|
| 205 | +also request an array of pins assigned to the function. The way those pins are |
|---|
| 206 | +mapped to the device determines if the array qualifies for fast bitmap |
|---|
| 207 | +processing. If yes, a bitmap is passed over get/set array functions directly |
|---|
| 208 | +between a caller and a respective .get/set_multiple() callback of a GPIO chip. |
|---|
| 209 | + |
|---|
| 210 | +In order to qualify for fast bitmap processing, the array must meet the |
|---|
| 211 | +following requirements: |
|---|
| 212 | + |
|---|
| 213 | +- pin hardware number of array member 0 must also be 0, |
|---|
| 214 | +- pin hardware numbers of consecutive array members which belong to the same |
|---|
| 215 | + chip as member 0 does must also match their array indexes. |
|---|
| 216 | + |
|---|
| 217 | +Otherwise fast bitmap processing path is not used in order to avoid consecutive |
|---|
| 218 | +pins which belong to the same chip but are not in hardware order being processed |
|---|
| 219 | +separately. |
|---|
| 220 | + |
|---|
| 221 | +If the array applies for fast bitmap processing path, pins which belong to |
|---|
| 222 | +different chips than member 0 does, as well as those with indexes different from |
|---|
| 223 | +their hardware pin numbers, are excluded from the fast path, both input and |
|---|
| 224 | +output. Moreover, open drain and open source pins are excluded from fast bitmap |
|---|
| 225 | +output processing. |
|---|