1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2021 BayLibre SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 */
6
7/dts-v1/;
8
9#include "meson-sm1-bananapi.dtsi"
10#include <dt-bindings/sound/meson-g12a-toacodec.h>
11#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13/ {
14	compatible = "bananapi,bpi-m5", "amlogic,sm1";
15	model = "Banana Pi BPI-M5";
16
17	/* TOFIX: handle CVBS_DET on SARADC channel 0 */
18	cvbs-connector {
19		compatible = "composite-video-connector";
20
21		port {
22			cvbs_connector_in: endpoint {
23				remote-endpoint = <&cvbs_vdac_out>;
24			};
25		};
26	};
27
28	sound {
29		compatible = "amlogic,axg-sound-card";
30		model = "BPI-M5";
31		audio-widgets = "Line", "Lineout";
32		audio-aux-devs = <&tdmout_b>, <&tdmout_c>,
33				 <&tdmin_a>, <&tdmin_b>, <&tdmin_c>;
34		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
35				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
36				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
37				"TDM_B Playback", "TDMOUT_B OUT",
38				"TDMOUT_C IN 0", "FRDDR_A OUT 2",
39				"TDMOUT_C IN 1", "FRDDR_B OUT 2",
40				"TDMOUT_C IN 2", "FRDDR_C OUT 2",
41				"TDM_C Playback", "TDMOUT_C OUT",
42				"TDMIN_A IN 4", "TDM_B Loopback",
43				"TDMIN_B IN 4", "TDM_B Loopback",
44				"TDMIN_C IN 4", "TDM_B Loopback",
45				"TDMIN_A IN 5", "TDM_C Loopback",
46				"TDMIN_B IN 5", "TDM_C Loopback",
47				"TDMIN_C IN 5", "TDM_C Loopback",
48				"TODDR_A IN 0", "TDMIN_A OUT",
49				"TODDR_B IN 0", "TDMIN_A OUT",
50				"TODDR_C IN 0", "TDMIN_A OUT",
51				"TODDR_A IN 1", "TDMIN_B OUT",
52				"TODDR_B IN 1", "TDMIN_B OUT",
53				"TODDR_C IN 1", "TDMIN_B OUT",
54				"TODDR_A IN 2", "TDMIN_C OUT",
55				"TODDR_B IN 2", "TDMIN_C OUT",
56				"TODDR_C IN 2", "TDMIN_C OUT",
57				"Lineout", "ACODEC LOLP",
58				"Lineout", "ACODEC LORP";
59
60		clocks = <&clkc CLKID_MPLL2>,
61			 <&clkc CLKID_MPLL0>,
62			 <&clkc CLKID_MPLL1>;
63
64		assigned-clocks = <&clkc CLKID_MPLL2>,
65				  <&clkc CLKID_MPLL0>,
66				  <&clkc CLKID_MPLL1>;
67		assigned-clock-parents = <0>, <0>, <0>;
68		assigned-clock-rates = <294912000>,
69				       <270950400>,
70				       <393216000>;
71
72		dai-link-0 {
73			sound-dai = <&frddr_a>;
74		};
75
76		dai-link-1 {
77			sound-dai = <&frddr_b>;
78		};
79
80		dai-link-2 {
81			sound-dai = <&frddr_c>;
82		};
83
84		dai-link-3 {
85			sound-dai = <&toddr_a>;
86		};
87
88		dai-link-4 {
89			sound-dai = <&toddr_b>;
90		};
91
92		dai-link-5 {
93			sound-dai = <&toddr_c>;
94		};
95
96		/* 8ch hdmi interface */
97		dai-link-6 {
98			sound-dai = <&tdmif_b>;
99			dai-format = "i2s";
100			dai-tdm-slot-tx-mask-0 = <1 1>;
101			dai-tdm-slot-tx-mask-1 = <1 1>;
102			dai-tdm-slot-tx-mask-2 = <1 1>;
103			dai-tdm-slot-tx-mask-3 = <1 1>;
104			mclk-fs = <256>;
105
106			codec-0 {
107				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
108			};
109
110			codec-1 {
111				sound-dai = <&toacodec TOACODEC_IN_B>;
112			};
113		};
114
115		/* i2s jack output interface */
116		dai-link-7 {
117			sound-dai = <&tdmif_c>;
118			dai-format = "i2s";
119			dai-tdm-slot-tx-mask-0 = <1 1>;
120			mclk-fs = <256>;
121
122			codec-0 {
123				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
124			};
125
126			codec-1 {
127				sound-dai = <&toacodec TOACODEC_IN_C>;
128			};
129		};
130
131		/* hdmi glue */
132		dai-link-8 {
133			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
134
135			codec {
136				sound-dai = <&hdmi_tx>;
137			};
138		};
139
140		/* acodec glue */
141		dai-link-9 {
142			sound-dai = <&toacodec TOACODEC_OUT>;
143
144			codec {
145				sound-dai = <&acodec>;
146			};
147		};
148	};
149};
150
151&acodec {
152	AVDD-supply = <&vddao_1v8>;
153	status = "okay";
154};
155
156
157&clkc_audio {
158	status = "okay";
159};
160
161&cvbs_vdac_port {
162	cvbs_vdac_out: endpoint {
163		remote-endpoint = <&cvbs_connector_in>;
164	};
165};
166
167&frddr_a {
168	status = "okay";
169};
170
171&frddr_b {
172	status = "okay";
173};
174
175&frddr_c {
176	status = "okay";
177};
178
179&tdmif_b {
180	status = "okay";
181};
182
183&tdmif_c {
184	status = "okay";
185};
186
187&tdmin_a {
188	status = "okay";
189};
190
191&tdmin_b {
192	status = "okay";
193};
194
195&tdmin_c {
196	status = "okay";
197};
198
199&tdmout_b {
200	status = "okay";
201};
202
203&tdmout_c {
204	status = "okay";
205};
206
207&toacodec {
208	status = "okay";
209};
210
211&tohdmitx {
212	status = "okay";
213};
214
215&toddr_a {
216	status = "okay";
217};
218
219&toddr_b {
220	status = "okay";
221};
222
223&toddr_c {
224	status = "okay";
225};
226