forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/Documentation/driver-api/gpio/board.rst
....@@ -101,7 +101,7 @@
101101 }
102102
103103 For more information about the ACPI GPIO bindings see
104
-Documentation/acpi/gpio-properties.txt.
104
+Documentation/firmware-guide/acpi/gpio-properties.rst.
105105
106106 Platform Data
107107 -------------
....@@ -113,13 +113,15 @@
113113 GPIOs are mapped by the means of tables of lookups, containing instances of the
114114 gpiod_lookup structure. Two macros are defined to help declaring such mappings::
115115
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)
118118
119119 where
120120
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
123125 - con_id is the name of the GPIO function from the device point of view. It
124126 can be NULL, in which case it will match any function.
125127 - idx is the index of the GPIO within the function.
....@@ -135,7 +137,10 @@
135137
136138 In the future, these flags might be extended to support more properties.
137139
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.
139144
140145 A lookup table can then be defined as follows, with an empty entry defining its
141146 end. The 'dev_id' field of the table is the identifier of the device that will
....@@ -193,3 +198,28 @@
193198
194199 The line will be hogged as soon as the gpiochip is created or - in case the
195200 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.