1// SPDX-License-Identifier: GPL-2.0
2#include "qcom-msm8974pro.dtsi"
3#include "qcom-pma8084.dtsi"
4#include <dt-bindings/input/input.h>
5#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
6#include <dt-bindings/leds/common.h>
7
8/ {
9	model = "Samsung Galaxy S5";
10	compatible = "samsung,klte", "qcom,msm8974pro", "qcom,msm8974";
11	chassis-type = "handset";
12
13	aliases {
14		serial0 = &blsp1_uart1;
15		mmc0 = &sdhc_1; /* SDC1 eMMC slot */
16		mmc1 = &sdhc_3; /* SDC2 SD card slot */
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	gpio-keys {
24		compatible = "gpio-keys";
25
26		pinctrl-names = "default";
27		pinctrl-0 = <&gpio_keys_pin_a>;
28
29		key-volume-down {
30			label = "volume_down";
31			gpios = <&pma8084_gpios 2 GPIO_ACTIVE_LOW>;
32			linux,input-type = <1>;
33			linux,code = <KEY_VOLUMEDOWN>;
34			debounce-interval = <15>;
35		};
36
37		key-home {
38			label = "home_key";
39			gpios = <&pma8084_gpios 3 GPIO_ACTIVE_LOW>;
40			linux,input-type = <1>;
41			linux,code = <KEY_HOMEPAGE>;
42			wakeup-source;
43			debounce-interval = <15>;
44		};
45
46		key-volume-up {
47			label = "volume_up";
48			gpios = <&pma8084_gpios 5 GPIO_ACTIVE_LOW>;
49			linux,input-type = <1>;
50			linux,code = <KEY_VOLUMEUP>;
51			debounce-interval = <15>;
52		};
53	};
54
55	i2c-gpio-touchkey {
56		compatible = "i2c-gpio";
57		#address-cells = <1>;
58		#size-cells = <0>;
59		sda-gpios = <&tlmm 95 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
60		scl-gpios = <&tlmm 96 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
61		pinctrl-names = "default";
62		pinctrl-0 = <&i2c_touchkey_pins>;
63
64		touchkey@20 {
65			compatible = "cypress,tm2-touchkey";
66			reg = <0x20>;
67
68			interrupt-parent = <&pma8084_gpios>;
69			interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
70			pinctrl-names = "default";
71			pinctrl-0 = <&touchkey_pin>;
72
73			vcc-supply = <&max77826_ldo15>;
74			vdd-supply = <&pma8084_l19>;
75
76			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
77		};
78	};
79
80	i2c-gpio-led {
81		compatible = "i2c-gpio";
82		#address-cells = <1>;
83		#size-cells = <0>;
84		scl-gpios = <&tlmm 121 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
85		sda-gpios = <&tlmm 120 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
86		pinctrl-names = "default";
87		pinctrl-0 = <&i2c_led_gpioex_pins>;
88
89		i2c-gpio,delay-us = <2>;
90
91		gpio_expander: gpio@20 {
92			compatible = "nxp,pcal6416";
93			reg = <0x20>;
94
95			gpio-controller;
96			#gpio-cells = <2>;
97
98			vcc-supply = <&pma8084_s4>;
99
100			pinctrl-names = "default";
101			pinctrl-0 = <&gpioex_pin>;
102
103			reset-gpios = <&tlmm 145 GPIO_ACTIVE_LOW>;
104		};
105
106		led-controller@30 {
107			compatible = "panasonic,an30259a";
108			reg = <0x30>;
109
110			#address-cells = <1>;
111			#size-cells = <0>;
112
113			led@1 {
114				reg = <1>;
115				function = LED_FUNCTION_STATUS;
116				color = <LED_COLOR_ID_RED>;
117			};
118
119			led@2 {
120				reg = <2>;
121				function = LED_FUNCTION_STATUS;
122				color = <LED_COLOR_ID_GREEN>;
123			};
124
125			led@3 {
126				reg = <3>;
127				function = LED_FUNCTION_STATUS;
128				color = <LED_COLOR_ID_BLUE>;
129			};
130		};
131	};
132
133	vreg_wlan: wlan-regulator {
134		compatible = "regulator-fixed";
135
136		regulator-name = "wl-reg";
137		regulator-min-microvolt = <3300000>;
138		regulator-max-microvolt = <3300000>;
139
140		gpio = <&gpio_expander 8 GPIO_ACTIVE_HIGH>;
141		enable-active-high;
142	};
143
144	vreg_panel: panel-regulator {
145		compatible = "regulator-fixed";
146
147		pinctrl-names = "default";
148		pinctrl-0 = <&panel_en_pin>;
149
150		regulator-name = "panel-vddr-reg";
151		regulator-min-microvolt = <1500000>;
152		regulator-max-microvolt = <1500000>;
153
154		gpio = <&pma8084_gpios 14 GPIO_ACTIVE_HIGH>;
155		enable-active-high;
156	};
157
158	/delete-node/ vreg-boost;
159};
160
161&blsp1_i2c2 {
162	status = "okay";
163
164	touchscreen@20 {
165		compatible = "syna,rmi4-i2c";
166		reg = <0x20>;
167
168		interrupt-parent = <&pma8084_gpios>;
169		interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
170
171		vdd-supply = <&max77826_ldo13>;
172		vio-supply = <&pma8084_lvs2>;
173
174		pinctrl-names = "default";
175		pinctrl-0 = <&touch_pin>;
176
177		syna,startup-delay-ms = <100>;
178
179		#address-cells = <1>;
180		#size-cells = <0>;
181
182		rmi4-f01@1 {
183			reg = <0x1>;
184			syna,nosleep-mode = <1>;
185		};
186
187		rmi4-f12@12 {
188			reg = <0x12>;
189			syna,sensor-type = <1>;
190		};
191	};
192};
193
194&blsp1_i2c6 {
195	status = "okay";
196
197	pmic@60 {
198		reg = <0x60>;
199		compatible = "maxim,max77826";
200
201		regulators {
202			max77826_ldo1: LDO1 {
203				regulator-min-microvolt = <1200000>;
204				regulator-max-microvolt = <1200000>;
205			};
206
207			max77826_ldo2: LDO2 {
208				regulator-min-microvolt = <1000000>;
209				regulator-max-microvolt = <1000000>;
210			};
211
212			max77826_ldo3: LDO3 {
213				regulator-min-microvolt = <1200000>;
214				regulator-max-microvolt = <1200000>;
215			};
216
217			max77826_ldo4: LDO4 {
218				regulator-min-microvolt = <1800000>;
219				regulator-max-microvolt = <1800000>;
220			};
221
222			max77826_ldo5: LDO5 {
223				regulator-min-microvolt = <1800000>;
224				regulator-max-microvolt = <1800000>;
225			};
226
227			max77826_ldo6: LDO6 {
228				regulator-min-microvolt = <1800000>;
229				regulator-max-microvolt = <3300000>;
230			};
231
232			max77826_ldo7: LDO7 {
233				regulator-min-microvolt = <1800000>;
234				regulator-max-microvolt = <1800000>;
235			};
236
237			max77826_ldo8: LDO8 {
238				regulator-min-microvolt = <1800000>;
239				regulator-max-microvolt = <3300000>;
240			};
241
242			max77826_ldo9: LDO9 {
243				regulator-min-microvolt = <1800000>;
244				regulator-max-microvolt = <1800000>;
245			};
246
247			max77826_ldo10: LDO10 {
248				regulator-min-microvolt = <2800000>;
249				regulator-max-microvolt = <2950000>;
250			};
251
252			max77826_ldo11: LDO11 {
253				regulator-min-microvolt = <2700000>;
254				regulator-max-microvolt = <2950000>;
255			};
256
257			max77826_ldo12: LDO12 {
258				regulator-min-microvolt = <2500000>;
259				regulator-max-microvolt = <3300000>;
260			};
261
262			max77826_ldo13: LDO13 {
263				regulator-min-microvolt = <3300000>;
264				regulator-max-microvolt = <3300000>;
265			};
266
267			max77826_ldo14: LDO14 {
268				regulator-min-microvolt = <3300000>;
269				regulator-max-microvolt = <3300000>;
270			};
271
272			max77826_ldo15: LDO15 {
273				regulator-min-microvolt = <1800000>;
274				regulator-max-microvolt = <1800000>;
275			};
276
277			max77826_buck: BUCK {
278				regulator-min-microvolt = <1225000>;
279				regulator-max-microvolt = <1225000>;
280			};
281
282			max77826_buckboost: BUCKBOOST {
283				regulator-min-microvolt = <3400000>;
284				regulator-max-microvolt = <3400000>;
285			};
286		};
287	};
288};
289
290&blsp1_uart2 {
291	status = "okay";
292};
293
294&blsp2_i2c6 {
295	status = "okay";
296
297	fuelgauge@36 {
298		compatible = "maxim,max17048";
299		reg = <0x36>;
300
301		maxim,double-soc;
302		maxim,rcomp = /bits/ 8 <0x56>;
303
304		interrupt-parent = <&pma8084_gpios>;
305		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
306
307		pinctrl-names = "default";
308		pinctrl-0 = <&fuelgauge_pin>;
309	};
310};
311
312&blsp2_uart2 {
313	status = "okay";
314
315	pinctrl-names = "default", "sleep";
316	pinctrl-0 = <&blsp2_uart2_pins_active>;
317	pinctrl-1 = <&blsp2_uart2_pins_sleep>;
318
319	bluetooth {
320		compatible = "brcm,bcm43540-bt";
321		max-speed = <3000000>;
322		pinctrl-names = "default";
323		pinctrl-0 = <&bt_pins>;
324		device-wakeup-gpios = <&tlmm 91 GPIO_ACTIVE_HIGH>;
325		shutdown-gpios = <&gpio_expander 9 GPIO_ACTIVE_HIGH>;
326		interrupt-parent = <&tlmm>;
327		interrupts = <75 IRQ_TYPE_LEVEL_HIGH>;
328		interrupt-names = "host-wakeup";
329	};
330};
331
332&gpu {
333	status = "okay";
334};
335
336&mdss {
337	status = "okay";
338};
339
340&mdss_dsi0 {
341	status = "okay";
342
343	vdda-supply = <&pma8084_l2>;
344	vdd-supply = <&pma8084_l22>;
345	vddio-supply = <&pma8084_l12>;
346
347	panel: panel@0 {
348		reg = <0>;
349		compatible = "samsung,s6e3fa2";
350
351		pinctrl-names = "default";
352		pinctrl-0 = <&panel_te_pin &panel_rst_pin>;
353
354		iovdd-supply = <&pma8084_lvs4>;
355		vddr-supply = <&vreg_panel>;
356
357		reset-gpios = <&pma8084_gpios 17 GPIO_ACTIVE_LOW>;
358		te-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
359
360		port {
361			panel_in: endpoint {
362				remote-endpoint = <&mdss_dsi0_out>;
363			};
364		};
365	};
366};
367
368&mdss_dsi0_out {
369	remote-endpoint = <&panel_in>;
370	data-lanes = <0 1 2 3>;
371};
372
373&mdss_dsi0_phy {
374	status = "okay";
375
376	vddio-supply = <&pma8084_l12>;
377};
378
379&pma8084_gpios {
380	gpio_keys_pin_a: gpio-keys-active-state {
381		pins = "gpio2", "gpio3", "gpio5";
382		function = "normal";
383
384		bias-pull-up;
385		power-source = <PMA8084_GPIO_S4>;
386	};
387
388	touchkey_pin: touchkey-int-state {
389		pins = "gpio6";
390		function = "normal";
391		bias-disable;
392		input-enable;
393		power-source = <PMA8084_GPIO_S4>;
394	};
395
396	touch_pin: touchscreen-int-state {
397		pins = "gpio8";
398		function = "normal";
399		bias-disable;
400		input-enable;
401		power-source = <PMA8084_GPIO_S4>;
402	};
403
404	panel_en_pin: panel-en-state {
405		pins = "gpio14";
406		function = "normal";
407		bias-pull-up;
408		power-source = <PMA8084_GPIO_S4>;
409		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
410	};
411
412	wlan_sleep_clk_pin: wlan-sleep-clk-state {
413		pins = "gpio16";
414		function = "func2";
415
416		output-high;
417		power-source = <PMA8084_GPIO_S4>;
418		qcom,drive-strength = <PMIC_GPIO_STRENGTH_HIGH>;
419	};
420
421	panel_rst_pin: panel-rst-state {
422		pins = "gpio17";
423		function = "normal";
424		bias-disable;
425		power-source = <PMA8084_GPIO_S4>;
426		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
427	};
428
429	fuelgauge_pin: fuelgauge-int-state {
430		pins = "gpio21";
431		function = "normal";
432		bias-disable;
433		input-enable;
434		power-source = <PMA8084_GPIO_S4>;
435	};
436};
437
438&remoteproc_adsp {
439	status = "okay";
440	cx-supply = <&pma8084_s2>;
441};
442
443&remoteproc_mss {
444	status = "okay";
445	cx-supply = <&pma8084_s2>;
446	mss-supply = <&pma8084_s6>;
447	mx-supply = <&pma8084_s1>;
448	pll-supply = <&pma8084_l12>;
449};
450
451&rpm_requests {
452	regulators-0 {
453		compatible = "qcom,rpm-pma8084-regulators";
454
455		pma8084_s1: s1 {
456			regulator-min-microvolt = <675000>;
457			regulator-max-microvolt = <1050000>;
458			regulator-always-on;
459		};
460
461		pma8084_s2: s2 {
462			regulator-min-microvolt = <500000>;
463			regulator-max-microvolt = <1050000>;
464		};
465
466		pma8084_s3: s3 {
467			regulator-min-microvolt = <1300000>;
468			regulator-max-microvolt = <1300000>;
469		};
470
471		pma8084_s4: s4 {
472			regulator-min-microvolt = <1800000>;
473			regulator-max-microvolt = <1800000>;
474		};
475
476		pma8084_s5: s5 {
477			regulator-min-microvolt = <2150000>;
478			regulator-max-microvolt = <2150000>;
479		};
480
481		pma8084_s6: s6 {
482			regulator-min-microvolt = <1050000>;
483			regulator-max-microvolt = <1050000>;
484		};
485
486		pma8084_l1: l1 {
487			regulator-min-microvolt = <1225000>;
488			regulator-max-microvolt = <1225000>;
489		};
490
491		pma8084_l2: l2 {
492			regulator-min-microvolt = <1200000>;
493			regulator-max-microvolt = <1200000>;
494		};
495
496		pma8084_l3: l3 {
497			regulator-min-microvolt = <1050000>;
498			regulator-max-microvolt = <1200000>;
499		};
500
501		pma8084_l4: l4 {
502			regulator-min-microvolt = <1200000>;
503			regulator-max-microvolt = <1225000>;
504		};
505
506		pma8084_l5: l5 {
507			regulator-min-microvolt = <1800000>;
508			regulator-max-microvolt = <1800000>;
509		};
510
511		pma8084_l6: l6 {
512			regulator-min-microvolt = <1800000>;
513			regulator-max-microvolt = <1800000>;
514		};
515
516		pma8084_l7: l7 {
517			regulator-min-microvolt = <1800000>;
518			regulator-max-microvolt = <1800000>;
519		};
520
521		pma8084_l8: l8 {
522			regulator-min-microvolt = <1800000>;
523			regulator-max-microvolt = <1800000>;
524		};
525
526		pma8084_l9: l9 {
527			regulator-min-microvolt = <1800000>;
528			regulator-max-microvolt = <2950000>;
529		};
530
531		pma8084_l10: l10 {
532			regulator-min-microvolt = <1800000>;
533			regulator-max-microvolt = <2950000>;
534		};
535
536		pma8084_l11: l11 {
537			regulator-min-microvolt = <1300000>;
538			regulator-max-microvolt = <1300000>;
539		};
540
541		pma8084_l12: l12 {
542			regulator-min-microvolt = <1800000>;
543			regulator-max-microvolt = <1800000>;
544			regulator-always-on;
545		};
546
547		pma8084_l13: l13 {
548			regulator-min-microvolt = <1800000>;
549			regulator-max-microvolt = <2950000>;
550		};
551
552		pma8084_l14: l14 {
553			regulator-min-microvolt = <1800000>;
554			regulator-max-microvolt = <1800000>;
555		};
556
557		pma8084_l15: l15 {
558			regulator-min-microvolt = <2050000>;
559			regulator-max-microvolt = <2050000>;
560		};
561
562		pma8084_l16: l16 {
563			regulator-min-microvolt = <2700000>;
564			regulator-max-microvolt = <2700000>;
565		};
566
567		pma8084_l17: l17 {
568			regulator-min-microvolt = <2850000>;
569			regulator-max-microvolt = <2850000>;
570		};
571
572		pma8084_l18: l18 {
573			regulator-min-microvolt = <2850000>;
574			regulator-max-microvolt = <2850000>;
575		};
576
577		pma8084_l19: l19 {
578			regulator-min-microvolt = <3300000>;
579			regulator-max-microvolt = <3300000>;
580		};
581
582		pma8084_l20: l20 {
583			regulator-min-microvolt = <2950000>;
584			regulator-max-microvolt = <2950000>;
585			regulator-system-load = <200000>;
586			regulator-allow-set-load;
587		};
588
589		pma8084_l21: l21 {
590			regulator-min-microvolt = <2950000>;
591			regulator-max-microvolt = <2950000>;
592			regulator-system-load = <200000>;
593			regulator-allow-set-load;
594		};
595
596		pma8084_l22: l22 {
597			regulator-min-microvolt = <3000000>;
598			regulator-max-microvolt = <3300000>;
599		};
600
601		pma8084_l23: l23 {
602			regulator-min-microvolt = <3000000>;
603			regulator-max-microvolt = <3000000>;
604		};
605
606		pma8084_l24: l24 {
607			regulator-min-microvolt = <3075000>;
608			regulator-max-microvolt = <3075000>;
609		};
610
611		pma8084_l25: l25 {
612			regulator-min-microvolt = <2100000>;
613			regulator-max-microvolt = <2100000>;
614		};
615
616		pma8084_l26: l26 {
617			regulator-min-microvolt = <1800000>;
618			regulator-max-microvolt = <2050000>;
619		};
620
621		pma8084_l27: l27 {
622			regulator-min-microvolt = <1000000>;
623			regulator-max-microvolt = <1225000>;
624		};
625
626		pma8084_lvs1: lvs1 {};
627		pma8084_lvs2: lvs2 {};
628		pma8084_lvs3: lvs3 {};
629		pma8084_lvs4: lvs4 {};
630
631		pma8084_5vs1: 5vs1 {};
632	};
633};
634
635&sdhc_1 {
636	status = "okay";
637
638	vmmc-supply = <&pma8084_l20>;
639	vqmmc-supply = <&pma8084_s4>;
640
641	pinctrl-names = "default", "sleep";
642	pinctrl-0 = <&sdc1_on>;
643	pinctrl-1 = <&sdc1_off>;
644};
645
646&sdhc_2 {
647	status = "okay";
648	max-frequency = <100000000>;
649	vmmc-supply = <&vreg_wlan>;
650	vqmmc-supply = <&pma8084_s4>;
651	non-removable;
652
653	pinctrl-names = "default", "sleep";
654	pinctrl-0 = <&sdc2_on>;
655	pinctrl-1 = <&sdc2_off>;
656
657	wifi@1 {
658		reg = <1>;
659		compatible = "brcm,bcm4329-fmac";
660
661		interrupt-parent = <&tlmm>;
662		interrupts = <92 IRQ_TYPE_LEVEL_HIGH>;
663		interrupt-names = "host-wake";
664
665		pinctrl-names = "default";
666		pinctrl-0 = <&wlan_sleep_clk_pin &wifi_pin>;
667	};
668};
669
670&sdhc_3 {
671	status = "okay";
672	max-frequency = <100000000>;
673	vmmc-supply = <&pma8084_l21>;
674	vqmmc-supply = <&pma8084_l13>;
675
676	/*
677	 * cd-gpio is intentionally disabled. If enabled, an SD card
678	 * present during boot is not initialized correctly. Without
679	 * cd-gpios the driver resorts to polling, so hotplug works.
680	 */
681	pinctrl-names = "default";
682	pinctrl-0 = <&sdc3_on /* &sdhc3_cd_pin */>;
683	/* cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; */
684};
685
686&tlmm {
687	/* This seems suspicious, but somebody with this device should look into it. */
688	blsp2_uart2_pins_active: blsp2-uart2-pins-active-state {
689		pins = "gpio45", "gpio46", "gpio47", "gpio48";
690		function = "blsp_uart8";
691		drive-strength = <8>;
692		bias-disable;
693	};
694
695	blsp2_uart2_pins_sleep: blsp2-uart2-pins-sleep-state {
696		pins = "gpio45", "gpio46", "gpio47", "gpio48";
697		function = "gpio";
698		drive-strength = <2>;
699		bias-pull-down;
700	};
701
702	bt_pins: bt-pins-state {
703		hostwake-pins {
704			pins = "gpio75";
705			function = "gpio";
706			drive-strength = <16>;
707		};
708
709		devwake-pins {
710			pins = "gpio91";
711			function = "gpio";
712			drive-strength = <2>;
713		};
714	};
715
716	sdc1_on: sdhc1-on-state {
717		clk-pins {
718			pins = "sdc1_clk";
719			drive-strength = <4>;
720			bias-disable;
721		};
722
723		cmd-data-pins {
724			pins = "sdc1_cmd", "sdc1_data";
725			drive-strength = <4>;
726			bias-pull-up;
727		};
728	};
729
730	sdc3_on: sdc3-on-state {
731		pins = "gpio35", "gpio36", "gpio37", "gpio38", "gpio39", "gpio40";
732		function = "sdc3";
733		drive-strength = <8>;
734		bias-disable;
735	};
736
737	sdhc3_cd_pin: sdc3-cd-on-state {
738		pins = "gpio62";
739		function = "gpio";
740
741		drive-strength = <2>;
742		bias-disable;
743	};
744
745	sdc2_on: sdhc2-on-state {
746		clk-pins {
747			pins = "sdc2_clk";
748			drive-strength = <6>;
749			bias-disable;
750		};
751
752		cmd-data-pins {
753			pins = "sdc2_cmd", "sdc2_data";
754			drive-strength = <6>;
755			bias-pull-up;
756		};
757	};
758
759	i2c_touchkey_pins: i2c-touchkey-state {
760		pins = "gpio95", "gpio96";
761		function = "gpio";
762		bias-pull-up;
763	};
764
765	i2c_led_gpioex_pins: i2c-led-gpioex-state {
766		pins = "gpio120", "gpio121";
767		function = "gpio";
768		bias-pull-down;
769	};
770
771	gpioex_pin: gpioex-state {
772		pins = "gpio145";
773		function = "gpio";
774		bias-pull-up;
775		drive-strength = <2>;
776	};
777
778	wifi_pin: wifi-state {
779		pins = "gpio92";
780		function = "gpio";
781		bias-pull-down;
782	};
783
784	panel_te_pin: panel-state {
785		pins = "gpio12";
786		function = "mdp_vsync";
787		drive-strength = <2>;
788		bias-disable;
789	};
790};
791
792&usb {
793	status = "okay";
794
795	phys = <&usb_hs1_phy>;
796	phy-select = <&tcsr 0xb000 0>;
797
798	hnp-disable;
799	srp-disable;
800	adp-disable;
801};
802
803&usb_hs1_phy {
804	status = "okay";
805
806	v1p8-supply = <&pma8084_l6>;
807	v3p3-supply = <&pma8084_l24>;
808
809	qcom,init-seq = /bits/ 8 <0x1 0x64>;
810};
811