Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 506c7f9b authored by Maxime Ripard's avatar Maxime Ripard Committed by Mark Brown
Browse files

dt-bindings: sound: Convert Allwinner SPDIF binding to YAML



The Allwinner SoCs feature an SPDIF controller across multiple SoC
generations.

However, earlier generations were a bit simpler than the subsequent ones,
and for example would always have RX and TX capabilities, and no reset
lines.

In order to express this, let's create two YAML schemas instead of the free
form text we had before.

Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4aecaa0a
Loading
Loading
Loading
Loading
+101 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/allwinner,sun4i-a10-spdif.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A10 S/PDIF Controller Device Tree Bindings

maintainers:
  - Chen-Yu Tsai <wens@csie.org>
  - Liam Girdwood <lgirdwood@gmail.com>
  - Mark Brown <broonie@kernel.org>
  - Maxime Ripard <maxime.ripard@bootlin.com>

properties:
  "#sound-dai-cells":
    const: 0

  compatible:
    oneOf:
      - const: allwinner,sun4i-a10-spdif
      - const: allwinner,sun6i-a31-spdif
      - const: allwinner,sun8i-h3-spdif
      - items:
          - const: allwinner,sun8i-a83t-spdif
          - const: allwinner,sun8i-h3-spdif
      - items:
          - const: allwinner,sun50i-a64-spdif
          - const: allwinner,sun8i-h3-spdif

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  clocks:
    items:
      - description: Bus Clock
      - description: Module Clock

  clock-names:
    items:
      - const: apb
      - const: spdif

  dmas:
    items:
      - description: RX DMA Channel
      - description: TX DMA Channel

  dma-names:
    items:
      - const: rx
      - const: tx

  # Even though it only applies to subschemas under the conditionals,
  # not listing them here will trigger a warning because of the
  # additionalsProperties set to false.
  resets:
    maxItems: 1

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - allwinner,sun6i-a31-spdif
              - allwinner,sun8i-h3-spdif

    then:
      required:
        - resets

required:
  - "#sound-dai-cells"
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - dmas
  - dma-names

additionalProperties: false

examples:
  - |
    spdif: spdif@1c21000 {
        #sound-dai-cells = <0>;
        compatible = "allwinner,sun4i-a10-spdif";
        reg = <0x01c21000 0x40>;
        interrupts = <13>;
        clocks = <&apb0_gates 1>, <&spdif_clk>;
        clock-names = "apb", "spdif";
        dmas = <&dma 0 2>, <&dma 0 2>;
        dma-names = "rx", "tx";
    };

...
+0 −42
Original line number Diff line number Diff line
Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller

The Allwinner S/PDIF audio block is a transceiver that allows the
processor to receive and transmit digital audio via an coaxial cable or
a fibre cable.
For now only playback is supported.

Required properties:

  - compatible		: should be one of the following:
    - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
    - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC
    - "allwinner,sun8i-h3-spdif": for the Allwinner H3 SoC

  - reg			: Offset and length of the register set for the device.

  - interrupts		: Contains the spdif interrupt.

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

  - dma-names		: Two dmas have to be defined, "tx" and "rx".

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

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

  - resets		: reset specifier for the ahb reset (A31 and newer only)

Example:

spdif: spdif@1c21000 {
	compatible = "allwinner,sun4i-a10-spdif";
	reg = <0x01c21000 0x40>;
	interrupts = <13>;
	clocks = <&apb0_gates 1>, <&spdif_clk>;
	clock-names = "apb", "spdif";
	dmas = <&dma 0 2>, <&dma 0 2>;
	dma-names = "rx", "tx";
};