1// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2/*
3 * Copyright (c) 2022 Linaro Limited
4 */
5
6/dts-v1/;
7
8#include "sm6115.dtsi"
9#include "pm6125.dtsi"
10
11/ {
12	model = "Lenovo Tab P11";
13	compatible = "lenovo,j606f", "qcom,sm6115p", "qcom,sm6115";
14	chassis-type = "tablet";
15
16	/* required for bootloader to select correct board */
17	qcom,msm-id = <445 0x10000>, <420 0x10000>;
18	qcom,board-id = <34 3>;
19
20	aliases {
21		mmc0 = &sdhc_2;
22	};
23
24	chosen {
25		#address-cells = <2>;
26		#size-cells = <2>;
27		ranges;
28
29		framebuffer0: framebuffer@5c000000 {
30			compatible = "simple-framebuffer";
31			reg = <0 0x5c000000 0 (2000 * 1200 * 4)>;
32			width = <1200>;
33			height = <2000>;
34			stride = <(1200 * 4)>;
35			format = "a8r8g8b8";
36			clocks = <&gcc GCC_DISP_HF_AXI_CLK>;
37		};
38	};
39
40	gpio-keys {
41		compatible = "gpio-keys";
42
43		pinctrl-names = "default";
44		pinctrl-0 = <&vol_up_n>;
45
46		key-volume-up {
47			label = "Volume Up";
48			linux,code = <KEY_VOLUMEUP>;
49			gpios = <&pm6125_gpios 5 GPIO_ACTIVE_LOW>;
50			debounce-interval = <15>;
51			linux,can-disable;
52			wakeup-source;
53		};
54	};
55
56	reserved-memory {
57		ramoops@ffc00000 {
58			compatible = "ramoops";
59			reg = <0x0 0xffc00000 0x0 0x100000>;
60			record-size = <0x1000>;
61			console-size = <0x40000>;
62			ftrace-size = <0x20000>;
63			ecc-size = <16>;
64		};
65	};
66};
67
68&gpu {
69	status = "okay";
70
71	zap-shader {
72		firmware-name = "qcom/sm6115/LENOVO/J606F/a610_zap.mbn";
73	};
74};
75
76&mdss {
77	status = "okay";
78};
79
80&mdss_dsi0 {
81	vdda-supply = <&pm6125_l18>;
82	status = "okay";
83
84	panel: panel@0 {
85		compatible = "lenovo,j606f-boe-nt36523w", "novatek,nt36523w";
86		reg = <0>;
87
88		reset-gpios = <&tlmm 82 GPIO_ACTIVE_LOW>;
89		vddio-supply = <&pm6125_l9>;
90
91		pinctrl-names = "default";
92		pinctrl-0 = <&te_active &mdss_dsi_active>;
93
94		rotation = <180>; /* Yep, it's mounted upside down! */
95
96		port {
97			panel_in: endpoint {
98				remote-endpoint = <&mdss_dsi0_out>;
99			};
100		};
101	};
102};
103
104&mdss_dsi0_out {
105	data-lanes = <0 1 2 3>;
106	remote-endpoint = <&panel_in>;
107};
108
109&mdss_dsi0_phy {
110	status = "okay";
111};
112
113&pm6125_gpios {
114	vol_up_n: vol-up-n-state {
115		pins = "gpio5";
116		function = "normal";
117		power-source = <0>;
118		bias-pull-up;
119		input-enable;
120	};
121};
122
123&pon_pwrkey {
124	status = "okay";
125};
126
127&pon_resin {
128	linux,code = <KEY_VOLUMEDOWN>;
129	status = "okay";
130};
131
132&remoteproc_adsp {
133	firmware-name = "qcom/sm6115/LENOVO/J606F/adsp.mbn";
134	status = "okay";
135};
136
137&remoteproc_cdsp {
138	firmware-name = "qcom/sm6115/LENOVO/J606F/cdsp.mbn";
139	status = "okay";
140};
141
142&remoteproc_mpss {
143	firmware-name = "qcom/sm6115/LENOVO/J606F/modem.mbn";
144	status = "okay";
145};
146
147&rpm_requests {
148	regulators-0 {
149		compatible = "qcom,rpm-pm6125-regulators";
150
151		pm6125_s6: s6 {
152			regulator-min-microvolt = <304000>;
153			regulator-max-microvolt = <1456000>;
154		};
155
156		pm6125_s7: s7 {
157			regulator-min-microvolt = <1280000>;
158			regulator-max-microvolt = <2080000>;
159		};
160
161		pm6125_s8: s8 {
162			regulator-min-microvolt = <1064000>;
163			regulator-max-microvolt = <1304000>;
164		};
165
166		pm6125_l1: l1 {
167			regulator-min-microvolt = <952000>;
168			regulator-max-microvolt = <1152000>;
169		};
170
171		pm6125_l4: l4 {
172			regulator-min-microvolt = <488000>;
173			regulator-max-microvolt = <1000000>;
174		};
175
176		pm6125_l5: l5 {
177			regulator-min-microvolt = <1648000>;
178			/* 3.056V capped to 2.96V for SDHCI */
179			regulator-max-microvolt = <2960000>;
180			regulator-allow-set-load;
181			/* Broken hw, this one can't be turned off or SDHCI will break! */
182			regulator-always-on;
183		};
184
185		pm6125_l6: l6 {
186			regulator-min-microvolt = <576000>;
187			regulator-max-microvolt = <656000>;
188		};
189
190		pm6125_l7: l7 {
191			/* 1.2V-1.304V fixed at 1.256V for SDHCI bias */
192			regulator-min-microvolt = <1256000>;
193			regulator-max-microvolt = <1256000>;
194			/*
195			 * TODO: SDHCI seems to also work with this one turned off, however
196			 * there exists a possibility that it may not work with some very
197			 * specific SDCard types, perhaps validating this against a wide
198			 * range of models could rule that out, saving some power would
199			 * certainly be nice..
200			 */
201			regulator-always-on;
202		};
203
204		pm6125_l8: l8 {
205			regulator-min-microvolt = <400000>;
206			regulator-max-microvolt = <728000>;
207		};
208
209		pm6125_l9: l9 {
210			regulator-min-microvolt = <1800000>;
211			regulator-max-microvolt = <2000000>;
212		};
213
214		pm6125_l10: l10 {
215			regulator-min-microvolt = <1704000>;
216			regulator-max-microvolt = <1904000>;
217		};
218
219		pm6125_l11: l11 {
220			regulator-min-microvolt = <1704000>;
221			regulator-max-microvolt = <1952000>;
222		};
223
224		pm6125_l12: l12 {
225			regulator-min-microvolt = <1624000>;
226			regulator-max-microvolt = <1984000>;
227		};
228
229		pm6125_l13: l13 {
230			regulator-min-microvolt = <1504000>;
231			regulator-max-microvolt = <1952000>;
232		};
233
234		pm6125_l14: l14 {
235			regulator-min-microvolt = <1704000>;
236			regulator-max-microvolt = <1904000>;
237		};
238
239		pm6125_l15: l15 {
240			regulator-min-microvolt = <2920000>;
241			regulator-max-microvolt = <3232000>;
242		};
243
244		pm6125_l16: l16 {
245			regulator-min-microvolt = <1704000>;
246			regulator-max-microvolt = <1904000>;
247		};
248
249		pm6125_l17: l17 {
250			regulator-min-microvolt = <1152000>;
251			regulator-max-microvolt = <1384000>;
252		};
253
254		pm6125_l18: l18 {
255			/* 1.104V-1.312V fixed @ 1.232V for DSIPHY */
256			regulator-min-microvolt = <1232000>;
257			regulator-max-microvolt = <1232000>;
258		};
259
260		pm6125_l19: l19 {
261			regulator-min-microvolt = <1624000>;
262			regulator-max-microvolt = <3304000>;
263		};
264
265		pm6125_l20: l20 {
266			regulator-min-microvolt = <1624000>;
267			regulator-max-microvolt = <3304000>;
268		};
269
270		pm6125_l21: l21 {
271			regulator-min-microvolt = <2400000>;
272			regulator-max-microvolt = <3600000>;
273		};
274
275		pm6125_l22: l22 {
276			regulator-min-microvolt = <2952000>;
277			/* 3.304V capped to 2.96V for SDHCI */
278			regulator-max-microvolt = <2960000>;
279			regulator-allow-set-load;
280			/* Broken hw, this one can't be turned off or SDHCI will break! */
281			regulator-always-on;
282		};
283
284		pm6125_l23: l23 {
285			regulator-min-microvolt = <3200000>;
286			regulator-max-microvolt = <3400000>;
287		};
288
289		pm6125_l24: l24 {
290			regulator-min-microvolt = <2704000>;
291			regulator-max-microvolt = <3600000>;
292		};
293	};
294};
295
296&sdhc_2 {
297	cd-gpios = <&tlmm 88 GPIO_ACTIVE_HIGH>;
298	pinctrl-names = "default", "sleep";
299	pinctrl-0 = <&sdc2_state_on &sdc2_gate_pin>;
300	pinctrl-1 = <&sdc2_state_off>;
301	vmmc-supply = <&pm6125_l22>;
302	vqmmc-supply = <&pm6125_l5>;
303	no-sdio;
304	no-mmc;
305	status = "okay";
306};
307
308&sleep_clk {
309	clock-frequency = <32764>;
310};
311
312&tlmm {
313	gpio-reserved-ranges = <14 4>;
314
315	/*
316	 * This is a wholly undocumented pin (other than a single vague "pwr-gpios" reference)
317	 * that needs to be toggled for the SD Card slot to work properly..
318	 */
319	sdc2_gate_pin: sdc2-gate-state {
320		pins = "gpio45";
321		function = "gpio";
322		drive-strength = <2>;
323		bias-pull-up;
324		output-high;
325	};
326
327	te_active: te-active-state {
328		pins = "gpio81";
329		function = "mdp_vsync";
330		drive-strength = <2>;
331		bias-pull-down;
332	};
333
334	mdss_dsi_active: dsi-active-state {
335		pins = "gpio82";
336		function = "gpio";
337		drive-strength = <8>;
338		bias-disable;
339	};
340};
341
342&ufs_mem_hc {
343	vcc-supply = <&pm6125_l24>;
344	vcc-max-microamp = <600000>;
345	vccq2-supply = <&pm6125_l11>;
346	vccq2-max-microamp = <600000>;
347	status = "okay";
348};
349
350&ufs_mem_phy {
351	vdda-phy-supply = <&pm6125_l4>;
352	vdda-pll-supply = <&pm6125_l12>;
353	vddp-ref-clk-supply = <&pm6125_l18>;
354	status = "okay";
355};
356
357&usb {
358	status = "okay";
359};
360
361&usb_dwc3 {
362	maximum-speed = "high-speed";
363	dr_mode = "peripheral";
364
365	phys = <&usb_hsphy>;
366	phy-names = "usb2-phy";
367};
368
369&usb_hsphy {
370	vdd-supply = <&pm6125_l4>;
371	vdda-pll-supply = <&pm6125_l12>;
372	vdda-phy-dpdm-supply = <&pm6125_l15>;
373	status = "okay";
374};
375
376&wifi {
377	vdd-0.8-cx-mx-supply = <&pm6125_l8>;
378	vdd-1.8-xo-supply = <&pm6125_l16>;
379	vdd-1.3-rfa-supply = <&pm6125_l17>;
380	vdd-3.3-ch0-supply = <&pm6125_l23>;
381	qcom,ath10k-calibration-variant = "Lenovo_P11";
382	status = "okay";
383};
384
385&xo_board {
386	clock-frequency = <19200000>;
387};
388