Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode

Document the dai-link subnodes and the audio-routing property, allowing
to describe machine specific audio hardware and links in device tree.

While at it, also deprecate the old properties which were previously
used with the driver's partially hardcoded configuration.

Also, since describing machine specific audio hardware and links replaces
the now deprecated old logic doing the same in a driver hardcoded fashion,
it is not allowed to have both the old and new properties together.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-17-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

AngeloGioacchino Del Regno and committed by
Mark Brown
787f190c 5a50483c

+233 -18
+122 -9
Documentation/devicetree/bindings/sound/mt8186-mt6366-da7219-max98357.yaml
··· 12 12 description: 13 13 This binding describes the MT8186 sound card. 14 14 15 + allOf: 16 + - $ref: sound-card-common.yaml# 17 + 15 18 properties: 16 19 compatible: 17 20 enum: 18 21 - mediatek,mt8186-mt6366-da7219-max98357-sound 22 + 23 + audio-routing: 24 + $ref: /schemas/types.yaml#/definitions/non-unique-string-array 25 + description: 26 + A list of the connections between audio components. Each entry is a 27 + pair of strings, the first being the connection's sink, the second 28 + being the connection's source. 29 + Valid names could be the input or output widgets of audio components, 30 + power supplies, MicBias of codec and the software switch. 31 + minItems: 2 32 + items: 33 + enum: 34 + # Sinks 35 + - HDMI1 36 + - Headphones 37 + - Line Out 38 + - MIC 39 + - Speakers 40 + 41 + # Sources 42 + - Headset Mic 43 + - HPL 44 + - HPR 45 + - Speaker 46 + - TX 19 47 20 48 mediatek,platform: 21 49 $ref: /schemas/types.yaml#/definitions/phandle ··· 51 23 52 24 headset-codec: 53 25 type: object 26 + deprecated: true 54 27 additionalProperties: false 55 28 properties: 56 29 sound-dai: ··· 61 32 62 33 playback-codecs: 63 34 type: object 35 + deprecated: true 64 36 additionalProperties: false 65 37 properties: 66 38 sound-dai: ··· 83 53 A list of the desired dai-links in the sound card. Each entry is a 84 54 name defined in the machine driver. 85 55 86 - additionalProperties: false 56 + patternProperties: 57 + ".*-dai-link$": 58 + type: object 59 + additionalProperties: false 60 + description: 61 + Container for dai-link level properties and CODEC sub-nodes. 62 + 63 + properties: 64 + link-name: 65 + description: Indicates dai-link name and PCM stream name 66 + items: 67 + enum: 68 + - I2S0 69 + - I2S1 70 + - I2S2 71 + - I2S3 72 + 73 + codec: 74 + description: Holds subnode which indicates codec dai. 75 + type: object 76 + additionalProperties: false 77 + properties: 78 + sound-dai: 79 + minItems: 1 80 + maxItems: 2 81 + required: 82 + - sound-dai 83 + 84 + dai-format: 85 + description: audio format 86 + items: 87 + enum: 88 + - i2s 89 + - right_j 90 + - left_j 91 + - dsp_a 92 + - dsp_b 93 + 94 + mediatek,clk-provider: 95 + $ref: /schemas/types.yaml#/definitions/string 96 + description: Indicates dai-link clock master. 97 + items: 98 + enum: 99 + - cpu 100 + - codec 101 + 102 + required: 103 + - link-name 104 + 105 + unevaluatedProperties: false 87 106 88 107 required: 89 108 - compatible 90 109 - mediatek,platform 91 - - headset-codec 92 - - playback-codecs 110 + 111 + # Disallow legacy properties if xxx-dai-link nodes are specified 112 + if: 113 + not: 114 + patternProperties: 115 + ".*-dai-link$": false 116 + then: 117 + properties: 118 + headset-codec: false 119 + speaker-codecs: false 93 120 94 121 examples: 95 122 - | 96 123 97 124 sound: mt8186-sound { 98 125 compatible = "mediatek,mt8186-mt6366-da7219-max98357-sound"; 99 - mediatek,platform = <&afe>; 126 + model = "mt8186_da7219_m98357"; 100 127 pinctrl-names = "aud_clk_mosi_off", 101 128 "aud_clk_mosi_on"; 102 129 pinctrl-0 = <&aud_clk_mosi_off>; 103 130 pinctrl-1 = <&aud_clk_mosi_on>; 131 + mediatek,platform = <&afe>; 104 132 105 - headset-codec { 106 - sound-dai = <&da7219>; 133 + audio-routing = 134 + "Headphones", "HPL", 135 + "Headphones", "HPR", 136 + "MIC", "Headset Mic", 137 + "Speakers", "Speaker", 138 + "HDMI1", "TX"; 139 + 140 + hs-playback-dai-link { 141 + link-name = "I2S0"; 142 + dai-format = "i2s"; 143 + mediatek,clk-provider = "cpu"; 144 + codec { 145 + sound-dai = <&da7219>; 146 + }; 107 147 }; 108 148 109 - playback-codecs { 110 - sound-dai = <&anx_bridge_dp>, 111 - <&max98357a>; 149 + hs-capture-dai-link { 150 + link-name = "I2S1"; 151 + dai-format = "i2s"; 152 + mediatek,clk-provider = "cpu"; 153 + codec { 154 + sound-dai = <&da7219>; 155 + }; 156 + }; 157 + 158 + spk-dp-playback-dai-link { 159 + link-name = "I2S3"; 160 + dai-format = "i2s"; 161 + mediatek,clk-provider = "cpu"; 162 + codec { 163 + sound-dai = <&anx_bridge_dp>, <&max98357a>; 164 + }; 112 165 }; 113 166 }; 114 167
+111 -9
Documentation/devicetree/bindings/sound/mt8186-mt6366-rt1019-rt5682s.yaml
··· 12 12 description: 13 13 This binding describes the MT8186 sound card. 14 14 15 + allOf: 16 + - $ref: sound-card-common.yaml# 17 + 15 18 properties: 16 19 compatible: 17 20 enum: 18 21 - mediatek,mt8186-mt6366-rt1019-rt5682s-sound 19 22 - mediatek,mt8186-mt6366-rt5682s-max98360-sound 20 23 - mediatek,mt8186-mt6366-rt5650-sound 24 + 25 + audio-routing: 26 + $ref: /schemas/types.yaml#/definitions/non-unique-string-array 27 + description: 28 + A list of the connections between audio components. Each entry is a 29 + pair of strings, the first being the connection's sink, the second 30 + being the connection's source. 31 + Valid names could be the input or output widgets of audio components, 32 + power supplies, MicBias of codec and the software switch. 33 + minItems: 2 34 + items: 35 + enum: 36 + # Sinks 37 + - HDMI1 38 + - Headphone 39 + - IN1P 40 + - IN1N 41 + - Line Out 42 + - Speakers 43 + 44 + # Sources 45 + - Headset Mic 46 + - HPOL 47 + - HPOR 48 + - Speaker 49 + - SPOL 50 + - SPOR 51 + - TX 21 52 22 53 mediatek,platform: 23 54 $ref: /schemas/types.yaml#/definitions/phandle ··· 63 32 64 33 headset-codec: 65 34 type: object 35 + deprecated: true 66 36 additionalProperties: false 67 37 properties: 68 38 sound-dai: ··· 73 41 74 42 playback-codecs: 75 43 type: object 44 + deprecated: true 76 45 additionalProperties: false 77 46 properties: 78 47 sound-dai: ··· 95 62 A list of the desired dai-links in the sound card. Each entry is a 96 63 name defined in the machine driver. 97 64 98 - additionalProperties: false 65 + patternProperties: 66 + ".*-dai-link$": 67 + type: object 68 + additionalProperties: false 69 + description: 70 + Container for dai-link level properties and CODEC sub-nodes. 71 + 72 + properties: 73 + link-name: 74 + description: Indicates dai-link name and PCM stream name 75 + enum: [ I2S0, I2S1, I2S2, I2S3 ] 76 + 77 + codec: 78 + description: Holds subnode which indicates codec dai. 79 + type: object 80 + additionalProperties: false 81 + properties: 82 + sound-dai: 83 + minItems: 1 84 + maxItems: 2 85 + required: 86 + - sound-dai 87 + 88 + dai-format: 89 + description: audio format 90 + enum: [ i2s, right_j, left_j, dsp_a, dsp_b ] 91 + 92 + mediatek,clk-provider: 93 + $ref: /schemas/types.yaml#/definitions/string 94 + description: Indicates dai-link clock master. 95 + enum: [ cpu, codec ] 96 + 97 + required: 98 + - link-name 99 + 100 + unevaluatedProperties: false 99 101 100 102 required: 101 103 - compatible 102 104 - mediatek,platform 103 - - headset-codec 104 - - playback-codecs 105 + 106 + # Disallow legacy properties if xxx-dai-link nodes are specified 107 + if: 108 + not: 109 + patternProperties: 110 + ".*-dai-link$": false 111 + then: 112 + properties: 113 + headset-codec: false 114 + speaker-codecs: false 105 115 106 116 examples: 107 117 - | ··· 152 76 153 77 sound: mt8186-sound { 154 78 compatible = "mediatek,mt8186-mt6366-rt1019-rt5682s-sound"; 155 - mediatek,platform = <&afe>; 79 + model = "mt8186_rt1019_rt5682s"; 156 80 pinctrl-names = "aud_clk_mosi_off", 157 81 "aud_clk_mosi_on", 158 82 "aud_gpio_dmic_sec"; 159 83 pinctrl-0 = <&aud_clk_mosi_off>; 160 84 pinctrl-1 = <&aud_clk_mosi_on>; 161 85 pinctrl-2 = <&aud_gpio_dmic_sec>; 86 + mediatek,platform = <&afe>; 162 87 163 88 dmic-gpios = <&pio 23 GPIO_ACTIVE_HIGH>; 164 89 165 - headset-codec { 166 - sound-dai = <&rt5682s>; 90 + audio-routing = 91 + "Headphone", "HPOL", 92 + "Headphone", "HPOR", 93 + "IN1P", "Headset Mic", 94 + "Speakers", "Speaker", 95 + "HDMI1", "TX"; 96 + 97 + hs-playback-dai-link { 98 + link-name = "I2S0"; 99 + dai-format = "i2s"; 100 + mediatek,clk-provider = "cpu"; 101 + codec { 102 + sound-dai = <&rt5682s 0>; 103 + }; 167 104 }; 168 105 169 - playback-codecs { 170 - sound-dai = <&it6505dptx>, 171 - <&rt1019p>; 106 + hs-capture-dai-link { 107 + link-name = "I2S1"; 108 + dai-format = "i2s"; 109 + mediatek,clk-provider = "cpu"; 110 + codec { 111 + sound-dai = <&rt5682s 0>; 112 + }; 113 + }; 114 + 115 + spk-hdmi-playback-dai-link { 116 + link-name = "I2S3"; 117 + dai-format = "i2s"; 118 + mediatek,clk-provider = "cpu"; 119 + codec { 120 + sound-dai = <&it6505dptx>, <&rt1019p>; 121 + }; 172 122 }; 173 123 }; 174 124