Re: [PATCH] dt-bindings: sound: nvidia,tegra-audio: Convert multiple txt bindings to yaml
From: Rob Herring <robh@kernel.org>
Date: 2021-11-01 20:42:59
Also in:
alsa-devel, linux-tegra, lkml
On Mon, Oct 25, 2021 at 07:19:25PM +0200, David Heidelberg wrote:
Convert Tegra audio complex with the * ALC5632 * MAX98090 * RT5640 * RT5677 * SGTL5000 * TrimSlice * WM8753 * WM8903 * WM9712 codec to the YAML format.
Perhaps say why they can all be combined. I don't think that really works because the properties which are valid varies. Specifically, the GPIO lines vary. Instead, define a schema with all the common properties and then reference it.
Signed-off-by: David Heidelberg <david@ixit.cz> --- .../sound/nvidia,tegra-audio-alc5632.txt | 48 ----- .../sound/nvidia,tegra-audio-max98090.txt | 53 ----- .../sound/nvidia,tegra-audio-rt5640.txt | 52 ----- .../sound/nvidia,tegra-audio-rt5677.txt | 67 ------ .../sound/nvidia,tegra-audio-sgtl5000.txt | 42 ---- .../sound/nvidia,tegra-audio-trimslice.txt | 21 -- .../sound/nvidia,tegra-audio-wm8753.txt | 40 ---- .../sound/nvidia,tegra-audio-wm8903.txt | 62 ------ .../sound/nvidia,tegra-audio-wm9712.txt | 60 ------ .../bindings/sound/nvidia,tegra-audio.yaml | 190 ++++++++++++++++++ 10 files changed, 190 insertions(+), 445 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5677.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-sgtl5000.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-trimslice.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio.yaml
[...]
quoted hunk ↗ jump to hunk
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio.yaml b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio.yaml new file mode 100644 index 000000000000..6b8876bfa40f --- /dev/null +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio.yaml@@ -0,0 +1,190 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/sound/nvidia,tegra-audio.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra audio complex + +maintainers: + - Jon Hunter <jonathanh@nvidia.com> + - Thierry Reding <thierry.reding@gmail.com> + +properties: + compatible: + oneOf: + - items: + - pattern: '^[a-z0-9]+,tegra-audio-alc5632(-[a-z0-9])+' + - const: nvidia,tegra-audio-alc5632 + - items: + - enum: + - nvidia,tegra-audio-max98090-nyan-big + - nvidia,tegra-audio-max98090-nyan-blaze + - const: nvidia,tegra-audio-max98090-nyan + - const: nvidia,tegra-audio-max98090 + - items: + - pattern: '^[a-z0-9]+,tegra-audio-max98090(-[a-z0-9])+' + - const: nvidia,tegra-audio-max98090 + - items: + - pattern: '^[a-z0-9]+,tegra-audio-rt56(39|40)(-[a-z0-9])+' + - const: nvidia,tegra-audio-rt5640 + - items: + - pattern: '^[a-z0-9]+,tegra-audio-rt5677(-[a-z0-9])+' + - const: nvidia,tegra-audio-rt5677 + - items: + - enum: + - toradex,tegra-audio-sgtl5000-apalis_t30 + - toradex,tegra-audio-sgtl5000-colibri_t30 + - toradex,tegra-audio-sgtl5000-apalis_tk1 + - const: nvidia,tegra-audio-sgtl5000 + - const: nvidia,tegra-audio-trimslice + - items: + - pattern: '^[a-z0-9]+,tegra-audio-wm8753(-[a-z0-9])+' + - const: nvidia,tegra-audio-wm8753 + - items: + - pattern: '^[a-z0-9]+,tegra-audio-(plutux|wm8903(-[a-z0-9])+)' + - const: nvidia,tegra-audio-wm8903 + - items: + - pattern: '^[a-z0-9]+,tegra-audio-wm9712(-[a-z0-9])+' + - const: nvidia,tegra-audio-wm9712 + + clocks: + items: + - description: PLL A clock + - description: PLL A OUT0 clock + - description: The Tegra cdev1/extern1 clock, which feeds the card's mclk + + clock-names: + items: + - const: pll_a + - const: pll_a_out0 + - const: mclk +
+ assigned-clocks: true + + assigned-clock-parents: true + + assigned-clock-rates: true
These properties are always allowed when 'clocks' is present. So you don't have to list them.
+ + nvidia,model: + $ref: /schemas/types.yaml#/definitions/string + description: The user-visible name of this sound complex. + + nvidia,audio-routing: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names for sources and + sinks are the pins (documented in the binding document), + and the jacks on the board: + ALC5632: + * Headset Stereophone + * Int Spk + * Headset Mic + * Digital Mic + MAXX98090: + * Headphones + * SPeakers + * Mic Jack + * Int Mic + RT5640: + * Headphones + * Speakers + * Mic Jack + RT5677: + * Headphone + * Speaker + * Headset Mic + * Internal Mic 1 + * Internal Mic 2 + SGTL5000: + * Headphone Jack + * Line In Jack + * Mic Jack + WM8753: + * Headphone Jack + * Mic Jack + WM8903: + * Headphone Jack + * Int Spk + * Mic Jack + * Int Mic + WM9712: + * Headphone + * LineIn + * Mic
All these strings should be part of the schema.
+
+ nvidia,ac97-controller:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: The phandle of the AC97 controller
+
+ nvidia,i2s-controller:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: The phandle of the Tegra I2S controller
+
+ nvidia,audio-codec:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: The phandle of audio codec
+
+ nvidia,spkr-en-gpios:
+ maxItems: 1
+ description: The GPIO that enables the speakers
+
+ nvidia,hp-mute-gpios:
+ maxItems: 1
+ description: The GPIO that mutes the headphones
+
+ nvidia,hp-det-gpios:
+ maxItems: 1
+ description: The GPIO that detect headphones are plugged in
+
+ nvidia,mic-det-gpios:
+ maxItems: 1
+ description: The GPIO that detect microphone is plugged in
+
+ nvidia,int-mic-en-gpios:
+ maxItems: 1
+ description: The GPIO that enables the internal microphone
+
+ nvidia,ext-mic-en-gpios:
+ maxItems: 1
+ description: The GPIO that enables the external microphone
+
+ nvidia,headset:
+ type: boolean
+ description: The Mic Jack represents state of the headset microphone pin
+
+additionalProperties: false
+
+required:
+ - compatible
+ - clocks
+ - clock-names
+
+oneOf:
+ - required:
+ - nvidia,audio-codec
+ - nvidia,i2s-controller
+ - required:
+ - nvidia,ac97-controller
+
+examples:
+ - |
+ #include <dt-bindings/clock/tegra30-car.h>
+
+ sound {
+ compatible = "toradex,tegra-audio-sgtl5000-apalis_t30",
+ "nvidia,tegra-audio-sgtl5000";
+ nvidia,model = "Toradex Apalis T30 SGTL5000";
+ nvidia,audio-routing =
+ "Headphone Jack", "HP_OUT",
+ "LINE_IN", "Line In Jack",
+ "MIC_IN", "Mic Jack";
+ nvidia,i2s-controller = <&tegra_i2s2>;
+ nvidia,audio-codec = <&codec>;
+ clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
+ <&tegra_car TEGRA30_CLK_PLL_A_OUT0>,
+ <&tegra_car TEGRA30_CLK_EXTERN1>;
+ clock-names = "pll_a", "pll_a_out0", "mclk";
+ };
--
2.33.0