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

gpio: regmap: set gpio_chip of_node

This is needed for properly registering GPIO regmap as a child of a regmap
pin controller.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20210324081923.20379-3-noltari@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Álvaro Fernández Rojas and committed by
Linus Walleij
d46bf9ec 9c7d2469

+9
+5
drivers/gpio/gpio-regmap.c
··· 254 254 chip->names = config->names; 255 255 chip->label = config->label ?: dev_name(config->parent); 256 256 257 + #if defined(CONFIG_OF_GPIO) 258 + /* gpiolib will use of_node of the parent if chip->of_node is NULL */ 259 + chip->of_node = to_of_node(config->fwnode); 260 + #endif /* CONFIG_OF_GPIO */ 261 + 257 262 /* 258 263 * If our regmap is fast_io we should probably set can_sleep to false. 259 264 * Right now, the regmap doesn't save this property, nor is there any
+4
include/linux/gpio/regmap.h
··· 4 4 #define _LINUX_GPIO_REGMAP_H 5 5 6 6 struct device; 7 + struct fwnode_handle; 7 8 struct gpio_regmap; 8 9 struct irq_domain; 9 10 struct regmap; ··· 17 16 * @parent: The parent device 18 17 * @regmap: The regmap used to access the registers 19 18 * given, the name of the device is used 19 + * @fwnode: (Optional) The firmware node. 20 + * If not given, the fwnode of the parent is used. 20 21 * @label: (Optional) Descriptive name for GPIO controller. 21 22 * If not given, the name of the device is used. 22 23 * @ngpio: Number of GPIOs ··· 60 57 struct gpio_regmap_config { 61 58 struct device *parent; 62 59 struct regmap *regmap; 60 + struct fwnode_handle *fwnode; 63 61 64 62 const char *label; 65 63 int ngpio;