gpio: of: Add DT overlay support for GPIO hogs
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 20 Feb 2020 13:01:49 +0000 (14:01 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 21 Feb 2020 16:10:33 +0000 (17:10 +0100)
commit63636d956c455c0fbe2118078a03f563ddd6bf6e
treec84d484227fdb545f3d82646c2f7f296fa3049bc
parentbc21077e084b80c22072a40d32beb24ea33938ec
gpio: of: Add DT overlay support for GPIO hogs

As GPIO hogs are configured at GPIO controller initialization time,
adding/removing GPIO hogs in DT overlays does not work.

Add support for GPIO hogs described in DT overlays by registering an OF
reconfiguration notifier, to handle the addition and removal of GPIO hog
subnodes to/from a GPIO controller device node.

Note that when a GPIO hog device node is being removed, its "gpios"
properties is no longer available, so we have to keep track of which
node a hog belongs to, which is done by adding a pointer to the hog's
device node to struct gpio_desc.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200220130149.26283-3-geert+renesas@glider.be
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-of.c
drivers/gpio/gpiolib-of.h
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h