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