bmips: switch to linux 5.15
[openwrt/staging/dedeckeh.git] / target / linux / bmips / patches-5.10 / 053-v5.13-gpio-regmap-set-gpio_chip-of_node.patch
1 From d46bf9ec4596654f36245e3b14765bcb422be6ad Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
3 Date: Wed, 24 Mar 2021 09:19:03 +0100
4 Subject: [PATCH 02/22] gpio: regmap: set gpio_chip of_node
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This is needed for properly registering GPIO regmap as a child of a regmap
10 pin controller.
11
12 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
13 Reviewed-by: Michael Walle <michael@walle.cc>
14 Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
15 Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
16 Link: https://lore.kernel.org/r/20210324081923.20379-3-noltari@gmail.com
17 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
18 ---
19 drivers/gpio/gpio-regmap.c | 5 +++++
20 include/linux/gpio/regmap.h | 4 ++++
21 2 files changed, 9 insertions(+)
22
23 --- a/drivers/gpio/gpio-regmap.c
24 +++ b/drivers/gpio/gpio-regmap.c
25 @@ -254,6 +254,11 @@ struct gpio_regmap *gpio_regmap_register
26 chip->names = config->names;
27 chip->label = config->label ?: dev_name(config->parent);
28
29 +#if defined(CONFIG_OF_GPIO)
30 + /* gpiolib will use of_node of the parent if chip->of_node is NULL */
31 + chip->of_node = to_of_node(config->fwnode);
32 +#endif /* CONFIG_OF_GPIO */
33 +
34 /*
35 * If our regmap is fast_io we should probably set can_sleep to false.
36 * Right now, the regmap doesn't save this property, nor is there any
37 --- a/include/linux/gpio/regmap.h
38 +++ b/include/linux/gpio/regmap.h
39 @@ -4,6 +4,7 @@
40 #define _LINUX_GPIO_REGMAP_H
41
42 struct device;
43 +struct fwnode_handle;
44 struct gpio_regmap;
45 struct irq_domain;
46 struct regmap;
47 @@ -16,6 +17,8 @@ struct regmap;
48 * @parent: The parent device
49 * @regmap: The regmap used to access the registers
50 * given, the name of the device is used
51 + * @fwnode: (Optional) The firmware node.
52 + * If not given, the fwnode of the parent is used.
53 * @label: (Optional) Descriptive name for GPIO controller.
54 * If not given, the name of the device is used.
55 * @ngpio: Number of GPIOs
56 @@ -57,6 +60,7 @@ struct regmap;
57 struct gpio_regmap_config {
58 struct device *parent;
59 struct regmap *regmap;
60 + struct fwnode_handle *fwnode;
61
62 const char *label;
63 int ngpio;