xref: /freebsd/sys/contrib/device-tree/src/arm64/qcom/sm7225-fairphone-fp4.dts (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Luca Weiss <luca@z3ntu.xyz>
4 */
5
6/dts-v1/;
7
8/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */
9#define PMK8350_SID 6
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/leds/common.h>
15#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
16#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
17#include "sm7225.dtsi"
18#include "pm6150l.dtsi"
19#include "pm6350.dtsi"
20#include "pm7250b.dtsi"
21#include "pmk8350.dtsi"
22
23/ {
24	model = "Fairphone 4";
25	compatible = "fairphone,fp4", "qcom,sm7225";
26	chassis-type = "handset";
27
28	/* required for bootloader to select correct board */
29	qcom,msm-id = <434 0x10000>, <459 0x10000>;
30	qcom,board-id = <8 32>;
31
32	aliases {
33		serial0 = &uart9;
34		serial1 = &uart1;
35	};
36
37	chosen {
38		#address-cells = <2>;
39		#size-cells = <2>;
40		ranges;
41
42		stdout-path = "serial0:115200n8";
43
44		framebuffer0: framebuffer@a000000 {
45			compatible = "simple-framebuffer";
46			reg = <0 0xa0000000 0 (2340 * 1080 * 4)>;
47			width = <1080>;
48			height = <2340>;
49			stride = <(1080 * 4)>;
50			format = "a8r8g8b8";
51		};
52	};
53
54	gpio-keys {
55		compatible = "gpio-keys";
56		pinctrl-names = "default";
57		pinctrl-0 = <&gpio_keys_pin>;
58
59		key-volume-up {
60			label = "volume_up";
61			linux,code = <KEY_VOLUMEUP>;
62			gpios = <&pm6350_gpios 2 GPIO_ACTIVE_LOW>;
63		};
64	};
65
66	reserved-memory {
67		/*
68		 * The rmtfs memory region in downstream is 'dynamically allocated'
69		 * but given the same address every time. Hard code it as this address is
70		 * where the modem firmware expects it to be.
71		 */
72		memory@efe01000 {
73			compatible = "qcom,rmtfs-mem";
74			reg = <0 0xefe01000 0 0x600000>;
75			no-map;
76
77			qcom,client-id = <1>;
78			qcom,vmid = <15>;
79		};
80	};
81
82	thermal-zones {
83		chg-skin-thermal {
84			polling-delay-passive = <0>;
85			polling-delay = <0>;
86			thermal-sensors = <&pm7250b_adc_tm 0>;
87
88			trips {
89				active-config0 {
90					temperature = <125000>;
91					hysteresis = <1000>;
92					type = "passive";
93				};
94			};
95		};
96
97		conn-thermal {
98			polling-delay-passive = <0>;
99			polling-delay = <0>;
100			thermal-sensors = <&pm7250b_adc_tm 1>;
101
102			trips {
103				active-config0 {
104					temperature = <125000>;
105					hysteresis = <1000>;
106					type = "passive";
107				};
108			};
109		};
110	};
111};
112
113&adsp {
114	firmware-name = "qcom/sm7225/fairphone4/adsp.mdt";
115	status = "okay";
116};
117
118&apps_rsc {
119	regulators-0 {
120		compatible = "qcom,pm6350-rpmh-regulators";
121		qcom,pmic-id = "a";
122
123		vreg_s1a: smps1 {
124			regulator-min-microvolt = <1000000>;
125			regulator-max-microvolt = <1200000>;
126		};
127
128		vreg_s2a: smps2 {
129			regulator-min-microvolt = <1503000>;
130			regulator-max-microvolt = <2048000>;
131		};
132
133		vreg_l2a: ldo2 {
134			regulator-min-microvolt = <1503000>;
135			regulator-max-microvolt = <1980000>;
136			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
137		};
138
139		vreg_l3a: ldo3 {
140			regulator-min-microvolt = <2700000>;
141			regulator-max-microvolt = <3300000>;
142			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
143		};
144
145		vreg_l4a: ldo4 {
146			regulator-min-microvolt = <352000>;
147			regulator-max-microvolt = <801000>;
148			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
149		};
150
151		vreg_l5a: ldo5 {
152			regulator-min-microvolt = <1503000>;
153			regulator-max-microvolt = <1980000>;
154			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
155		};
156
157		vreg_l6a: ldo6 {
158			regulator-min-microvolt = <1710000>;
159			regulator-max-microvolt = <3544000>;
160			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
161		};
162
163		vreg_l7a: ldo7 {
164			regulator-min-microvolt = <1620000>;
165			regulator-max-microvolt = <1980000>;
166			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
167		};
168
169		vreg_l8a: ldo8 {
170			regulator-min-microvolt = <2800000>;
171			regulator-max-microvolt = <2800000>;
172			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
173		};
174
175		vreg_l9a: ldo9 {
176			regulator-min-microvolt = <1650000>;
177			regulator-max-microvolt = <3401000>;
178			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
179		};
180
181		vreg_l11a: ldo11 {
182			regulator-min-microvolt = <1800000>;
183			regulator-max-microvolt = <2000000>;
184			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
185		};
186
187		vreg_l12a: ldo12 {
188			regulator-min-microvolt = <1620000>;
189			regulator-max-microvolt = <1980000>;
190			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
191		};
192
193		vreg_l13a: ldo13 {
194			regulator-min-microvolt = <570000>;
195			regulator-max-microvolt = <650000>;
196			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
197		};
198
199		vreg_l14a: ldo14 {
200			regulator-min-microvolt = <1700000>;
201			regulator-max-microvolt = <1900000>;
202			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
203		};
204
205		vreg_l15a: ldo15 {
206			regulator-min-microvolt = <1100000>;
207			regulator-max-microvolt = <1305000>;
208			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
209		};
210
211		vreg_l16a: ldo16 {
212			regulator-min-microvolt = <830000>;
213			regulator-max-microvolt = <921000>;
214			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
215		};
216
217		vreg_l18a: ldo18 {
218			regulator-min-microvolt = <788000>;
219			regulator-max-microvolt = <1049000>;
220			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
221		};
222
223		vreg_l19a: ldo19 {
224			regulator-min-microvolt = <1080000>;
225			regulator-max-microvolt = <1305000>;
226			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
227		};
228
229		vreg_l20a: ldo20 {
230			regulator-min-microvolt = <530000>;
231			regulator-max-microvolt = <801000>;
232			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
233		};
234
235		vreg_l21a: ldo21 {
236			regulator-min-microvolt = <751000>;
237			regulator-max-microvolt = <825000>;
238			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
239		};
240
241		vreg_l22a: ldo22 {
242			regulator-min-microvolt = <1080000>;
243			regulator-max-microvolt = <1305000>;
244			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245		};
246	};
247
248	regulators-1 {
249		compatible = "qcom,pm6150l-rpmh-regulators";
250		qcom,pmic-id = "e";
251
252		vreg_s8e: smps8 {
253			regulator-min-microvolt = <313000>;
254			regulator-max-microvolt = <1395000>;
255		};
256
257		vreg_l1e: ldo1 {
258			regulator-min-microvolt = <1620000>;
259			regulator-max-microvolt = <1980000>;
260			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
261		};
262
263		vreg_l2e: ldo2 {
264			regulator-min-microvolt = <1170000>;
265			regulator-max-microvolt = <1305000>;
266			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
267		};
268
269		vreg_l3e: ldo3 {
270			regulator-min-microvolt = <1100000>;
271			regulator-max-microvolt = <1299000>;
272			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
273		};
274
275		vreg_l4e: ldo4 {
276			regulator-min-microvolt = <1620000>;
277			regulator-max-microvolt = <3300000>;
278			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
279		};
280
281		vreg_l5e: ldo5 {
282			regulator-min-microvolt = <1620000>;
283			regulator-max-microvolt = <3300000>;
284			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
285		};
286
287		vreg_l6e: ldo6 {
288			regulator-min-microvolt = <1700000>;
289			regulator-max-microvolt = <2950000>;
290			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
291			regulator-allow-set-load;
292			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
293						   RPMH_REGULATOR_MODE_HPM>;
294		};
295
296		vreg_l7e: ldo7 {
297			regulator-min-microvolt = <2700000>;
298			regulator-max-microvolt = <3544000>;
299			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
300		};
301
302		vreg_l8e: ldo8 {
303			regulator-min-microvolt = <1620000>;
304			regulator-max-microvolt = <2000000>;
305			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
306		};
307
308		vreg_l9e: ldo9 {
309			regulator-min-microvolt = <2700000>;
310			regulator-max-microvolt = <2960000>;
311			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
312			regulator-allow-set-load;
313			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
314						   RPMH_REGULATOR_MODE_HPM>;
315		};
316
317		vreg_l10e: ldo10 {
318			regulator-min-microvolt = <3000000>;
319			regulator-max-microvolt = <3401000>;
320			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
321		};
322
323		vreg_l11e: ldo11 {
324			regulator-min-microvolt = <3000000>;
325			regulator-max-microvolt = <3401000>;
326			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
327		};
328
329		vreg_bob: bob {
330			regulator-min-microvolt = <1620000>;
331			regulator-max-microvolt = <5492000>;
332			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
333			regulator-allow-bypass;
334		};
335	};
336};
337
338&cci0 {
339	status = "okay";
340};
341
342&cci0_i2c0 {
343	/* IMX582 @ 0x1a */
344};
345
346&cci0_i2c1 {
347	/* IMX582 @ 0x1a */
348};
349
350&cci1 {
351	status = "okay";
352};
353
354&cci1_i2c0 {
355	/* IMX576 @ 0x10 */
356};
357
358&cdsp {
359	firmware-name = "qcom/sm7225/fairphone4/cdsp.mdt";
360	status = "okay";
361};
362
363&gpi_dma0 {
364	status = "okay";
365};
366
367&gpi_dma1 {
368	status = "okay";
369};
370
371&i2c0 {
372	clock-frequency = <400000>;
373	status = "okay";
374
375	/* ST21NFCD NFC @ 8 */
376	/* VL53L3 ToF @ 29 */
377	/* AW88264A amplifier @ 34 */
378	/* AW88264A amplifier @ 35 */
379};
380
381&i2c8 {
382	clock-frequency = <400000>;
383	status = "okay";
384
385	/* HX83112A touchscreen @ 48 */
386};
387
388&i2c10 {
389	clock-frequency = <400000>;
390	status = "okay";
391
392	/* PM8008 PMIC @ 8 and 9 */
393	/* PX8618 @ 26 */
394	/* SMB1395 PMIC @ 34 */
395
396	haptics@5a {
397		compatible = "awinic,aw8695";
398		reg = <0x5a>;
399		interrupts-extended = <&tlmm 85 IRQ_TYPE_EDGE_FALLING>;
400		reset-gpios = <&tlmm 90 GPIO_ACTIVE_HIGH>;
401
402		awinic,f0-preset = <2350>;
403		awinic,f0-coefficient = <260>;
404		awinic,f0-calibration-percent = <7>;
405		awinic,drive-level = <125>;
406
407		awinic,f0-detection-play-time = <5>;
408		awinic,f0-detection-wait-time = <3>;
409		awinic,f0-detection-repeat = <2>;
410		awinic,f0-detection-trace = <15>;
411
412		awinic,boost-debug = /bits/ 8 <0x30 0xeb 0xd4>;
413		awinic,tset = /bits/ 8 <0x12>;
414		awinic,r-spare = /bits/ 8 <0x68>;
415
416		awinic,bemf-upper-threshold = <4104>;
417		awinic,bemf-lower-threshold = <1016>;
418	};
419};
420
421&ipa {
422	qcom,gsi-loader = "self";
423	memory-region = <&pil_ipa_fw_mem>;
424	firmware-name = "qcom/sm7225/fairphone4/ipa_fws.mdt";
425	status = "okay";
426};
427
428&mpss {
429	firmware-name = "qcom/sm7225/fairphone4/modem.mdt";
430	status = "okay";
431};
432
433&pm6150l_flash {
434	status = "okay";
435
436	led-0 {
437		function = LED_FUNCTION_FLASH;
438		color = <LED_COLOR_ID_YELLOW>;
439		led-sources = <1>;
440		led-max-microamp = <180000>;
441		flash-max-microamp = <1000000>;
442		flash-max-timeout-us = <1280000>;
443	};
444
445	led-1 {
446		function = LED_FUNCTION_FLASH;
447		color = <LED_COLOR_ID_WHITE>;
448		led-sources = <2>;
449		led-max-microamp = <180000>;
450		flash-max-microamp = <1000000>;
451		flash-max-timeout-us = <1280000>;
452	};
453};
454
455&pm6150l_wled {
456	qcom,switching-freq = <800>;
457	qcom,current-limit-microamp = <20000>;
458	qcom,num-strings = <2>;
459
460	status = "okay";
461};
462
463&pm6350_gpios {
464	gpio_keys_pin: gpio-keys-state {
465		pins = "gpio2";
466		function = PMIC_GPIO_FUNC_NORMAL;
467		bias-pull-up;
468		input-enable;
469		power-source = <0>;
470	};
471};
472
473&pm6350_resin {
474	linux,code = <KEY_VOLUMEDOWN>;
475	status = "okay";
476};
477
478&pm7250b_adc {
479	adc-chan@4d {
480		reg = <ADC5_AMUX_THM1_100K_PU>;
481		qcom,ratiometric;
482		qcom,hw-settle-time = <200>;
483		qcom,pre-scaling = <1 1>;
484		label = "charger_skin_therm";
485	};
486
487	adc-chan@4f {
488		reg = <ADC5_AMUX_THM3_100K_PU>;
489		qcom,ratiometric;
490		qcom,hw-settle-time = <200>;
491		qcom,pre-scaling = <1 1>;
492		label = "conn_therm";
493	};
494};
495
496&pm7250b_adc_tm {
497	status = "okay";
498
499	charger-skin-therm@0 {
500		reg = <0>;
501		io-channels = <&pm7250b_adc ADC5_AMUX_THM1_100K_PU>;
502		qcom,ratiometric;
503		qcom,hw-settle-time-us = <200>;
504	};
505
506	conn-therm@1 {
507		reg = <1>;
508		io-channels = <&pm7250b_adc ADC5_AMUX_THM3_100K_PU>;
509		qcom,ratiometric;
510		qcom,hw-settle-time-us = <200>;
511	};
512};
513
514&pmk8350_rtc {
515	status = "okay";
516};
517
518&pmk8350_vadc {
519	adc-chan@644 {
520		reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
521		qcom,ratiometric;
522		qcom,hw-settle-time = <200>;
523		qcom,pre-scaling = <1 1>;
524		label = "xo_therm";
525	};
526};
527
528&qup_uart1_cts {
529	/*
530	 * Configure a bias-bus-hold on CTS to lower power
531	 * usage when Bluetooth is turned off. Bus hold will
532	 * maintain a low power state regardless of whether
533	 * the Bluetooth module drives the pin in either
534	 * direction or leaves the pin fully unpowered.
535	 */
536	bias-bus-hold;
537};
538
539&qup_uart1_rts {
540	/* We'll drive RTS, so no pull */
541	drive-strength = <2>;
542	bias-disable;
543};
544
545&qup_uart1_rx {
546	/*
547	 * Configure a pull-up on RX. This is needed to avoid
548	 * garbage data when the TX pin of the Bluetooth module is
549	 * in tri-state (module powered off or not driving the
550	 * signal yet).
551	 */
552	bias-pull-up;
553};
554
555&qup_uart1_tx {
556	/* We'll drive TX, so no pull */
557	drive-strength = <2>;
558	bias-disable;
559};
560
561&qupv3_id_0 {
562	status = "okay";
563};
564
565&qupv3_id_1 {
566	status = "okay";
567};
568
569&sdc2_off_state {
570	sd-cd-pins {
571		pins = "gpio94";
572		function = "gpio";
573		drive-strength = <2>;
574		bias-disable;
575	};
576};
577
578&sdc2_on_state {
579	sd-cd-pins {
580		pins = "gpio94";
581		function = "gpio";
582		drive-strength = <2>;
583		bias-pull-up;
584	};
585};
586
587&sdhc_2 {
588	vmmc-supply = <&vreg_l9e>;
589	vqmmc-supply = <&vreg_l6e>;
590
591	cd-gpios = <&tlmm 94 GPIO_ACTIVE_LOW>;
592
593	status = "okay";
594};
595
596&tlmm {
597	gpio-reserved-ranges = <13 4>, <56 2>;
598
599	qup_uart1_sleep_cts: qup-uart1-sleep-cts-state {
600		pins = "gpio61";
601		function = "gpio";
602		/*
603		 * Configure a bias-bus-hold on CTS to lower power
604		 * usage when Bluetooth is turned off. Bus hold will
605		 * maintain a low power state regardless of whether
606		 * the Bluetooth module drives the pin in either
607		 * direction or leaves the pin fully unpowered.
608		 */
609		bias-bus-hold;
610	};
611
612	qup_uart1_sleep_rts: qup-uart1-sleep-rts-state {
613		pins = "gpio62";
614		function = "gpio";
615		/*
616		 * Configure pull-down on RTS. As RTS is active low
617		 * signal, pull it low to indicate the BT SoC that it
618		 * can wakeup the system anytime from suspend state by
619		 * pulling RX low (by sending wakeup bytes).
620		 */
621		bias-pull-down;
622	};
623
624	qup_uart1_sleep_rx: qup-uart1-sleep-rx-state {
625		pins = "gpio64";
626		function = "gpio";
627		/*
628		 * Configure a pull-up on RX. This is needed to avoid
629		 * garbage data when the TX pin of the Bluetooth module
630		 * is floating which may cause spurious wakeups.
631		 */
632		bias-pull-up;
633	};
634
635	qup_uart1_sleep_tx: qup-uart1-sleep-tx-state {
636		pins = "gpio63";
637		function = "gpio";
638		/*
639		 * Configure pull-up on TX when it isn't actively driven
640		 * to prevent BT SoC from receiving garbage during sleep.
641		 */
642		bias-pull-up;
643	};
644};
645
646&uart1 {
647	/delete-property/ interrupts;
648	interrupts-extended = <&intc GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>,
649			      <&tlmm 64 IRQ_TYPE_EDGE_FALLING>;
650
651	pinctrl-names = "default", "sleep";
652	pinctrl-1 = <&qup_uart1_sleep_cts>, <&qup_uart1_sleep_rts>, <&qup_uart1_sleep_tx>, <&qup_uart1_sleep_rx>;
653
654	status = "okay";
655
656	bluetooth {
657		compatible = "qcom,wcn3988-bt";
658
659		vddio-supply = <&vreg_l11a>;
660		vddxo-supply = <&vreg_l7a>;
661		vddrf-supply = <&vreg_l2e>;
662		vddch0-supply = <&vreg_l10e>;
663		swctrl-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>;
664
665		max-speed = <3200000>;
666	};
667};
668
669&uart9 {
670	status = "okay";
671};
672
673&ufs_mem_hc {
674	reset-gpios = <&tlmm 156 GPIO_ACTIVE_LOW>;
675
676	vcc-supply = <&vreg_l7e>;
677	vcc-max-microamp = <800000>;
678	vccq2-supply = <&vreg_l12a>;
679	vccq2-max-microamp = <800000>;
680
681	status = "okay";
682};
683
684&ufs_mem_phy {
685	vdda-phy-supply = <&vreg_l18a>;
686	vdda-pll-supply = <&vreg_l22a>;
687
688	status = "okay";
689};
690
691&usb_1 {
692	status = "okay";
693};
694
695&usb_1_dwc3 {
696	maximum-speed = "super-speed";
697	dr_mode = "peripheral";
698};
699
700&usb_1_hsphy {
701	vdd-supply = <&vreg_l18a>;
702	vdda-pll-supply = <&vreg_l2a>;
703	vdda-phy-dpdm-supply = <&vreg_l3a>;
704
705	status = "okay";
706};
707
708&usb_1_qmpphy {
709	vdda-phy-supply = <&vreg_l22a>;
710	vdda-pll-supply = <&vreg_l16a>;
711
712	status = "okay";
713};
714
715&wifi {
716	vdd-0.8-cx-mx-supply = <&vreg_l4a>;
717	vdd-1.8-xo-supply = <&vreg_l7a>;
718	vdd-1.3-rfa-supply = <&vreg_l2e>;
719	vdd-3.3-ch0-supply = <&vreg_l10e>;
720	vdd-3.3-ch1-supply = <&vreg_l11e>;
721
722	status = "okay";
723};
724