1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
11#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
12#include "sm7225.dtsi"
13#include "pm6150l.dtsi"
14#include "pm6350.dtsi"
15
16/ {
17	model = "Fairphone 4";
18	compatible = "fairphone,fp4", "qcom,sm7225";
19	chassis-type = "handset";
20
21	/* required for bootloader to select correct board */
22	qcom,msm-id = <434 0x10000>, <459 0x10000>;
23	qcom,board-id = <8 32>;
24
25	aliases {
26		serial0 = &uart9;
27	};
28
29	chosen {
30		#address-cells = <2>;
31		#size-cells = <2>;
32		ranges;
33
34		stdout-path = "serial0:115200n8";
35
36		framebuffer0: framebuffer@a000000 {
37			compatible = "simple-framebuffer";
38			reg = <0 0xa0000000 0 (2340 * 1080 * 4)>;
39			width = <1080>;
40			height = <2340>;
41			stride = <(1080 * 4)>;
42			format = "a8r8g8b8";
43		};
44	};
45
46	gpio-keys {
47		compatible = "gpio-keys";
48		pinctrl-names = "default";
49		pinctrl-0 = <&gpio_keys_pin>;
50
51		volume-up {
52			label = "volume_up";
53			linux,code = <KEY_VOLUMEUP>;
54			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
55		};
56	};
57
58	reserved-memory {
59		/*
60		 * The rmtfs memory region in downstream is 'dynamically allocated'
61		 * but given the same address every time. Hard code it as this address is
62		 * where the modem firmware expects it to be.
63		 */
64		memory@efe01000 {
65			compatible = "qcom,rmtfs-mem";
66			reg = <0 0xefe01000 0 0x600000>;
67			no-map;
68
69			qcom,client-id = <1>;
70			qcom,vmid = <15>;
71		};
72	};
73};
74
75&adsp {
76	status = "okay";
77	firmware-name = "qcom/sm7225/fairphone4/adsp.mdt";
78};
79
80&apps_rsc {
81	pm6350-rpmh-regulators {
82		compatible = "qcom,pm6350-rpmh-regulators";
83		qcom,pmic-id = "a";
84
85		vreg_s1a: smps1 {
86			regulator-min-microvolt = <1000000>;
87			regulator-max-microvolt = <1200000>;
88		};
89
90		vreg_s2a: smps2 {
91			regulator-min-microvolt = <1503000>;
92			regulator-max-microvolt = <2048000>;
93		};
94
95		vreg_l2a: ldo2 {
96			regulator-min-microvolt = <1503000>;
97			regulator-max-microvolt = <1980000>;
98			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
99		};
100
101		vreg_l3a: ldo3 {
102			regulator-min-microvolt = <2700000>;
103			regulator-max-microvolt = <3300000>;
104			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
105		};
106
107		vreg_l4a: ldo4 {
108			regulator-min-microvolt = <352000>;
109			regulator-max-microvolt = <801000>;
110			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
111		};
112
113		vreg_l5a: ldo5 {
114			regulator-min-microvolt = <1503000>;
115			regulator-max-microvolt = <1980000>;
116			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
117		};
118
119		vreg_l6a: ldo6 {
120			regulator-min-microvolt = <1710000>;
121			regulator-max-microvolt = <3544000>;
122			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
123		};
124
125		vreg_l7a: ldo7 {
126			regulator-min-microvolt = <1620000>;
127			regulator-max-microvolt = <1980000>;
128			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
129		};
130
131		vreg_l8a: ldo8 {
132			regulator-min-microvolt = <2800000>;
133			regulator-max-microvolt = <2800000>;
134			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
135		};
136
137		vreg_l9a: ldo9 {
138			regulator-min-microvolt = <1650000>;
139			regulator-max-microvolt = <3401000>;
140			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
141		};
142
143		vreg_l11a: ldo11 {
144			regulator-min-microvolt = <1800000>;
145			regulator-max-microvolt = <2000000>;
146			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
147		};
148
149		vreg_l12a: ldo12 {
150			regulator-min-microvolt = <1620000>;
151			regulator-max-microvolt = <1980000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		vreg_l13a: ldo13 {
156			regulator-min-microvolt = <570000>;
157			regulator-max-microvolt = <650000>;
158			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
159		};
160
161		vreg_l14a: ldo14 {
162			regulator-min-microvolt = <1700000>;
163			regulator-max-microvolt = <1900000>;
164			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
165		};
166
167		vreg_l15a: ldo15 {
168			regulator-min-microvolt = <1100000>;
169			regulator-max-microvolt = <1305000>;
170			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
171		};
172
173		vreg_l16a: ldo16 {
174			regulator-min-microvolt = <830000>;
175			regulator-max-microvolt = <921000>;
176			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
177		};
178
179		vreg_l18a: ldo18 {
180			regulator-min-microvolt = <788000>;
181			regulator-max-microvolt = <1049000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183		};
184
185		vreg_l19a: ldo19 {
186			regulator-min-microvolt = <1080000>;
187			regulator-max-microvolt = <1305000>;
188			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
189		};
190
191		vreg_l20a: ldo20 {
192			regulator-min-microvolt = <530000>;
193			regulator-max-microvolt = <801000>;
194			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
195		};
196
197		vreg_l21a: ldo21 {
198			regulator-min-microvolt = <751000>;
199			regulator-max-microvolt = <825000>;
200			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
201		};
202
203		vreg_l22a: ldo22 {
204			regulator-min-microvolt = <1080000>;
205			regulator-max-microvolt = <1305000>;
206			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
207		};
208	};
209
210	pm6150l-rpmh-regulators {
211		compatible = "qcom,pm6150l-rpmh-regulators";
212		qcom,pmic-id = "e";
213
214		vreg_s8e: smps8 {
215			regulator-min-microvolt = <313000>;
216			regulator-max-microvolt = <1395000>;
217		};
218
219		vreg_l1e: ldo1 {
220			regulator-min-microvolt = <1620000>;
221			regulator-max-microvolt = <1980000>;
222			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
223		};
224
225		vreg_l2e: ldo2 {
226			regulator-min-microvolt = <1170000>;
227			regulator-max-microvolt = <1305000>;
228			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
229		};
230
231		vreg_l3e: ldo3 {
232			regulator-min-microvolt = <1100000>;
233			regulator-max-microvolt = <1299000>;
234			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
235		};
236
237		vreg_l4e: ldo4 {
238			regulator-min-microvolt = <1620000>;
239			regulator-max-microvolt = <3300000>;
240			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
241		};
242
243		vreg_l5e: ldo5 {
244			regulator-min-microvolt = <1620000>;
245			regulator-max-microvolt = <3300000>;
246			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
247		};
248
249		vreg_l6e: ldo6 {
250			regulator-min-microvolt = <1700000>;
251			regulator-max-microvolt = <3544000>;
252			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
253		};
254
255		vreg_l7e: ldo7 {
256			regulator-min-microvolt = <2700000>;
257			regulator-max-microvolt = <3544000>;
258			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
259		};
260
261		vreg_l8e: ldo8 {
262			regulator-min-microvolt = <1620000>;
263			regulator-max-microvolt = <2000000>;
264			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
265		};
266
267		vreg_l9e: ldo9 {
268			regulator-min-microvolt = <2700000>;
269			regulator-max-microvolt = <3544000>;
270			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
271		};
272
273		vreg_l10e: ldo10 {
274			regulator-min-microvolt = <3000000>;
275			regulator-max-microvolt = <3401000>;
276			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
277		};
278
279		vreg_l11e: ldo11 {
280			regulator-min-microvolt = <3000000>;
281			regulator-max-microvolt = <3401000>;
282			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
283		};
284
285		vreg_bob: bob {
286			regulator-min-microvolt = <1620000>;
287			regulator-max-microvolt = <5492000>;
288			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
289			regulator-allow-bypass;
290		};
291	};
292};
293
294&cdsp {
295	status = "okay";
296	firmware-name = "qcom/sm7225/fairphone4/cdsp.mdt";
297};
298
299&i2c10 {
300	status = "okay";
301	clock-frequency = <400000>;
302
303	haptics@5a {
304		compatible = "awinic,aw8695";
305		reg = <0x5a>;
306		interrupts-extended = <&tlmm 85 IRQ_TYPE_EDGE_FALLING>;
307		reset-gpios = <&tlmm 90 GPIO_ACTIVE_HIGH>;
308
309		awinic,f0-preset = <2350>;
310		awinic,f0-coefficient = <260>;
311		awinic,f0-calibration-percent = <7>;
312		awinic,drive-level = <125>;
313
314		awinic,f0-detection-play-time = <5>;
315		awinic,f0-detection-wait-time = <3>;
316		awinic,f0-detection-repeat = <2>;
317		awinic,f0-detection-trace = <15>;
318
319		awinic,boost-debug = /bits/ 8 <0x30 0xeb 0xd4>;
320		awinic,tset = /bits/ 8 <0x12>;
321		awinic,r-spare = /bits/ 8 <0x68>;
322
323		awinic,bemf-upper-threshold = <4104>;
324		awinic,bemf-lower-threshold = <1016>;
325	};
326};
327
328&mpss {
329	status = "okay";
330	firmware-name = "qcom/sm7225/fairphone4/modem.mdt";
331};
332
333&pm6150l_wled {
334	status = "okay";
335
336	qcom,switching-freq = <800>;
337	qcom,current-limit-microamp = <20000>;
338	qcom,num-strings = <2>;
339};
340
341&pm6350_gpios {
342	gpio_keys_pin: gpio-keys-pin {
343		pins = "gpio2";
344		function = PMIC_GPIO_FUNC_NORMAL;
345		bias-pull-up;
346		input-enable;
347		power-source = <0>;
348	};
349};
350
351&pm6350_resin {
352	status = "okay";
353	linux,code = <KEY_VOLUMEDOWN>;
354};
355
356&qupv3_id_1 {
357	status = "okay";
358};
359
360&tlmm {
361	gpio-reserved-ranges = <13 4>, <56 2>;
362};
363
364&uart9 {
365	status = "okay";
366};
367
368&ufs_mem_hc {
369	status = "okay";
370
371	reset-gpios = <&tlmm 156 GPIO_ACTIVE_LOW>;
372
373	vcc-supply = <&vreg_l7e>;
374	vcc-max-microamp = <800000>;
375	vccq2-supply = <&vreg_l12a>;
376	vccq2-max-microamp = <800000>;
377};
378
379&ufs_mem_phy {
380	status = "okay";
381
382	vdda-phy-supply = <&vreg_l18a>;
383	vdda-pll-supply = <&vreg_l22a>;
384};
385
386&usb_1 {
387	status = "okay";
388};
389
390&usb_1_dwc3 {
391	maximum-speed = "super-speed";
392	dr_mode = "peripheral";
393};
394
395&usb_1_hsphy {
396	status = "okay";
397
398	vdd-supply = <&vreg_l18a>;
399	vdda-pll-supply = <&vreg_l2a>;
400	vdda-phy-dpdm-supply = <&vreg_l3a>;
401};
402
403&usb_1_qmpphy {
404	status = "okay";
405
406	vdda-phy-supply = <&vreg_l22a>;
407	vdda-pll-supply = <&vreg_l16a>;
408};
409
410&wifi {
411	status = "okay";
412
413	vdd-0.8-cx-mx-supply = <&vreg_l4a>;
414	vdd-1.8-xo-supply = <&vreg_l7a>;
415	vdd-1.3-rfa-supply = <&vreg_l2e>;
416	vdd-3.3-ch0-supply = <&vreg_l10e>;
417	vdd-3.3-ch1-supply = <&vreg_l11e>;
418};
419