]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drivers/pinctrl: Add the concept of an "init" state
authorDouglas Anderson <dianders@chromium.org>
Wed, 21 Oct 2015 04:15:06 +0000 (21:15 -0700)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 27 Oct 2015 10:24:23 +0000 (11:24 +0100)
commitef0eebc05130b0d22b0ea65c0cd014ee16fc89c7
treeb40d2dbcd3ff1930c3bf03bba34cd7ef9496334f
parentbac7f4c1bf5e7c6ccd5bb71edc015b26c77f7460
drivers/pinctrl: Add the concept of an "init" state

For pinctrl the "default" state is applied to pins before the driver's
probe function is called.  This is normally a sensible thing to do,
but in some cases can cause problems.  That's because the pins will
change state before the driver is given a chance to program how those
pins should behave.

As an example you might have a regulator that is controlled by a PWM
(output high = high voltage, output low = low voltage).  The firmware
might leave this pin as driven high.  If we allow the driver core to
reconfigure this pin as a PWM pin before the PWM's probe function runs
then you might end up running at too low of a voltage while we probe.

Let's introudce a new "init" state.  If this is defined we'll set
pinctrl to this state before probe and then "default" after probe
(unless the driver explicitly changed states already).

An alternative idea that was thought of was to use the pre-existing
"sleep" or "idle" states and add a boolean property that we should
start in that mode.  This was not done because the "init" state is
needed for correctness and those other states are only present (and
only transitioned in to and out of) when (optional) power management
is enabled.

Changes in v3:
- Moved declarations to pinctrl/devinfo.h
- Fixed author/SoB

Changes in v2:
- Added comment to pinctrl_init_done() as per Linus W.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/base/dd.c
drivers/base/pinctrl.c
drivers/pinctrl/core.c
include/linux/pinctrl/devinfo.h
include/linux/pinctrl/pinctrl-state.h