Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: gpio.txt: expand gpio-line-names recommendations

Provide more guidance to differentiate between recommendations for names of
lines which are hard-wired to on-board devices, versus recommendations for
names of lines which are connected to general-purpose pin headers.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Trevor Woerner and committed by
Bartosz Golaszewski
db9da195 63de20ca

+29 -12
+29 -12
Documentation/devicetree/bindings/gpio/gpio.txt
··· 154 154 155 155 Optionally, a GPIO controller may have a "gpio-line-names" property. This is 156 156 an array of strings defining the names of the GPIO lines going out of the 157 - GPIO controller. This name should be the most meaningful producer name 158 - for the system, such as a rail name indicating the usage. Package names 159 - such as pin name are discouraged: such lines have opaque names (since they 160 - are by definition generic purpose) and such names are usually not very 161 - helpful. For example "MMC-CD", "Red LED Vdd" and "ethernet reset" are 162 - reasonable line names as they describe what the line is used for. "GPIO0" 163 - is not a good name to give to a GPIO line. Placeholders are discouraged: 164 - rather use the "" (blank string) if the use of the GPIO line is undefined 165 - in your design. The names are assigned starting from line offset 0 from 166 - left to right from the passed array. An incomplete array (where the number 167 - of passed named are less than ngpios) will still be used up until the last 168 - provided valid line index. 157 + GPIO controller. 158 + 159 + For lines which are routed to on-board devices, this name should be 160 + the most meaningful producer name for the system, such as a rail name 161 + indicating the usage. Package names, such as a pin name, are discouraged: 162 + such lines have opaque names (since they are by definition general-purpose) 163 + and such names are usually not very helpful. For example "MMC-CD", "Red LED 164 + Vdd" and "ethernet reset" are reasonable line names as they describe what 165 + the line is used for. "GPIO0" is not a good name to give to a GPIO line 166 + that is hard-wired to a specific device. 167 + 168 + However, in the case of lines that are routed to a general purpose header 169 + (e.g. the Raspberry Pi 40-pin header), and therefore are not hard-wired to 170 + specific devices, using a pin number or the names on the header is fine 171 + provided these are real (preferably unique) names. Using an SoC's pad name 172 + or package name, or names made up from kernel-internal software constructs, 173 + are strongly discouraged. For example "pin8 [gpio14/uart0_txd]" is fine 174 + if the board's documentation labels pin 8 as such. However "PortB_24" (an 175 + example of a name from an SoC's reference manual) would not be desirable. 176 + 177 + In either case placeholders are discouraged: rather use the "" (blank 178 + string) if the use of the GPIO line is undefined in your design. Ideally, 179 + try to add comments to the dts file describing the naming the convention 180 + you have chosen, and specifying from where the names are derived. 181 + 182 + The names are assigned starting from line offset 0, from left to right, 183 + from the passed array. An incomplete array (where the number of passed 184 + names is less than ngpios) will be used up until the last provided valid 185 + line index. 169 186 170 187 Example: 171 188