diff mbox series

[2/2] ASoC: sun50i-dmic: dt-bindings: add DT bindings for DMIC controller

Message ID 20210615130737.2098-1-fengzheng923@gmail.com
State Changes Requested, archived
Headers show
Series None | expand

Checks

Context Check Description
robh/checkpatch success
robh/dt-meta-schema fail build log

Commit Message

Ban Tao June 15, 2021, 1:07 p.m. UTC
The Allwinner SoCs feature an I2S controller across multiple SoC
generations.

Signed-off-by: Ban Tao <fengzheng923@gmail.com>
---
 .../sound/allwinner,sun50i-h6-dmic.yaml       | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml

Comments

Rob Herring June 15, 2021, 10:37 p.m. UTC | #1
On Tue, 15 Jun 2021 21:07:37 +0800, Ban Tao wrote:
> The Allwinner SoCs feature an I2S controller across multiple SoC
> generations.
> 
> Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> ---
>  .../sound/allwinner,sun50i-h6-dmic.yaml       | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.example.dts:23.28-29 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:380: Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1416: dt_binding_check] Error 2
\ndoc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1492163

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Maxime Ripard June 16, 2021, 8:49 a.m. UTC | #2
Hi,

On Tue, Jun 15, 2021 at 09:07:37PM +0800, Ban Tao wrote:
> The Allwinner SoCs feature an I2S controller across multiple SoC
> generations.

Which SoC generations?

> Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> ---
>  .../sound/allwinner,sun50i-h6-dmic.yaml       | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> new file mode 100644
> index 000000000000..81d40c374e44
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/allwinner,sun50i-h6-dmic.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner H6 DMIC Controller Device Tree Bindings
> +
> +maintainers:
> +  - Ban Tao <fengzheng923@gmail.com>
> +
> +properties:
> +  "#sound-dai-cells":
> +    const: 0
> +
> +  compatible:
> +    const: allwinner,sun50i-h6-dmic
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    items:
> +      - description: Bus Clock
> +      - description: Module Clock
> +
> +  clock-names:
> +    items:
> +      - const: apb
> +      - const: dmic

The convention we use is bus and mod

