Re: [PATCH v4 1/2] dt-bindings: pinctrl: qcom: Add SM8350 pinctrl bindings

Rob Herring
2021-01-13T02:57:26Z

On Thu, Jan 07, 2021 at 11:17:22AM -0600, Bjorn Andersson wrote:
> On Tue 05 Jan 23:49 CST 2021, Vinod Koul wrote:
>
> > Add device tree binding Documentation details for Qualcomm SM8350
> > pinctrl driver.
> >
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > ---
> > .../bindings/pinctrl/qcom,sm8350-tlmm.yaml | 149 ++++++++++++++++++
> > 1 file changed, 149 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,sm8350-tlmm.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sm8350-tlmm.yaml b/Documentation/devicetree/bindings/pinctrl/qcom,sm8350-tlmm.yaml
> > new file mode 100644
> > index 000000000000..abdafd25bfc2
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/pinctrl/qcom,sm8350-tlmm.yaml
> > @@ -0,0 +1,149 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/pinctrl/qcom,sm8350-tlmm.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Qualcomm Technologies, Inc. SM8350 TLMM block
> > +
> > +maintainers:
> > + - Vinod Koul <vkoul@kernel.org>
> > +
> > +description: |
> > + This binding describes the Top Level Mode Multiplexer block found in the
> > + SM8350 platform.
> > +
> > +properties:
> > + compatible:
> > + const: qcom,sm8350-tlmm
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > + interrupt-controller: true
> > +
> > + '#interrupt-cells':
> > + description: Specifies the PIN numbers and Flags, as defined in
> > + include/dt-bindings/interrupt-controller/irq.h
> > + const: 2
> > +
> > + gpio-controller: true
> > +
> > + '#gpio-cells':
> > + description: Specifying the pin number and flags, as defined in
> > + include/dt-bindings/gpio/gpio.h
> > + const: 2
> > +
> > + gpio-ranges:
> > + maxItems: 1
> > +
> > + gpio-reserved-ranges:
> > + maxItems: 1
> > +
> > +#PIN CONFIGURATION NODES
> > +patternProperties:
> > + '-pinmux$':
>
> I believe that what Rob was asking for was the matter of describing the
> mux and config subnodes under this one. But I don't know really how to
> express this, because the following are all valid:
>
> default_state: default-state {
> pins = "gpio1";
> bias-disable;
> };
>
> default_state: default-state {
> rx {
> pins = "gpio1";
> function = "gpio";
> bias-disable;
> };
> };
>
> default_state: default-state {
> pinmux {
> pins = "gpio1";
> function = "gpio";
> };
>
> pinconf {
> pins = "gpio1";
> bias-disable;
> };
> };
>
> I.e. the properties described here applies either to this node directly,
> or any subnodes (1 level) down.

Why!?

You can create a definition and reuse it. Something like this:

$defs:
pin-node:
type: object
properties:
...

patternProperties:
'-state$':
oneOf:
- $ref: #/$defs/pin-node

- patternProperties:
'.*':
$ref: #/$defs/pin-node

Rob