Skip to content
  • Linus Walleij's avatar
    gpio: Export devm_gpiod_get_from_of_node() for consumers · 92542edc
    Linus Walleij authored
    
    
    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: default avatarLinus Walleij <linus.walleij@linaro.org>
    92542edc