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		assigned-clocks = <&clkc CLKID_MPLL2>,
61				  <&clkc CLKID_MPLL0>,
62				  <&clkc CLKID_MPLL1>;
63		assigned-clock-parents = <0>, <0>, <0>;
64		assigned-clock-rates = <294912000>,
65				       <270950400>,
66				       <393216000>;
67
68		dai-link-0 {
69			sound-dai = <&frddr_a>;
70		};
71
72		dai-link-1 {
73			sound-dai = <&frddr_b>;
74		};
75
76		dai-link-2 {
77			sound-dai = <&frddr_c>;
78		};
79
80		dai-link-3 {
81			sound-dai = <&toddr_a>;
82		};
83
84		dai-link-4 {
85			sound-dai = <&toddr_b>;
86		};
87
88		dai-link-5 {
89			sound-dai = <&toddr_c>;
90		};
91
92		/* 8ch hdmi interface */
93		dai-link-6 {
94			sound-dai = <&tdmif_b>;
95			dai-format = "i2s";
96			dai-tdm-slot-tx-mask-0 = <1 1>;
97			dai-tdm-slot-tx-mask-1 = <1 1>;
98			dai-tdm-slot-tx-mask-2 = <1 1>;
99			dai-tdm-slot-tx-mask-3 = <1 1>;
100			mclk-fs = <256>;
101
102			codec-0 {
103				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
104			};
105
106			codec-1 {
107				sound-dai = <&toacodec TOACODEC_IN_B>;
108			};
109		};
110
111		/* i2s jack output interface */
112		dai-link-7 {
113			sound-dai = <&tdmif_c>;
114			dai-format = "i2s";
115			dai-tdm-slot-tx-mask-0 = <1 1>;
116			mclk-fs = <256>;
117
118			codec-0 {
119				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
120			};
121
122			codec-1 {
123				sound-dai = <&toacodec TOACODEC_IN_C>;
124			};
125		};
126
127		/* hdmi glue */
128		dai-link-8 {
129			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
130
131			codec {
132				sound-dai = <&hdmi_tx>;
133			};
134		};
135
136		/* acodec glue */
137		dai-link-9 {
138			sound-dai = <&toacodec TOACODEC_OUT>;
139
140			codec {
141				sound-dai = <&acodec>;
142			};
143		};
144	};
145};
146
147&acodec {
148	AVDD-supply = <&vddao_1v8>;
149	status = "okay";
150};
151
152
153&clkc_audio {
154	status = "okay";
155};
156
157&cvbs_vdac_port {
158	cvbs_vdac_out: endpoint {
159		remote-endpoint = <&cvbs_connector_in>;
160	};
161};
162
163&frddr_a {
164	status = "okay";
165};
166
167&frddr_b {
168	status = "okay";
169};
170
171&frddr_c {
172	status = "okay";
173};
174
175&tdmif_b {
176	status = "okay";
177};
178
179&tdmif_c {
180	status = "okay";
181};
182
183&tdmin_a {
184	status = "okay";
185};
186
187&tdmin_b {
188	status = "okay";
189};
190
191&tdmin_c {
192	status = "okay";
193};
194
195&tdmout_b {
196	status = "okay";
197};
198
199&tdmout_c {
200	status = "okay";
201};
202
203&toacodec {
204	status = "okay";
205};
206
207&tohdmitx {
208	status = "okay";
209};
210
211&toddr_a {
212	status = "okay";
213};
214
215&toddr_b {
216	status = "okay";
217};
218
219&toddr_c {
220	status = "okay";
221};
222