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

dt-bindings: gpio: document the new pull-up/pull-down flags

This commit extends the flags that can be used in GPIO specifiers to
indicate if a pull-up resistor or pull-down resistor should be
enabled.

While some pinctrl DT bindings already offer the capability of
configuring pull-up/pull-down resistors at the pin level, a number of
simple GPIO controllers don't have any pinmuxing capability, and
therefore do not rely on the pinctrl DT bindings.

Such simple GPIO controllers however sometimes allow to configure
pull-up and pull-down resistors on a per-pin basis, and whether such
resistors should be enabled or not is a highly board-specific HW
characteristic.

By using two additional bits of the GPIO flag specifier, we can easily
allow the Device Tree to describe which GPIOs should have their
pull-up or pull-down resistors enabled. Even though the two options
are mutually exclusive, we still need two bits to encode at least
three states: no pull-up/pull-down, pull-up, pull-down.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Thomas Petazzoni and committed by
Linus Walleij
ede033e1 bfeffd15

+18
+12
Documentation/devicetree/bindings/gpio/gpio.txt
··· 67 67 https://en.wikipedia.org/wiki/Open_collector 68 68 - Bit 3: 0 means the output should be maintained during sleep/low-power mode 69 69 1 means the output state can be lost during sleep/low-power mode 70 + - Bit 4: 0 means no pull-up resistor should be enabled 71 + 1 means a pull-up resistor should be enabled 72 + This setting only applies to hardware with a simple on/off 73 + control for pull-up configuration. If the hardware has more 74 + elaborate pull-up configuration, it should be represented 75 + using a pin control binding. 76 + - Bit 5: 0 means no pull-down resistor should be enabled 77 + 1 means a pull-down resistor should be enabled 78 + This setting only applies to hardware with a simple on/off 79 + control for pull-down configuration. If the hardware has more 80 + elaborate pull-down configuration, it should be represented 81 + using a pin control binding. 70 82 71 83 1.1) GPIO specifier best practices 72 84 ----------------------------------
+6
include/dt-bindings/gpio/gpio.h
··· 33 33 #define GPIO_PERSISTENT 0 34 34 #define GPIO_TRANSITORY 8 35 35 36 + /* Bit 4 express pull up */ 37 + #define GPIO_PULL_UP 16 38 + 39 + /* Bit 5 express pull down */ 40 + #define GPIO_PULL_DOWN 32 41 + 36 42 #endif