* [PATCH v2] pinctrl: amlogic: a4: Allow functions without groups
@ 2026-11-10 5:09 Xianwei Zhao via B4 Relay
0 siblings, 0 replies; only message in thread
From: Xianwei Zhao via B4 Relay @ 2026-11-10 5:09 UTC (permalink / raw)
To: Linus Walleij, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: linux-amlogic, linux-gpio, linux-arm-kernel, linux-kernel, Xianwei Zhao
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
Allow function nodes without child groups during device tree
parsing instead of returning an error.
Only count and parse nodes with the "func-" prefix as pinctrl
functions, ignoring other non-GPIO child nodes.
This allows the driver to support function nodes without
groups and avoid treating unrelated device tree nodes as
pinctrl functions.
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Add debugging information for error dts and Error pinctrl config not affect normal pin work.
---
Changes in v2:
- Reserve banks nfunctions and ngroups no-zero judgement and update commit message simultaneously.
- Link to v1: https://lore.kernel.org/r/20261106-debug-info-v1-1-067c5c554f91@amlogic.com
---
drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
index 39eb8cc7fc0d..bd12f6fa3d4d 100644
--- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
+++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
@@ -821,8 +821,10 @@ static int aml_pctl_parse_functions(struct device_node *np,
func = &info->functions[index];
func->name = np->name;
func->ngroups = of_get_child_count(np);
- if (func->ngroups == 0)
- return dev_err_probe(dev, -EINVAL, "No groups defined\n");
+ if (func->ngroups == 0) {
+ dev_dbg(dev, "func %s No groups defined\n", func->name);
+ return 0;
+ }
func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL);
if (!func->groups)
@@ -899,8 +901,12 @@ static void aml_pctl_dt_child_count(struct aml_pinctrl *info,
if (of_property_read_bool(child, "gpio-controller")) {
info->nbanks++;
} else {
- info->nfunctions++;
- info->ngroups += of_get_child_count(child);
+ if (!strncmp(child->name, "func-", 5)) {
+ info->nfunctions++;
+ info->ngroups += of_get_child_count(child);
+ } else {
+ dev_dbg(info->dev, "func node defined err %s\n", child->name);
+ }
}
}
}
@@ -1166,10 +1172,11 @@ static int aml_pctl_probe_dt(struct platform_device *pdev,
}
bank++;
} else {
- ret = aml_pctl_parse_functions(child, info,
- i++, &grp_index);
- if (ret)
- return ret;
+ if (!strncmp(child->name, "func-", 5)) {
+ ret = aml_pctl_parse_functions(child, info, i++, &grp_index);
+ if (ret)
+ return ret;
+ }
}
}
---
base-commit: 89edcad9f23925f5706b7555b02165d1990444d5
change-id: 20261106-debug-info-bb5611e36717
Best regards,
--
Xianwei Zhao <xianwei.zhao@amlogic.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-10 5:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 5:09 [PATCH v2] pinctrl: amlogic: a4: Allow functions without groups Xianwei Zhao via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®