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/leds/common.h>
12#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
13
14/ {
15	compatible = "azw,gsking-x", "amlogic,s922x", "amlogic,g12b";
16	model = "Beelink GS-King X";
17
18	aliases {
19		rtc0 = &rtc;
20		rtc1 = &vrtc;
21	};
22
23	gpio_fan: gpio-fan {
24		compatible = "gpio-fan";
25		gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
26		/* Using Dummy Speed */
27		gpio-fan,speed-map = <0 0>, <1 1>;
28		#cooling-cells = <2>;
29	};
30
31	gpio-keys-polled {
32		compatible = "gpio-keys-polled";
33		poll-interval = <100>;
34
35		power-button {
36			label = "power";
37			linux,code = <KEY_POWER>;
38			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
39		};
40	};
41
42	sound {
43		compatible = "amlogic,axg-sound-card";
44		model = "GSKING-X";
45		audio-aux-devs = <&tdmout_a>;
46		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 1",
47				"TDMOUT_A IN 1", "FRDDR_B OUT 1",
48				"TDMOUT_A IN 2", "FRDDR_C OUT 1",
49				"TDM_A Playback", "TDMOUT_A OUT";
50
51		assigned-clocks = <&clkc CLKID_MPLL2>,
52				  <&clkc CLKID_MPLL0>,
53				  <&clkc CLKID_MPLL1>;
54		assigned-clock-parents = <0>, <0>, <0>;
55		assigned-clock-rates = <294912000>,
56				       <270950400>,
57				       <393216000>;
58		status = "okay";
59
60		dai-link-0 {
61			sound-dai = <&frddr_a>;
62		};
63
64		dai-link-1 {
65			sound-dai = <&frddr_b>;
66		};
67
68		dai-link-2 {
69			sound-dai = <&frddr_c>;
70		};
71
72		/* 8ch hdmi interface */
73		dai-link-3 {
74			sound-dai = <&tdmif_a>;
75			dai-format = "i2s";
76			dai-tdm-slot-tx-mask-0 = <1 1>;
77			dai-tdm-slot-tx-mask-1 = <1 1>;
78			dai-tdm-slot-tx-mask-2 = <1 1>;
79			dai-tdm-slot-tx-mask-3 = <1 1>;
80			mclk-fs = <256>;
81
82			codec {
83				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
84			};
85		};
86
87		dai-link-4 {
88			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
89
90			codec {
91				sound-dai = <&hdmi_tx>;
92			};
93		};
94	};
95};
96
97&arb {
98	status = "okay";
99};
100
101&clkc_audio {
102	status = "okay";
103};
104
105&cpu_thermal {
106	trips {
107		cpu_active: cpu-active {
108			temperature = <70000>; /* millicelsius */
109			hysteresis = <2000>; /* millicelsius */
110			type = "active";
111		};
112	};
113
114	cooling-maps {
115		map {
116			trip = <&cpu_active>;
117			cooling-device = <&gpio_fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
118		};
119	};
120};
121
122&frddr_a {
123	status = "okay";
124};
125
126&frddr_b {
127	status = "okay";
128};
129
130&frddr_c {
131	status = "okay";
132};
133
134&i2c3 {
135	status = "okay";
136	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
137	pinctrl-names = "default";
138
139	rtc: rtc@51 {
140		compatible = "nxp,pcf8563";
141		reg = <0x51>;
142		wakeup-source;
143	};
144};
145
146&tdmif_a {
147	status = "okay";
148};
149
150&tdmout_a {
151	status = "okay";
152};
153
154&tohdmitx {
155	status = "okay";
156};
157