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

pinctrl: Add sleep related state to indicate sleep related configs

In some scenarios, we should set some pins as input/output/pullup/pulldown
when the specified system goes into deep sleep mode, then when the system
goes into deep sleep mode, these pins will be set automatically by hardware.

That means some pins are not controlled by any specific driver in the OS, but
need to be controlled when entering sleep mode. Thus we introduce one sleep
state config into pinconf-generic for users to configure.

Signed-off-by: Baolin Wang <baolin.wang@spreadtrum.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Baolin Wang and committed by
Linus Walleij
6606bc9d ca8febe8

+6
+2
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
··· 268 268 (such as enabling an output buffer) 269 269 output-low - set the pin to output mode with low level 270 270 output-high - set the pin to output mode with high level 271 + sleep-hardware-state - indicate this is sleep related state which will be programmed 272 + into the registers for the sleep state. 271 273 slew-rate - set the slew rate 272 274 273 275 For example:
+2
drivers/pinctrl/pinconf-generic.c
··· 47 47 PCONFDUMP(PIN_CONFIG_OUTPUT_ENABLE, "output enabled", NULL, false), 48 48 PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true), 49 49 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true), 50 + PCONFDUMP(PIN_CONFIG_SLEEP_HARDWARE_STATE, "sleep hardware state", NULL, false), 50 51 PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true), 51 52 }; 52 53 ··· 179 178 { "output-high", PIN_CONFIG_OUTPUT, 1, }, 180 179 { "output-low", PIN_CONFIG_OUTPUT, 0, }, 181 180 { "power-source", PIN_CONFIG_POWER_SOURCE, 0 }, 181 + { "sleep-hardware-state", PIN_CONFIG_SLEEP_HARDWARE_STATE, 0 }, 182 182 { "slew-rate", PIN_CONFIG_SLEW_RATE, 0 }, 183 183 }; 184 184
+2
include/linux/pinctrl/pinconf-generic.h
··· 86 86 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 87 87 * supplies, the argument to this parameter (on a custom format) tells 88 88 * the driver which alternative power source to use. 89 + * @PIN_CONFIG_SLEEP_HARDWARE_STATE: indicate this is sleep related state. 89 90 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to 90 91 * this parameter (on a custom format) tells the driver which alternative 91 92 * slew rate to use. ··· 115 114 PIN_CONFIG_OUTPUT_ENABLE, 116 115 PIN_CONFIG_OUTPUT, 117 116 PIN_CONFIG_POWER_SOURCE, 117 + PIN_CONFIG_SLEEP_HARDWARE_STATE, 118 118 PIN_CONFIG_SLEW_RATE, 119 119 PIN_CONFIG_END = 0x7F, 120 120 PIN_CONFIG_MAX = 0xFF,