All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Michael Walle" <michael@walle.cc>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com,
	"Jonas Gorski" <jonas.gorski@gmail.com>,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	"Necip Fazil Yildiran" <fazilyildiran@gmail.com>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 02/22] gpio: regmap: set gpio_chip of_node
Date: Wed, 24 Mar 2021 09:19:03 +0100	[thread overview]
Message-ID: <20210324081923.20379-3-noltari@gmail.com> (raw)
In-Reply-To: <20210324081923.20379-1-noltari@gmail.com>

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>
---
 v9: guard of_node assignment with CONFIG_OF_GPIO
 v8: no changes
 v7: add gpio-regmap.c comment
 v6: add comment and simplify of_node assignment
 v5: switch to fwnode
 v4: fix documentation
 v3: introduce patch needed for properly parsing gpio-range

 drivers/gpio/gpio-regmap.c  | 5 +++++
 include/linux/gpio/regmap.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 5412cb3b0b2a..134cedf151a7 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -254,6 +254,11 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	chip->names = config->names;
 	chip->label = config->label ?: dev_name(config->parent);
 
+#if defined(CONFIG_OF_GPIO)
+	/* gpiolib will use of_node of the parent if chip->of_node is NULL */
+	chip->of_node = to_of_node(config->fwnode);
+#endif /* CONFIG_OF_GPIO */
+
 	/*
 	 * If our regmap is fast_io we should probably set can_sleep to false.
 	 * Right now, the regmap doesn't save this property, nor is there any
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index ad76f3d0a6ba..334dd928042b 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -4,6 +4,7 @@
 #define _LINUX_GPIO_REGMAP_H
 
 struct device;
+struct fwnode_handle;
 struct gpio_regmap;
 struct irq_domain;
 struct regmap;
@@ -16,6 +17,8 @@ struct regmap;
  * @parent:		The parent device
  * @regmap:		The regmap used to access the registers
  *			given, the name of the device is used
+ * @fwnode:		(Optional) The firmware node.
+ *			If not given, the fwnode of the parent is used.
  * @label:		(Optional) Descriptive name for GPIO controller.
  *			If not given, the name of the device is used.
  * @ngpio:		Number of GPIOs
@@ -57,6 +60,7 @@ struct regmap;
 struct gpio_regmap_config {
 	struct device *parent;
 	struct regmap *regmap;
+	struct fwnode_handle *fwnode;
 
 	const char *label;
 	int ngpio;
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Michael Walle" <michael@walle.cc>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com,
	"Jonas Gorski" <jonas.gorski@gmail.com>,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	"Necip Fazil Yildiran" <fazilyildiran@gmail.com>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 02/22] gpio: regmap: set gpio_chip of_node
Date: Wed, 24 Mar 2021 09:19:03 +0100	[thread overview]
Message-ID: <20210324081923.20379-3-noltari@gmail.com> (raw)
In-Reply-To: <20210324081923.20379-1-noltari@gmail.com>

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>
---
 v9: guard of_node assignment with CONFIG_OF_GPIO
 v8: no changes
 v7: add gpio-regmap.c comment
 v6: add comment and simplify of_node assignment
 v5: switch to fwnode
 v4: fix documentation
 v3: introduce patch needed for properly parsing gpio-range

 drivers/gpio/gpio-regmap.c  | 5 +++++
 include/linux/gpio/regmap.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 5412cb3b0b2a..134cedf151a7 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -254,6 +254,11 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 	chip->names = config->names;
 	chip->label = config->label ?: dev_name(config->parent);
 
+#if defined(CONFIG_OF_GPIO)
+	/* gpiolib will use of_node of the parent if chip->of_node is NULL */
+	chip->of_node = to_of_node(config->fwnode);
+#endif /* CONFIG_OF_GPIO */
+
 	/*
 	 * If our regmap is fast_io we should probably set can_sleep to false.
 	 * Right now, the regmap doesn't save this property, nor is there any
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index ad76f3d0a6ba..334dd928042b 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -4,6 +4,7 @@
 #define _LINUX_GPIO_REGMAP_H
 
 struct device;
+struct fwnode_handle;
 struct gpio_regmap;
 struct irq_domain;
 struct regmap;
@@ -16,6 +17,8 @@ struct regmap;
  * @parent:		The parent device
  * @regmap:		The regmap used to access the registers
  *			given, the name of the device is used
+ * @fwnode:		(Optional) The firmware node.
+ *			If not given, the fwnode of the parent is used.
  * @label:		(Optional) Descriptive name for GPIO controller.
  *			If not given, the name of the device is used.
  * @ngpio:		Number of GPIOs
@@ -57,6 +60,7 @@ struct regmap;
 struct gpio_regmap_config {
 	struct device *parent;
 	struct regmap *regmap;
+	struct fwnode_handle *fwnode;
 
 	const char *label;
 	int ngpio;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-03-24  8:20 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  8:19 [PATCH v9 00/22] pinctrl: add BCM63XX pincontrol support Álvaro Fernández Rojas
2021-03-24  8:19 ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 01/22] gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-26 13:14   ` Bartosz Golaszewski
2021-03-26 13:14     ` Bartosz Golaszewski
2021-03-29 10:24     ` Linus Walleij
2021-03-29 10:24       ` Linus Walleij
2021-03-24  8:19 ` Álvaro Fernández Rojas [this message]
2021-03-24  8:19   ` [PATCH v9 02/22] gpio: regmap: set gpio_chip of_node Álvaro Fernández Rojas
2021-03-26 13:14   ` Bartosz Golaszewski
2021-03-26 13:14     ` Bartosz Golaszewski
2021-03-24  8:19 ` [PATCH v9 03/22] dt-bindings: improve BCM6345 GPIO binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-26 20:09   ` Rob Herring
2021-03-26 20:09     ` Rob Herring
2021-03-24  8:19 ` [PATCH v9 04/22] pinctrl: bcm: add bcm63xx base code Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 05/22] dt-bindings: add BCM6328 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 06/22] dt-bindings: add BCM6328 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 07/22] pinctrl: add a pincontrol driver for BCM6328 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 08/22] dt-bindings: add BCM6358 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 09/22] dt-bindings: add BCM6358 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 10/22] pinctrl: add a pincontrol driver for BCM6358 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 11/22] dt-bindings: add BCM6362 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 12/22] dt-bindings: add BCM6362 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 13/22] pinctrl: add a pincontrol driver for BCM6362 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 14/22] dt-bindings: add BCM6368 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 15/22] dt-bindings: add BCM6368 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 16/22] pinctrl: add a pincontrol driver for BCM6368 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 17/22] dt-bindings: add BCM63268 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-26 20:09   ` Rob Herring
2021-03-26 20:09     ` Rob Herring
2021-03-24  8:19 ` [PATCH v9 18/22] dt-bindings: add BCM63268 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 19/22] pinctrl: add a pincontrol driver for BCM63268 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 20/22] dt-bindings: add BCM6318 pincontroller binding documentation Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-26 20:10   ` Rob Herring
2021-03-26 20:10     ` Rob Herring
2021-03-24  8:19 ` [PATCH v9 21/22] dt-bindings: add BCM6318 GPIO sysctl " Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-24  8:19 ` [PATCH v9 22/22] pinctrl: add a pincontrol driver for BCM6318 Álvaro Fernández Rojas
2021-03-24  8:19   ` Álvaro Fernández Rojas
2021-03-29 10:19 ` [PATCH v9 00/22] pinctrl: add BCM63XX pincontrol support Linus Walleij
2021-03-29 10:19   ` Linus Walleij
2021-03-30  8:57   ` Álvaro Fernández Rojas
2021-03-30  8:57     ` Álvaro Fernández Rojas
2021-04-08 13:55     ` Linus Walleij
2021-04-08 13:55       ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210324081923.20379-3-noltari@gmail.com \
    --to=noltari@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=fazilyildiran@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.