> +
> +  dmas:
> +    maxItems: 1
> +
> +  dma-names:
> +    const: rx
> +
> +  resets:
> +    maxItems: 1
> +
> +required:
> +  - "#sound-dai-cells"
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - dmas
> +  - dma-names
> +  - resets
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    spdif: spdif@5095000 {

The label and node name seems wrong?

> +        #sound-dai-cells = <0>;
> +        compatible = "allwinner,sun50i-h6-dmic";
> +        reg = <0x05095000 0x400>;
> +        clocks = <&ccu CLK_BUS_DMIC>, <&ccu CLK_DMIC>;

You'll need includes for it to compile

Maxime
Ban Tao June 16, 2021, 10:56 a.m. UTC | #3
Hi,

Maxime Ripard <maxime@cerno.tech> 于2021年6月16日周三 下午4:49写道:
>
> Hi,
>
> On Tue, Jun 15, 2021 at 09:07:37PM +0800, Ban Tao wrote:
> > The Allwinner SoCs feature an I2S controller across multiple SoC
> > generations.
>
> Which SoC generations?
>
> > Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> > ---
> >  .../sound/allwinner,sun50i-h6-dmic.yaml       | 66 +++++++++++++++++++
> >  1 file changed, 66 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> > new file mode 100644
> > index 000000000000..81d40c374e44
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/allwinner,sun50i-h6-dmic.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Allwinner H6 DMIC Controller Device Tree Bindings
> > +
> > +maintainers:
> > +  - Ban Tao <fengzheng923@gmail.com>
> > +
> > +properties:
> > +  "#sound-dai-cells":
> > +    const: 0
> > +
> > +  compatible:
> > +    const: allwinner,sun50i-h6-dmic
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    items:
> > +      - description: Bus Clock
> > +      - description: Module Clock
> > +
> > +  clock-names:
> > +    items:
> > +      - const: apb
> > +      - const: dmic
>
> The convention we use is bus and mod
>
> > +
> > +  dmas:
> > +    maxItems: 1
> > +
> > +  dma-names:
> > +    const: rx
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> > +required:
> > +  - "#sound-dai-cells"
> > +  - compatible
> > +  - reg
> > +  - clocks
> > +  - clock-names
> > +  - dmas
> > +  - dma-names
> > +  - resets
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    spdif: spdif@5095000 {
>
> The label and node name seems wrong?
>
Yes, in fact, I don’t know much about yaml format files.
The allwinner,sun50i-h6-dmic.yaml file is based on
allwinner,sun4i-a10-spdif.yaml.
So, How do i convert txt file to yaml file, for example:
---------------------------------------------
Required properties:

  - compatible         : should be one of the following:
    - "allwinner,sun50i-h6-dmic": for the Allwinner H6 SoC

  - reg                        : physical base address of the
controller and length of memory mapped region.

  - dmas               : Generic dma devicetree binding as described in
                         Documentation/devicetree/bindings/dma/dma.txt.

  - dma-names          : DMA have to be defined, "rx".

  - clocks             : Contains an entry for each entry in clock-names.

  - clock-names                : Includes the following entries:
       "apb"             clock for the dmic bus.
       "dmic"           clock for dmic controller.

  - resets             : reset specifier for the ahb reset

Example:

dmic: dmic@5095000 {
        #sound-dai-cells = <0>;
        compatible = "allwinner,sun50i-h6-dmic";
        reg = <0x05095000 0x400>;
        clocks = <&ccu CLK_BUS_DMIC>, <&ccu CLK_DMIC>;
        clock-names = "apb", "dmic";
        dmas = <&dma 7>;
        dma-names = "rx";
        resets = <&ccu RST_BUS_DMIC>;
};
---------------------------------------------

Thanks.


> > +        #sound-dai-cells = <0>;
> > +        compatible = "allwinner,sun50i-h6-dmic";
> > +        reg = <0x05095000 0x400>;
> > +        clocks = <&ccu CLK_BUS_DMIC>, <&ccu CLK_DMIC>;
>
> You'll need includes for it to compile
>
> Maxime
Maxime Ripard June 16, 2021, 12:38 p.m. UTC | #4
On Wed, Jun 16, 2021 at 06:56:25PM +0800, 班涛 wrote:
> Hi,
> 
> Maxime Ripard <maxime@cerno.tech> 于2021年6月16日周三 下午4:49写道:
> >
> > Hi,
> >
> > On Tue, Jun 15, 2021 at 09:07:37PM +0800, Ban Tao wrote:
> > > The Allwinner SoCs feature an I2S controller across multiple SoC
> > > generations.
> >
> > Which SoC generations?
> >
> > > Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> > > ---
> > >  .../sound/allwinner,sun50i-h6-dmic.yaml       | 66 +++++++++++++++++++
> > >  1 file changed, 66 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> > > new file mode 100644
> > > index 000000000000..81d40c374e44
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
> > > @@ -0,0 +1,66 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/sound/allwinner,sun50i-h6-dmic.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Allwinner H6 DMIC Controller Device Tree Bindings
> > > +
> > > +maintainers:
> > > +  - Ban Tao <fengzheng923@gmail.com>
> > > +
> > > +properties:
> > > +  "#sound-dai-cells":
> > > +    const: 0
> > > +
> > > +  compatible:
> > > +    const: allwinner,sun50i-h6-dmic
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    items:
> > > +      - description: Bus Clock
> > > +      - description: Module Clock
> > > +
> > > +  clock-names:
> > > +    items:
> > > +      - const: apb
> > > +      - const: dmic
> >
> > The convention we use is bus and mod
> >
> > > +
> > > +  dmas:
> > > +    maxItems: 1
> > > +
> > > +  dma-names:
> > > +    const: rx
> > > +
> > > +  resets:
> > > +    maxItems: 1
> > > +
> > > +required:
> > > +  - "#sound-dai-cells"
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> > > +  - clock-names
> > > +  - dmas
> > > +  - dma-names
> > > +  - resets
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    spdif: spdif@5095000 {
> >
> > The label and node name seems wrong?
> >
> Yes, in fact, I don’t know much about yaml format files.
> The allwinner,sun50i-h6-dmic.yaml file is based on
> allwinner,sun4i-a10-spdif.yaml.
>
> So, How do i convert txt file to yaml file, for example:
> ---------------------------------------------
> Required properties:
> 
>   - compatible         : should be one of the following:
>     - "allwinner,sun50i-h6-dmic": for the Allwinner H6 SoC
> 
>   - reg                        : physical base address of the
> controller and length of memory mapped region.
> 
>   - dmas               : Generic dma devicetree binding as described in
>                          Documentation/devicetree/bindings/dma/dma.txt.
> 
>   - dma-names          : DMA have to be defined, "rx".
> 
>   - clocks             : Contains an entry for each entry in clock-names.
> 
>   - clock-names                : Includes the following entries:
>        "apb"             clock for the dmic bus.
>        "dmic"           clock for dmic controller.
> 
>   - resets             : reset specifier for the ahb reset
> 
> Example:
> 
> dmic: dmic@5095000 {
>         #sound-dai-cells = <0>;
>         compatible = "allwinner,sun50i-h6-dmic";
>         reg = <0x05095000 0x400>;
>         clocks = <&ccu CLK_BUS_DMIC>, <&ccu CLK_DMIC>;
>         clock-names = "apb", "dmic";
>         dmas = <&dma 7>;
>         dma-names = "rx";
>         resets = <&ccu RST_BUS_DMIC>;
> };
> ---------------------------------------------

Just like you already did :)

Aside from the few comments, what you did is spot on. Just remember to
run make dt_binding_check after you wrote your schema

Maxime
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
new file mode 100644
index 000000000000..81d40c374e44
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml
@@ -0,0 +1,66 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/allwinner,sun50i-h6-dmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner H6 DMIC Controller Device Tree Bindings
+
+maintainers:
+  - Ban Tao <fengzheng923@gmail.com>
+
+properties:
+  "#sound-dai-cells":
+    const: 0
+
+  compatible:
+    const: allwinner,sun50i-h6-dmic
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bus Clock
+      - description: Module Clock
+
+  clock-names:
+    items:
+      - const: apb
+      - const: dmic
+
+  dmas:
+    maxItems: 1
+
+  dma-names:
+    const: rx
+
+  resets:
+    maxItems: 1
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - dmas
+  - dma-names
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    spdif: spdif@5095000 {
+        #sound-dai-cells = <0>;
+        compatible = "allwinner,sun50i-h6-dmic";
+        reg = <0x05095000 0x400>;
+        clocks = <&ccu CLK_BUS_DMIC>, <&ccu CLK_DMIC>;
+        clock-names = "apb", "dmic";
+        dmas = <&dma 7>;
+        dma-names = "rx";
+        resets = <&ccu RST_BUS_DMIC>;
+    };
+
+...