diff mbox series

[v5,07/11] dt-bindings: test: Add single clk consumer

Message ID 20240603223811.3815762-8-sboyd@kernel.org
State New
Headers show
Series clk: Add kunit tests for fixed rate and parent data | expand

Commit Message

Stephen Boyd June 3, 2024, 10:38 p.m. UTC
Describe a binding for a device that consumes a single clk in DT. This
will initially be used by a KUnit test to clk_get() the clk registered
by of_fixed_clk_setup() and test that it is setup properly.

Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
 .../test/test,single-clk-consumer.yaml        | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml

Comments

Rob Herring (Arm) June 4, 2024, 1:05 p.m. UTC | #1
On Mon, Jun 03, 2024 at 03:38:04PM -0700, Stephen Boyd wrote:
> Describe a binding for a device that consumes a single clk in DT. This
> will initially be used by a KUnit test to clk_get() the clk registered
> by of_fixed_clk_setup() and test that it is setup properly.
> 
> Cc: Rob Herring <robh@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Brendan Higgins <brendan.higgins@linux.dev>
> Cc: David Gow <davidgow@google.com>
> Cc: Rae Moar <rmoar@google.com>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
>  .../test/test,single-clk-consumer.yaml        | 34 +++++++++++++++++++
>  1 file changed, 34 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> 
> diff --git a/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> new file mode 100644
> index 000000000000..8c384c48707d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> @@ -0,0 +1,34 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/test/test,single-clk-consumer.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Test consumer of a single clock
> +
> +maintainers:
> +  - Stephen Boyd <sboyd@kernel.org>
> +
> +description:
> +  A consumer of a single clock used in tests.
> +
> +properties:
> +  compatible:
> +    const: test,single-clk-consumer

I don't know if there's much value in defining bindings for tests. We 
could alternatively make 'test,' opt out of everything. There's already 
some support in dtschema for this with 'foo,'.

I need something for the DT unittest as well. 

Rob
Stephen Boyd June 4, 2024, 6:28 p.m. UTC | #2
Quoting Rob Herring (2024-06-04 06:05:26)
> On Mon, Jun 03, 2024 at 03:38:04PM -0700, Stephen Boyd wrote:
> > Describe a binding for a device that consumes a single clk in DT. This
> > will initially be used by a KUnit test to clk_get() the clk registered
> > by of_fixed_clk_setup() and test that it is setup properly.
> > 
> > Cc: Rob Herring <robh@kernel.org>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> > Cc: Conor Dooley <conor+dt@kernel.org>
> > Cc: Brendan Higgins <brendan.higgins@linux.dev>
> > Cc: David Gow <davidgow@google.com>
> > Cc: Rae Moar <rmoar@google.com>
> > Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> > ---
> >  .../test/test,single-clk-consumer.yaml        | 34 +++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > new file mode 100644
> > index 000000000000..8c384c48707d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > @@ -0,0 +1,34 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/test/test,single-clk-consumer.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Test consumer of a single clock
> > +
> > +maintainers:
> > +  - Stephen Boyd <sboyd@kernel.org>
> > +
> > +description:
> > +  A consumer of a single clock used in tests.
> > +
> > +properties:
> > +  compatible:
> > +    const: test,single-clk-consumer
> 
> I don't know if there's much value in defining bindings for tests. We 
> could alternatively make 'test,' opt out of everything. There's already 
> some support in dtschema for this with 'foo,'.
> 
> I need something for the DT unittest as well. 
> 

Ok. So I should drop this patch and the other one that adds a binding
for the fake clock provider? And replace it with something that makes
the test vendor prefix opt out of all checking? How is that done?  Some
patch to dtschema directly?
Rob Herring (Arm) June 4, 2024, 8:19 p.m. UTC | #3
On Tue, Jun 4, 2024 at 1:28 PM Stephen Boyd <sboyd@kernel.org> wrote:
>
> Quoting Rob Herring (2024-06-04 06:05:26)
> > On Mon, Jun 03, 2024 at 03:38:04PM -0700, Stephen Boyd wrote:
> > > Describe a binding for a device that consumes a single clk in DT. This
> > > will initially be used by a KUnit test to clk_get() the clk registered
> > > by of_fixed_clk_setup() and test that it is setup properly.
> > >
> > > Cc: Rob Herring <robh@kernel.org>
> > > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> > > Cc: Conor Dooley <conor+dt@kernel.org>
> > > Cc: Brendan Higgins <brendan.higgins@linux.dev>
> > > Cc: David Gow <davidgow@google.com>
> > > Cc: Rae Moar <rmoar@google.com>
> > > Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> > > ---
> > >  .../test/test,single-clk-consumer.yaml        | 34 +++++++++++++++++++
> > >  1 file changed, 34 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > > new file mode 100644
> > > index 000000000000..8c384c48707d
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
> > > @@ -0,0 +1,34 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/test/test,single-clk-consumer.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Test consumer of a single clock
> > > +
> > > +maintainers:
> > > +  - Stephen Boyd <sboyd@kernel.org>
> > > +
> > > +description:
> > > +  A consumer of a single clock used in tests.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: test,single-clk-consumer
> >
> > I don't know if there's much value in defining bindings for tests. We
> > could alternatively make 'test,' opt out of everything. There's already
> > some support in dtschema for this with 'foo,'.
> >
> > I need something for the DT unittest as well.
> >
>
> Ok. So I should drop this patch and the other one that adds a binding
> for the fake clock provider?

Yes.

> And replace it with something that makes
> the test vendor prefix opt out of all checking? How is that done?  Some
> patch to dtschema directly?

Yes, but I just added it for you.

Rob
Stephen Boyd June 4, 2024, 8:53 p.m. UTC | #4
Quoting Rob Herring (2024-06-04 13:19:18)
> 
> Yes, but I just added it for you.

Oh, we'll probably want to update checkpatch as well to ignore test
vendor prefix.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
new file mode 100644
index 000000000000..8c384c48707d
--- /dev/null
+++ b/Documentation/devicetree/bindings/test/test,single-clk-consumer.yaml
@@ -0,0 +1,34 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/test/test,single-clk-consumer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Test consumer of a single clock
+
+maintainers:
+  - Stephen Boyd <sboyd@kernel.org>
+
+description:
+  A consumer of a single clock used in tests.
+
+properties:
+  compatible:
+    const: test,single-clk-consumer
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    clock-consumer {
+      compatible = "test,clk-fixed-rate";
+      clocks = <&fixed_clk>;
+    };
+...