1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
4 * Copyright (c) 2022, Linaro Limited
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
11
12#include "sc8280xp.dtsi"
13#include "sc8280xp-pmics.dtsi"
14
15/ {
16	model = "Lenovo ThinkPad X13s";
17	compatible = "lenovo,thinkpad-x13s", "qcom,sc8280xp";
18
19	backlight {
20		compatible = "pwm-backlight";
21		pwms = <&pmc8280c_lpg 3 1000000>;
22		enable-gpios = <&pmc8280_1_gpios 8 GPIO_ACTIVE_HIGH>;
23		power-supply = <&vreg_edp_bl>;
24
25		pinctrl-names = "default";
26		pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
27	};
28
29	vreg_edp_bl: regulator-edp-bl {
30		compatible = "regulator-fixed";
31
32		regulator-name = "VBL9";
33		regulator-min-microvolt = <3600000>;
34		regulator-max-microvolt = <3600000>;
35
36		gpio = <&pmc8280_1_gpios 9 GPIO_ACTIVE_HIGH>;
37		enable-active-high;
38
39		pinctrl-names = "default";
40		pinctrl-0 = <&edp_bl_reg_en>;
41
42		regulator-boot-on;
43	};
44
45	vreg_misc_3p3: regulator-misc-3p3 {
46		compatible = "regulator-fixed";
47
48		regulator-name = "VCC3B";
49		regulator-min-microvolt = <3300000>;
50		regulator-max-microvolt = <3300000>;
51
52		gpio = <&pmc8280_1_gpios 1 GPIO_ACTIVE_HIGH>;
53		enable-active-high;
54
55		pinctrl-names = "default";
56		pinctrl-0 = <&misc_3p3_reg_en>;
57
58		regulator-boot-on;
59		regulator-always-on;
60	};
61};
62
63&apps_rsc {
64	pmc8280-1-rpmh-regulators {
65		compatible = "qcom,pm8350-rpmh-regulators";
66		qcom,pmic-id = "b";
67
68		vdd-l3-l5-supply = <&vreg_s11b>;
69
70		vreg_s11b: smps11 {
71			regulator-name = "vreg_s11b";
72			regulator-min-microvolt = <1272000>;
73			regulator-max-microvolt = <1272000>;
74			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
75		};
76
77		vreg_l3b: ldo3 {
78			regulator-name = "vreg_l3b";
79			regulator-min-microvolt = <1200000>;
80			regulator-max-microvolt = <1200000>;
81			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
82			regulator-allow-set-load;
83			regulator-boot-on;
84		};
85
86		vreg_l4b: ldo4 {
87			regulator-name = "vreg_l4b";
88			regulator-min-microvolt = <912000>;
89			regulator-max-microvolt = <912000>;
90			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
91			regulator-allow-set-load;
92		};
93
94		vreg_l6b: ldo6 {
95			regulator-name = "vreg_l6b";
96			regulator-min-microvolt = <880000>;
97			regulator-max-microvolt = <880000>;
98			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
99			regulator-allow-set-load;
100			regulator-boot-on;
101			regulator-always-on;	// FIXME: VDD_A_EDP_0_0P9
102		};
103	};
104
105	pmc8280c-rpmh-regulators {
106		compatible = "qcom,pm8350c-rpmh-regulators";
107		qcom,pmic-id = "c";
108
109		vreg_l1c: ldo1 {
110			regulator-name = "vreg_l1c";
111			regulator-min-microvolt = <1800000>;
112			regulator-max-microvolt = <1800000>;
113			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
114			regulator-allow-set-load;
115		};
116
117		vreg_l12c: ldo12 {
118			regulator-name = "vreg_l12c";
119			regulator-min-microvolt = <1800000>;
120			regulator-max-microvolt = <1800000>;
121			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
122			regulator-allow-set-load;
123		};
124
125		vreg_l13c: ldo13 {
126			regulator-name = "vreg_l13c";
127			regulator-min-microvolt = <3072000>;
128			regulator-max-microvolt = <3072000>;
129			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
130			regulator-allow-set-load;
131		};
132	};
133
134	pmc8280-2-rpmh-regulators {
135		compatible = "qcom,pm8350-rpmh-regulators";
136		qcom,pmic-id = "d";
137
138		vdd-l1-l4-supply = <&vreg_s11b>;
139
140		vreg_l3d: ldo3 {
141			regulator-name = "vreg_l3d";
142			regulator-min-microvolt = <1200000>;
143			regulator-max-microvolt = <1200000>;
144			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
145			regulator-allow-set-load;
146		};
147
148		vreg_l4d: ldo4 {
149			regulator-name = "vreg_l4d";
150			regulator-min-microvolt = <1200000>;
151			regulator-max-microvolt = <1200000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153			regulator-allow-set-load;
154		};
155
156		vreg_l7d: ldo7 {
157			regulator-name = "vreg_l7d";
158			regulator-min-microvolt = <3072000>;
159			regulator-max-microvolt = <3072000>;
160			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
161			regulator-allow-set-load;
162		};
163
164		vreg_l9d: ldo9 {
165			regulator-name = "vreg_l9d";
166			regulator-min-microvolt = <912000>;
167			regulator-max-microvolt = <912000>;
168			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
169			regulator-allow-set-load;
170		};
171	};
172};
173
174&pmc8280c_lpg {
175	status = "okay";
176};
177
178&pmk8280_pon_pwrkey {
179	status = "okay";
180};
181
182&qup0 {
183	status = "okay";
184};
185
186&qup0_i2c4 {
187	clock-frequency = <400000>;
188
189	pinctrl-names = "default";
190	pinctrl-0 = <&qup0_i2c4_default>, <&ts0_default>;
191
192	status = "okay";
193
194	/* FIXME: verify */
195	touchscreen@10 {
196		compatible = "hid-over-i2c";
197		reg = <0x10>;
198		hid-descr-addr = <0x1>;
199		interrupts-extended = <&tlmm 175 IRQ_TYPE_LEVEL_LOW>;
200		vdd-supply = <&vreg_misc_3p3>;
201	};
202};
203
204&qup1 {
205	status = "okay";
206};
207
208&qup2 {
209	status = "okay";
210};
211
212&qup2_i2c5 {
213	clock-frequency = <400000>;
214
215	pinctrl-names = "default";
216	pinctrl-0 = <&qup2_i2c5_default>, <&kybd_default>, <&tpad_default>;
217
218	status = "okay";
219
220	touchpad@2c {
221		compatible = "hid-over-i2c";
222		reg = <0x2c>;
223		hid-descr-addr = <0x20>;
224		interrupts-extended = <&tlmm 182 IRQ_TYPE_LEVEL_LOW>;
225		vdd-supply = <&vreg_misc_3p3>;
226	};
227
228	keyboard@68 {
229		compatible = "hid-over-i2c";
230		reg = <0x68>;
231		hid-descr-addr = <0x1>;
232		interrupts-extended = <&tlmm 104 IRQ_TYPE_LEVEL_LOW>;
233		vdd-supply = <&vreg_misc_3p3>;
234	};
235};
236
237&remoteproc_adsp {
238	firmware-name = "qcom/sc8280xp/qcadsp8280.mbn";
239
240	status = "okay";
241};
242
243&remoteproc_nsp0 {
244	firmware-name = "qcom/sc8280xp/qccdsp8280.mbn";
245
246	status = "okay";
247};
248
249&usb_0 {
250	status = "okay";
251};
252
253&usb_0_dwc3 {
254	/* TODO: Define USB-C connector properly */
255	dr_mode = "host";
256};
257
258&usb_0_hsphy {
259	vdda-pll-supply = <&vreg_l9d>;
260	vdda18-supply = <&vreg_l1c>;
261	vdda33-supply = <&vreg_l7d>;
262
263	status = "okay";
264};
265
266&usb_0_qmpphy {
267	vdda-phy-supply = <&vreg_l9d>;
268	vdda-pll-supply = <&vreg_l4d>;
269
270	status = "okay";
271};
272
273&usb_1 {
274	status = "okay";
275};
276
277&usb_1_dwc3 {
278	/* TODO: Define USB-C connector properly */
279	dr_mode = "host";
280};
281
282&usb_1_hsphy {
283	vdda-pll-supply = <&vreg_l4b>;
284	vdda18-supply = <&vreg_l1c>;
285	vdda33-supply = <&vreg_l13c>;
286
287	status = "okay";
288};
289
290&usb_1_qmpphy {
291	vdda-phy-supply = <&vreg_l4b>;
292	vdda-pll-supply = <&vreg_l3b>;
293
294	status = "okay";
295};
296
297&xo_board_clk {
298	clock-frequency = <38400000>;
299};
300
301/* PINCTRL */
302
303&pmc8280_1_gpios {
304	edp_bl_en: edp-bl-en-state {
305		pins = "gpio8";
306		function = "normal";
307	};
308
309	edp_bl_reg_en: edp-bl-reg-en-state {
310		pins = "gpio9";
311		function = "normal";
312	};
313
314	misc_3p3_reg_en: misc-3p3-reg-en-state {
315		pins = "gpio1";
316		function = "normal";
317	};
318};
319
320&pmc8280c_gpios {
321	edp_bl_pwm: edp-bl-pwm-state {
322		pins = "gpio8";
323		function = "func1";
324	};
325};
326
327&tlmm {
328	gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;
329
330	kybd_default: kybd-default-state {
331		disable {
332			pins = "gpio102";
333			function = "gpio";
334			output-low;
335		};
336
337		int-n {
338			pins = "gpio104";
339			function = "gpio";
340			bias-disable;
341		};
342
343		reset {
344			pins = "gpio105";
345			function = "gpio";
346			bias-disable;
347		};
348	};
349
350	qup0_i2c4_default: qup0-i2c4-default-state {
351		pins = "gpio171", "gpio172";
352		function = "qup4";
353		bias-disable;
354		drive-strength = <16>;
355	};
356
357	qup2_i2c5_default: qup2-i2c5-default-state {
358		pins = "gpio81", "gpio82";
359		function = "qup21";
360		bias-disable;
361		drive-strength = <16>;
362	};
363
364	tpad_default: tpad-default-state {
365		int-n {
366			pins = "gpio182";
367			function = "gpio";
368			bias-disable;
369		};
370	};
371
372	ts0_default: ts0-default-state {
373		int-n {
374			pins = "gpio175";
375			function = "gpio";
376			bias-pull-up;
377		};
378
379		reset-n {
380			pins = "gpio99";
381			function = "gpio";
382			output-high;
383			drive-strength = <16>;
384		};
385	};
386};
387