1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Google Gru-Chromebook shared properties
4 *
5 * Copyright 2018 Google, Inc
6 */
7
8#include "rk3399-gru.dtsi"
9
10/ {
11	pp900_ap: pp900-ap {
12		compatible = "regulator-fixed";
13		regulator-name = "pp900_ap";
14
15		/* EC turns on w/ pp900_ap_en; always on for AP */
16		regulator-always-on;
17		regulator-boot-on;
18		regulator-min-microvolt = <900000>;
19		regulator-max-microvolt = <900000>;
20
21		vin-supply = <&ppvar_sys>;
22	};
23
24	/* EC turns on w/ pp900_usb_en */
25	pp900_usb: pp900-ap {
26	};
27
28	/* EC turns on w/ pp900_pcie_en */
29	pp900_pcie: pp900-ap {
30	};
31
32	pp3000: pp3000 {
33		compatible = "regulator-fixed";
34		regulator-name = "pp3000";
35		pinctrl-names = "default";
36		pinctrl-0 = <&pp3000_en>;
37
38		enable-active-high;
39		gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
40
41		regulator-always-on;
42		regulator-boot-on;
43		regulator-min-microvolt = <3000000>;
44		regulator-max-microvolt = <3000000>;
45
46		vin-supply = <&ppvar_sys>;
47	};
48
49	ppvar_centerlogic_pwm: ppvar-centerlogic-pwm {
50		compatible = "pwm-regulator";
51		regulator-name = "ppvar_centerlogic_pwm";
52
53		pwms = <&pwm3 0 3337 0>;
54		pwm-supply = <&ppvar_sys>;
55		pwm-dutycycle-range = <100 0>;
56		pwm-dutycycle-unit = <100>;
57
58		/* EC turns on w/ ppvar_centerlogic_en; always on for AP */
59		regulator-always-on;
60		regulator-boot-on;
61		regulator-min-microvolt = <799434>;
62		regulator-max-microvolt = <1049925>;
63	};
64
65	ppvar_centerlogic: ppvar-centerlogic {
66		compatible = "vctrl-regulator";
67		regulator-name = "ppvar_centerlogic";
68
69		regulator-min-microvolt = <799434>;
70		regulator-max-microvolt = <1049925>;
71
72		ctrl-supply = <&ppvar_centerlogic_pwm>;
73		ctrl-voltage-range = <799434 1049925>;
74
75		regulator-settling-time-up-us = <378>;
76		min-slew-down-rate = <225>;
77		ovp-threshold-percent = <16>;
78	};
79
80	/* Schematics call this PPVAR even though it's fixed */
81	ppvar_logic: ppvar-logic {
82		compatible = "regulator-fixed";
83		regulator-name = "ppvar_logic";
84
85		/* EC turns on w/ ppvar_logic_en; always on for AP */
86		regulator-always-on;
87		regulator-boot-on;
88		regulator-min-microvolt = <900000>;
89		regulator-max-microvolt = <900000>;
90
91		vin-supply = <&ppvar_sys>;
92	};
93
94	pp1800_audio: pp1800-audio {
95		compatible = "regulator-fixed";
96		regulator-name = "pp1800_audio";
97		pinctrl-names = "default";
98		pinctrl-0 = <&pp1800_audio_en>;
99
100		enable-active-high;
101		gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>;
102
103		regulator-always-on;
104		regulator-boot-on;
105
106		vin-supply = <&pp1800>;
107	};
108
109	/* gpio is shared with pp3300_wifi_bt */
110	pp1800_pcie: pp1800-pcie {
111		compatible = "regulator-fixed";
112		regulator-name = "pp1800_pcie";
113		pinctrl-names = "default";
114		pinctrl-0 = <&wlan_module_pd_l>;
115
116		enable-active-high;
117		gpio = <&gpio0 4 GPIO_ACTIVE_HIGH>;
118
119		/*
120		 * Need to wait 1ms + ramp-up time before we can power on WiFi.
121		 * This has been approximated as 8ms total.
122		 */
123		regulator-enable-ramp-delay = <8000>;
124
125		vin-supply = <&pp1800>;
126	};
127
128	/* Always on; plain and simple */
129	pp3000_ap: pp3000_emmc: pp3000 {
130	};
131
132	pp1500_ap_io: pp1500-ap-io {
133		compatible = "regulator-fixed";
134		regulator-name = "pp1500_ap_io";
135		pinctrl-names = "default";
136		pinctrl-0 = <&pp1500_en>;
137
138		enable-active-high;
139		gpio = <&gpio0 10 GPIO_ACTIVE_HIGH>;
140
141		regulator-always-on;
142		regulator-boot-on;
143		regulator-min-microvolt = <1500000>;
144		regulator-max-microvolt = <1500000>;
145
146		vin-supply = <&pp1800>;
147	};
148
149	pp3300_disp: pp3300-disp {
150		compatible = "regulator-fixed";
151		regulator-name = "pp3300_disp";
152		pinctrl-names = "default";
153		pinctrl-0 = <&pp3300_disp_en>;
154
155		enable-active-high;
156		gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
157
158		startup-delay-us = <2000>;
159		vin-supply = <&pp3300>;
160	};
161
162	/* EC turns on w/ pp3300_usb_en_l */
163	pp3300_usb: pp3300 {
164	};
165
166	/* gpio is shared with pp1800_pcie and pinctrl is set there */
167	pp3300_wifi_bt: pp3300-wifi-bt {
168		compatible = "regulator-fixed";
169		regulator-name = "pp3300_wifi_bt";
170
171		enable-active-high;
172		gpio = <&gpio0 4 GPIO_ACTIVE_HIGH>;
173
174		vin-supply = <&pp3300>;
175	};
176
177	/*
178	 * This is a bit of a hack. The WiFi module should be reset at least
179	 * 1ms after its regulators have ramped up (max rampup time is ~7ms).
180	 * With some stretching of the imagination, we can call the 1.8V
181	 * regulator a supply.
182	 */
183	wlan_pd_n: wlan-pd-n {
184		compatible = "regulator-fixed";
185		regulator-name = "wlan_pd_n";
186		pinctrl-names = "default";
187		pinctrl-0 = <&wlan_module_reset_l>;
188
189		enable-active-high;
190		gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
191
192		vin-supply = <&pp1800_pcie>;
193	};
194
195	backlight: backlight {
196		compatible = "pwm-backlight";
197		brightness-levels = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
198				     17 18 19 20 21 22 23 24 25 26 27 28 29 30
199				     31 32 33 34 35 36 37 38 39 40 41 42 43 44
200				     45 46 47 48 49 50 51 52 53 54 55 56 57 58
201				     59 60 61 62 63 64 65 66 67 68 69 70 71 72
202				     73 74 75 76 77 78 79 80 81 82 83 84 85 86
203				     87 88 89 90 91 92 93 94 95 96 97 98 99 100>;
204		default-brightness-level = <51>;
205		enable-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
206		power-supply = <&pp3300_disp>;
207		pinctrl-names = "default";
208		pinctrl-0 = <&bl_en>;
209		pwm-delay-us = <10000>;
210	};
211};
212
213&ppvar_bigcpu {
214	min-slew-down-rate = <225>;
215	ovp-threshold-percent = <16>;
216};
217
218&ppvar_litcpu {
219	min-slew-down-rate = <225>;
220	ovp-threshold-percent = <16>;
221};
222
223&ppvar_gpu {
224	min-slew-down-rate = <225>;
225	ovp-threshold-percent = <16>;
226};
227
228&cdn_dp {
229	extcon = <&usbc_extcon0>, <&usbc_extcon1>;
230};
231
232&edp {
233	status = "okay";
234
235	rockchip,panel = <&edp_panel>;
236	ports {
237		edp_out: port@1 {
238			reg = <1>;
239			#address-cells = <1>;
240			#size-cells = <0>;
241
242			edp_out_panel: endpoint@0 {
243				reg = <0>;
244				remote-endpoint = <&panel_in_edp>;
245			};
246		};
247	};
248};
249
250ap_i2c_mic: &i2c1 {
251	status = "okay";
252
253	clock-frequency = <400000>;
254
255	/* These are relatively safe rise/fall times */
256	i2c-scl-falling-time-ns = <50>;
257	i2c-scl-rising-time-ns = <300>;
258
259	headsetcodec: rt5514@57 {
260		compatible = "realtek,rt5514";
261		reg = <0x57>;
262		realtek,dmic-init-delay-ms = <20>;
263	};
264};
265
266ap_i2c_tp: &i2c5 {
267	status = "okay";
268
269	clock-frequency = <400000>;
270
271	/* These are relatively safe rise/fall times */
272	i2c-scl-falling-time-ns = <50>;
273	i2c-scl-rising-time-ns = <300>;
274
275	/*
276	 * Note strange pullup enable.  Apparently this avoids leakage but
277	 * still allows us to get nice 4.7K pullups for high speed i2c
278	 * transfers.  Basically we want the pullup on whenever the ap is
279	 * alive, so the "en" pin just gets set to output high.
280	 */
281	pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
282};
283
284&cros_ec {
285	cros_ec_pwm: ec-pwm {
286		compatible = "google,cros-ec-pwm";
287		#pwm-cells = <1>;
288	};
289
290	usbc_extcon1: extcon@1 {
291		compatible = "google,extcon-usbc-cros-ec";
292		google,usb-port-id = <1>;
293
294		#extcon-cells = <0>;
295	};
296};
297
298&sound {
299	rockchip,codec = <&max98357a &headsetcodec
300			  &codec &wacky_spi_audio &cdn_dp>;
301};
302
303&spi2 {
304	wacky_spi_audio: spi2@0 {
305		compatible = "realtek,rt5514";
306		reg = <0>;
307		interrupt-parent = <&gpio1>;
308		interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
309		pinctrl-names = "default";
310		pinctrl-0 = <&mic_int>;
311		/* May run faster once verified. */
312		spi-max-frequency = <10000000>;
313		wakeup-source;
314	};
315};
316
317&pci_rootport {
318	mvl_wifi: wifi@0,0 {
319		compatible = "pci1b4b,2b42";
320		reg = <0x83010000 0x0 0x00000000 0x0 0x00100000
321		       0x83010000 0x0 0x00100000 0x0 0x00100000>;
322		interrupt-parent = <&gpio0>;
323		interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
324		pinctrl-names = "default";
325		pinctrl-0 = <&wlan_host_wake_l>;
326		wakeup-source;
327	};
328};
329
330&tcphy1 {
331	status = "okay";
332	extcon = <&usbc_extcon1>;
333};
334
335&u2phy1 {
336	status = "okay";
337};
338
339&usb_host0_ehci {
340	status = "okay";
341};
342
343&usb_host1_ehci {
344	status = "okay";
345};
346
347&usb_host1_ohci {
348	status = "okay";
349};
350
351&usbdrd3_1 {
352	status = "okay";
353	extcon = <&usbc_extcon1>;
354};
355
356&usbdrd_dwc3_1 {
357	status = "okay";
358	dr_mode = "host";
359};
360
361&pinctrl {
362	discrete-regulators {
363		pp1500_en: pp1500-en {
364			rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
365					 &pcfg_pull_none>;
366		};
367
368		pp1800_audio_en: pp1800-audio-en {
369			rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
370					 &pcfg_pull_down>;
371		};
372
373		pp3000_en: pp3000-en {
374			rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
375					 &pcfg_pull_none>;
376		};
377
378		pp3300_disp_en: pp3300-disp-en {
379			rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
380					 &pcfg_pull_none>;
381		};
382
383		wlan_module_pd_l: wlan-module-pd-l {
384			rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
385					 &pcfg_pull_down>;
386		};
387	};
388};
389
390&wifi {
391	wifi_perst_l: wifi-perst-l {
392		rockchip,pins = <2 27 RK_FUNC_GPIO &pcfg_pull_none>;
393	};
394
395	wlan_host_wake_l: wlan-host-wake-l {
396		rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
397	};
398};
399