]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: Export devm_gpiod_get_from_of_node() for consumers
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 29 Dec 2017 21:52:02 +0000 (22:52 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 12 Jan 2018 10:05:24 +0000 (11:05 +0100)
commitcf2fe3723200080edf2a427640b57e02e2d24542
tree42b722f5798e1f9969d5cd3027ad7a48149a2d30
parent0e5a34790b80cd61972bc3b0406e495dc2fcccbe
gpio: Export devm_gpiod_get_from_of_node() for consumers

We have been holding back on adding an API for fetching GPIO handles
directly from device nodes, strongly preferring to get it from the
spawn devices instead.

The fwnode interface however already contains an API for doing this,
as it is used for opaque device tree nodes or ACPI nodes for getting
handles to LEDs and keys that use GPIO: those are specified as one
child per LED/key in the device tree and are not individual devices.

However regulators present a special problem as they already have
helper functions to traverse the device tree from a regulator node
and two levels down to fill in data, and as it already traverses
GPIO nodes in its own way, and already holds a pointer to each
regulators device tree node, it makes most sense to export an
API to fetch the GPIO descriptor directly from the node.

We only support the devm_* version for now, hopefully no non-devres
version will be needed.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/devres.c
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h
include/linux/gpio/consumer.h