* [RESEND PATCH v2 0/2] pinctrl property checks
@ 2026-02-24 13:39 Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 1/2] pinctrl: pinconf-generic: perform basic checks on pincfg properties Conor Dooley
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Conor Dooley @ 2026-02-24 13:39 UTC (permalink / raw)
To: linusw
Cc: Conor Dooley, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-gpio, devicetree, linux-kernel
Hey Linus,
Here's a !rfc version of these property checks. Nothing has changed here
outside of a rebase on v7.0-rc1.
Resending because I managed to lose the CC list on all but the cover.
Cheers,
Conor.
CC: Linus Walleij <linusw@kernel.org>
CC: Rob Herring <robh@kernel.org>
CC: Krzysztof Kozlowski <krzk+dt@kernel.org>
CC: Conor Dooley <conor+dt@kernel.org>
CC: linux-gpio@vger.kernel.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Conor Dooley (2):
pinctrl: pinconf-generic: perform basic checks on pincfg properties
dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting
properties
.../bindings/pinctrl/pincfg-node.yaml | 105 ++++++++++++++++--
drivers/pinctrl/pinconf-generic.c | 41 ++++++-
2 files changed, 138 insertions(+), 8 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RESEND PATCH v2 1/2] pinctrl: pinconf-generic: perform basic checks on pincfg properties
2026-02-24 13:39 [RESEND PATCH v2 0/2] pinctrl property checks Conor Dooley
@ 2026-02-24 13:39 ` Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties Conor Dooley
2026-02-26 22:47 ` [RESEND PATCH v2 0/2] pinctrl property checks Linus Walleij
2 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2026-02-24 13:39 UTC (permalink / raw)
To: linusw
Cc: Conor Dooley, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-gpio, devicetree, linux-kernel
Some pinconf properties are mutually exclusive, either because they
convey the same information in different units or represent incompatible
configurations of the same pin. Attempt, in two ways, to prevent these
situations.
Firstly, for enable/disable properties, produce an error if both are
set. Since enable/disable properties share the same enum value, they can
be trivially checked via the newly added bitmap. Having both enable and
disable for the same config makes no sense at all, so produce an error
in this case.
For interactions between properties, doing them outside the loop makes
more sense as it can be evaluated once. In case there are some edge
cases that would be broken by producing an error, only warn for now.
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
drivers/pinctrl/pinconf-generic.c | 41 ++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 94b1d057197c6..30475da0fd10b 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -222,7 +222,10 @@ static int parse_dt_cfg(struct device_node *np,
unsigned int count, unsigned long *cfg,
unsigned int *ncfg)
{
- int i;
+ unsigned long *properties;
+ int i, test;
+
+ properties = bitmap_zalloc(count, GFP_KERNEL);
for (i = 0; i < count; i++) {
u32 val;
@@ -251,11 +254,45 @@ static int parse_dt_cfg(struct device_node *np,
if (ret)
val = par->default_value;
+ /* if param is greater than count, these are custom properties */
+ if (par->param <= count) {
+ ret = test_and_set_bit(par->param, properties);
+ if (ret) {
+ pr_err("%s: conflicting setting detected for %s\n",
+ np->name, par->property);
+ bitmap_free(properties);
+ return -EINVAL;
+ }
+ }
+
pr_debug("found %s with value %u\n", par->property, val);
cfg[*ncfg] = pinconf_to_config_packed(par->param, val);
(*ncfg)++;
}
+ if (test_bit(PIN_CONFIG_DRIVE_STRENGTH, properties) &&
+ test_bit(PIN_CONFIG_DRIVE_STRENGTH_UA, properties))
+ pr_err("%s: cannot have multiple drive strength properties\n",
+ np->name);
+
+ test = test_bit(PIN_CONFIG_BIAS_BUS_HOLD, properties) +
+ test_bit(PIN_CONFIG_BIAS_DISABLE, properties) +
+ test_bit(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, properties) +
+ test_bit(PIN_CONFIG_BIAS_PULL_UP, properties) +
+ test_bit(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, properties) +
+ test_bit(PIN_CONFIG_BIAS_PULL_DOWN, properties);
+ if (test > 1)
+ pr_err("%s: cannot have multiple bias configurations\n",
+ np->name);
+
+ test = test_bit(PIN_CONFIG_DRIVE_OPEN_DRAIN, properties) +
+ test_bit(PIN_CONFIG_DRIVE_OPEN_SOURCE, properties) +
+ test_bit(PIN_CONFIG_DRIVE_PUSH_PULL, properties);
+ if (test > 1)
+ pr_err("%s: cannot have multiple drive configurations\n",
+ np->name);
+
+ bitmap_free(properties);
return 0;
}
@@ -352,6 +389,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
ret = parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg);
if (ret)
return ret;
+
if (pctldev && pctldev->desc->num_custom_params &&
pctldev->desc->custom_params) {
ret = parse_dt_cfg(np, pctldev->desc->custom_params,
@@ -360,6 +398,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
return ret;
}
+
/* no configs found at all */
if (ncfg == 0) {
*configs = NULL;
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties
2026-02-24 13:39 [RESEND PATCH v2 0/2] pinctrl property checks Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 1/2] pinctrl: pinconf-generic: perform basic checks on pincfg properties Conor Dooley
@ 2026-02-24 13:39 ` Conor Dooley
2026-03-06 23:41 ` Rob Herring
2026-02-26 22:47 ` [RESEND PATCH v2 0/2] pinctrl property checks Linus Walleij
2 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2026-02-24 13:39 UTC (permalink / raw)
To: linusw
Cc: Conor Dooley, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-gpio, devicetree, linux-kernel
Many of the possible pincfg properties are not compatible with one
another, either because they represent mutually exclusive states for a
pin or because they provide the same information in different units.
Add some simple restrictions to prevent invalid configurations.
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
.../bindings/pinctrl/pincfg-node.yaml | 105 ++++++++++++++++--
1 file changed, 98 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml b/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
index a916d0fc79a99..fe936ab091040 100644
--- a/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
@@ -162,12 +162,103 @@ properties:
this affects the expected delay in ps before latching a value to
an output pin.
-if:
- required:
- - skew-delay
-then:
- properties:
- skew-delay-input-ps: false
- skew-delay-output-ps: false
+allOf:
+ - if:
+ required:
+ - skew-delay
+ then:
+ properties:
+ skew-delay-input-ps: false
+ skew-delay-output-ps: false
+
+ - if:
+ required:
+ - input-disable
+ then:
+ properties:
+ input-enable: false
+
+ - if:
+ required:
+ - output-disable
+ then:
+ properties:
+ output-enable: false
+ output-impedance-ohms: false
+
+ - if:
+ required:
+ - output-low
+ then:
+ properties:
+ output-high: false
+
+ - if:
+ required:
+ - low-power-enable
+ then:
+ properties:
+ low-power-disable: false
+
+ - if:
+ required:
+ - input-schmitt-disable
+ then:
+ properties:
+ input-schmitt-enable: false
+ input-schmitt-microvolt: false
+
+ - if:
+ required:
+ - drive-strength
+ then:
+ properties:
+ drive-strength-microamp: false
+
+ - if:
+ anyOf:
+ - required:
+ - drive-open-source
+ - required:
+ - drive-open-drain
+ - required:
+ - drive-push-pull
+ then:
+ oneOf:
+ - required:
+ - drive-open-source
+ - required:
+ - drive-open-drain
+ - required:
+ - drive-push-pull
+
+ - if:
+ anyOf:
+ - required:
+ - bias-disable
+ - required:
+ - bias-high-impedance
+ - required:
+ - bias-bus-hold
+ - required:
+ - bias-pull-up
+ - required:
+ - bias-pull-down
+ - required:
+ - bias-pull-pin-default
+ then:
+ oneOf:
+ - required:
+ - bias-disable
+ - required:
+ - bias-high-impedance
+ - required:
+ - bias-bus-hold
+ - required:
+ - bias-pull-up
+ - required:
+ - bias-pull-down
+ - required:
+ - bias-pull-pin-default
additionalProperties: true
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RESEND PATCH v2 0/2] pinctrl property checks
2026-02-24 13:39 [RESEND PATCH v2 0/2] pinctrl property checks Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 1/2] pinctrl: pinconf-generic: perform basic checks on pincfg properties Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties Conor Dooley
@ 2026-02-26 22:47 ` Linus Walleij
2026-02-28 0:41 ` Conor Dooley
2 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2026-02-26 22:47 UTC (permalink / raw)
To: Conor Dooley
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-gpio,
devicetree, linux-kernel
On Tue, Feb 24, 2026 at 2:39 PM Conor Dooley <conor.dooley@microchip.com> wrote:
> Here's a !rfc version of these property checks. Nothing has changed here
> outside of a rebase on v7.0-rc1.
>
> Resending because I managed to lose the CC list on all but the cover.
I applied these for next because why not! People have ample
time to test them now.
(Dropped an extraneous newline in the first patch.)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RESEND PATCH v2 0/2] pinctrl property checks
2026-02-26 22:47 ` [RESEND PATCH v2 0/2] pinctrl property checks Linus Walleij
@ 2026-02-28 0:41 ` Conor Dooley
0 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2026-02-28 0:41 UTC (permalink / raw)
To: Linus Walleij
Cc: Conor Dooley, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-gpio, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
On Thu, Feb 26, 2026 at 11:47:33PM +0100, Linus Walleij wrote:
> On Tue, Feb 24, 2026 at 2:39 PM Conor Dooley <conor.dooley@microchip.com> wrote:
>
> > Here's a !rfc version of these property checks. Nothing has changed here
> > outside of a rebase on v7.0-rc1.
> >
> > Resending because I managed to lose the CC list on all but the cover.
>
> I applied these for next because why not! People have ample
> time to test them now.
I did not run a check at any point of all the arm or arm64 devicetrees,
I may go do that tomorrow and see if anything pops up. What's more
interesting is if someone comes along with the runtime warnings I think.
> (Dropped an extraneous newline in the first patch.)
I blame conflict resolution from my rebase for that one ;)
Thanks for grabbing it. I still owe you a generic function to replace
the amlogic one that I moved, but I have been busy and not picked up one
of the spacemit k1 boards yet.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties
2026-02-24 13:39 ` [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties Conor Dooley
@ 2026-03-06 23:41 ` Rob Herring
0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2026-03-06 23:41 UTC (permalink / raw)
To: Conor Dooley
Cc: linusw, Krzysztof Kozlowski, Conor Dooley, linux-gpio, devicetree,
linux-kernel
On Tue, Feb 24, 2026 at 7:41 AM Conor Dooley <conor.dooley@microchip.com> wrote:
>
> Many of the possible pincfg properties are not compatible with one
> another, either because they represent mutually exclusive states for a
> pin or because they provide the same information in different units.
>
> Add some simple restrictions to prevent invalid configurations.
>
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> .../bindings/pinctrl/pincfg-node.yaml | 105 ++++++++++++++++--
> 1 file changed, 98 insertions(+), 7 deletions(-)
This causes new warnings on Xilinx zynqmp and I think some QCom platforms.
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-06 23:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 13:39 [RESEND PATCH v2 0/2] pinctrl property checks Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 1/2] pinctrl: pinconf-generic: perform basic checks on pincfg properties Conor Dooley
2026-02-24 13:39 ` [RESEND PATCH v2 2/2] dt-bindings: pinctrl: pincfg-node: add restrictions on conflicting properties Conor Dooley
2026-03-06 23:41 ` Rob Herring
2026-02-26 22:47 ` [RESEND PATCH v2 0/2] pinctrl property checks Linus Walleij
2026-02-28 0:41 ` Conor Dooley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox