On 8/14/26 8:26 PM, Ralph Siemsen wrote:
Add simple recursion support to the .set_state method. This makes it
possible to use subgroups in the device tree, which in turn allows
setting multiple pins with different bias/drive-strength properties.
Fixes: e4aea57fa773 ("pinctrl: renesas: add R906G032 driver")
Signed-off-by: Ralph Siemsen <[email protected]>
---
Changes in v2:
- split out of the series "Renesas RZ/N1 additional drivers"
https://lore.kernel.org/u-boot/[email protected]/
- fix typos in commit message
- use device_foreach_child() to iterate child nodes
- move recursion to top of function, ahead of the early return in the
case of no direct pinmux entries, instead of removing early return.
- dev_err() in case of failure during recursion
---
drivers/pinctrl/renesas/pinctrl-rzn1.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c
b/drivers/pinctrl/renesas/pinctrl-rzn1.c
index fdc43c8e714..6c8d40e9639 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
@@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct rzn1_pinctrl_priv
*priv, unsigned int pin,
static int rzn1_pinctrl_set_state(struct udevice *dev, struct udevice *config)
{
struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
+ struct udevice *child;
int size;
int ret;
u32 val;
u32 bias;
+ /*
+ * Handle subnodes recursively, so that pin groups work.
+ * Note that properties are *NOT* inherited from parent.
+ */
+ device_foreach_child(child, config) {
+ ret = rzn1_pinctrl_set_state(dev, child);
Can there really be infinite nested subgroups , or are there always only
groups with subgroups and that is where it ends ? Linux
Documentation/devicetree/bindings/pinctrl/renesas,rzn1-pinctrl.yaml
makes it look like the later, so maybe the recursion is not necessary
here, instead call device_foreach_child() { device_foreach_child() { ..
} } to prevent the possibility of infinite recursion ?