[PATCH v2] pinctrl: sunxi: request the per-bank supply optionally
Yang Siyuan
hsyysy at 163.com
Mon Oct 26 08:20:27 PDT 2026
The per-bank "vcc-pX" supplies are optional in the device tree: the
binding documents them, but notes that many boards do not describe them.
sunxi_pmx_request() uses regulator_get() anyway, so the regulator core
falls back to a dummy regulator and warns for every bank that has no
supply:
sun50i-h616-r-pinctrl 7022000.pinctrl: supply vcc-pl not found, using
dummy regulator
The H616 R_PIO is such a controller, and its PL0/PL1 pins drive the
R_I2C bus, so every H616 board hits the warning during boot.
Use regulator_get_optional() instead. A bank supply that is described
in the device tree is still acquired and enabled, as it powers the
physical VCC-Px rail, but one that is absent is skipped without a
warning.
Signed-off-by: Yang Siyuan <hsyysy at 163.com>
---
Changes in v2:
- Do not skip the supply on controllers without IO bias configuration:
the per-bank regulator also powers the physical VCC-Px rail, so a
supply described in the device tree must still be requested and
enabled. Use regulator_get_optional() so only banks that have no
supply are skipped, which silences the warning without changing the
power management behaviour.
- Link to v1: https://lore.kernel.org/linux-gpio/20261026144751.1392715-1-hsyysy@163.com/
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 70099052d..23c1fbd46 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -925,11 +925,19 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset)
}
snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank);
- reg = regulator_get(pctl->dev, supply);
- if (IS_ERR(reg))
+ reg = regulator_get_optional(pctl->dev, supply);
+ if (IS_ERR(reg)) {
+ /*
+ * The per-bank supply is optional: boards that do not
+ * describe it simply have no regulator to manage.
+ */
+ if (PTR_ERR(reg) == -ENODEV)
+ return 0;
+
return dev_err_probe(pctl->dev, PTR_ERR(reg),
"Couldn't get bank P%c regulator\n",
'A' + bank);
+ }
ret = regulator_enable(reg);
if (ret) {
@@ -959,6 +967,10 @@ static int sunxi_pmx_free(struct pinctrl_dev *pctldev, unsigned offset)
PINS_PER_BANK;
struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank_offset];
+ /* The per-bank supply is optional, so this bank may not have one. */
+ if (!s_reg->regulator)
+ return 0;
+
if (!refcount_dec_and_test(&s_reg->refcount))
return 0;
base-commit: 091b06388b117fefdcb63336ac09956a4914b961
--
2.56.0
More information about the linux-arm-kernel
mailing list