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