1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
6 */
7
8/dts-v1/;
9
10#include "meson-g12b-w400.dtsi"
11#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13/ {
14	compatible = "azw,gtking", "amlogic,g12b";
15	model = "Beelink GT-King";
16
17	spdif_dit: audio-codec-1 {
18		#sound-dai-cells = <0>;
19		compatible = "linux,spdif-dit";
20		status = "okay";
21		sound-name-prefix = "DIT";
22	};
23
24	sound {
25		compatible = "amlogic,axg-sound-card";
26		model = "G12B-GTKING";
27		audio-aux-devs = <&tdmout_b>;
28		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
29				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
30				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
31				"TDM_B Playback", "TDMOUT_B OUT",
32				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
33				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
34				"SPDIFOUT IN 2", "FRDDR_C OUT 3";
35
36		assigned-clocks = <&clkc CLKID_MPLL2>,
37				  <&clkc CLKID_MPLL0>,
38				  <&clkc CLKID_MPLL1>;
39		assigned-clock-parents = <0>, <0>, <0>;
40		assigned-clock-rates = <294912000>,
41				       <270950400>,
42				       <393216000>;
43		status = "okay";
44
45		dai-link-0 {
46			sound-dai = <&frddr_a>;
47		};
48
49		dai-link-1 {
50			sound-dai = <&frddr_b>;
51		};
52
53		dai-link-2 {
54			sound-dai = <&frddr_c>;
55		};
56
57		/* 8ch hdmi interface */
58		dai-link-3 {
59			sound-dai = <&tdmif_b>;
60			dai-format = "i2s";
61			dai-tdm-slot-tx-mask-0 = <1 1>;
62			dai-tdm-slot-tx-mask-1 = <1 1>;
63			dai-tdm-slot-tx-mask-2 = <1 1>;
64			dai-tdm-slot-tx-mask-3 = <1 1>;
65			mclk-fs = <256>;
66
67			codec {
68				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
69			};
70		};
71
72		/* spdif hdmi or toslink interface */
73		dai-link-4 {
74			sound-dai = <&spdifout>;
75
76			codec-0 {
77				sound-dai = <&spdif_dit>;
78			};
79
80			codec-1 {
81				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>;
82			};
83		};
84
85		/* spdif hdmi interface */
86		dai-link-5 {
87			sound-dai = <&spdifout_b>;
88
89			codec {
90				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>;
91			};
92		};
93
94		/* hdmi glue */
95		dai-link-6 {
96			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
97
98			codec {
99				sound-dai = <&hdmi_tx>;
100			};
101		};
102	};
103};
104
105&arb {
106	status = "okay";
107};
108
109&clkc_audio {
110	status = "okay";
111};
112
113&frddr_a {
114	status = "okay";
115};
116
117&frddr_b {
118	status = "okay";
119};
120
121&frddr_c {
122	status = "okay";
123};
124
125&spdifout {
126	pinctrl-0 = <&spdif_out_h_pins>;
127	pinctrl-names = "default";
128	status = "okay";
129};
130
131&spdifout_b {
132	status = "okay";
133};
134
135&tdmif_b {
136	status = "okay";
137};
138
139&tdmout_b {
140	status = "okay";
141};
142
143&tohdmitx {
144	status = "okay";
145};
146