1// SPDX-License-Identifier: GPL-2.0
2#include "qcom-msm8974pro.dtsi"
3#include "pm8841.dtsi"
4#include "pm8941.dtsi"
5#include <dt-bindings/input/input.h>
6#include <dt-bindings/leds/common.h>
7#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
8
9/ {
10	model = "Sony Xperia Z2 Tablet";
11	compatible = "sony,xperia-castor", "qcom,msm8974pro", "qcom,msm8974";
12	chassis-type = "tablet";
13
14	aliases {
15		serial0 = &blsp1_uart2;
16		serial1 = &blsp2_uart1;
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 = <&pm8941_gpios 2 GPIO_ACTIVE_LOW>;
32			linux,input-type = <1>;
33			linux,code = <KEY_VOLUMEDOWN>;
34		};
35
36		key-camera-snapshot {
37			label = "camera_snapshot";
38			gpios = <&pm8941_gpios 3 GPIO_ACTIVE_LOW>;
39			linux,input-type = <1>;
40			linux,code = <KEY_CAMERA>;
41		};
42
43		key-camera-focus {
44			label = "camera_focus";
45			gpios = <&pm8941_gpios 4 GPIO_ACTIVE_LOW>;
46			linux,input-type = <1>;
47			linux,code = <KEY_CAMERA_FOCUS>;
48		};
49
50		key-volume-up {
51			label = "volume_up";
52			gpios = <&pm8941_gpios 5 GPIO_ACTIVE_LOW>;
53			linux,input-type = <1>;
54			linux,code = <KEY_VOLUMEUP>;
55		};
56	};
57
58	vreg_bl_vddio: lcd-backlight-vddio {
59		compatible = "regulator-fixed";
60		regulator-name = "vreg_bl_vddio";
61		regulator-min-microvolt = <3150000>;
62		regulator-max-microvolt = <3150000>;
63
64		gpio = <&tlmm 69 0>;
65		enable-active-high;
66
67		vin-supply = <&pm8941_s3>;
68		startup-delay-us = <70000>;
69
70		pinctrl-names = "default";
71		pinctrl-0 = <&lcd_backlight_en_pin_a>;
72	};
73
74	vreg_vsp: lcd-dcdc-regulator {
75		compatible = "regulator-fixed";
76		regulator-name = "vreg_vsp";
77		regulator-min-microvolt = <5600000>;
78		regulator-max-microvolt = <5600000>;
79
80		gpio = <&pm8941_gpios 20 GPIO_ACTIVE_HIGH>;
81		enable-active-high;
82
83		pinctrl-names = "default";
84		pinctrl-0 = <&lcd_dcdc_en_pin_a>;
85	};
86
87	vreg_wlan: wlan-regulator {
88		compatible = "regulator-fixed";
89
90		regulator-name = "wl-reg";
91		regulator-min-microvolt = <3300000>;
92		regulator-max-microvolt = <3300000>;
93
94		gpio = <&pm8941_gpios 18 GPIO_ACTIVE_HIGH>;
95		enable-active-high;
96
97		pinctrl-names = "default";
98		pinctrl-0 = <&wlan_regulator_pin>;
99	};
100};
101
102&blsp1_uart2 {
103	status = "okay";
104};
105
106&blsp2_i2c2 {
107	status = "okay";
108	clock-frequency = <355000>;
109
110	synaptics@2c {
111		compatible = "syna,rmi4-i2c";
112		reg = <0x2c>;
113
114		interrupt-parent = <&tlmm>;
115		interrupts = <86 IRQ_TYPE_EDGE_FALLING>;
116
117		#address-cells = <1>;
118		#size-cells = <0>;
119
120		vdd-supply = <&pm8941_l22>;
121		vio-supply = <&pm8941_lvs3>;
122
123		pinctrl-names = "default";
124		pinctrl-0 = <&ts_int_pin>;
125
126		syna,startup-delay-ms = <100>;
127
128		rmi4-f01@1 {
129			reg = <0x1>;
130			syna,nosleep-mode = <1>;
131		};
132
133		rmi4-f11@11 {
134			reg = <0x11>;
135			syna,sensor-type = <1>;
136			touchscreen-inverted-x;
137		};
138	};
139};
140
141&blsp2_i2c5 {
142	status = "okay";
143	clock-frequency = <355000>;
144
145	lp8566_wled: backlight@2c {
146		compatible = "ti,lp8556";
147		reg = <0x2c>;
148		power-supply = <&vreg_bl_vddio>;
149
150		bl-name = "backlight";
151		dev-ctrl = /bits/ 8 <0x05>;
152		init-brt = /bits/ 8 <0x3f>;
153
154		rom-a0h {
155			rom-addr = /bits/ 8 <0xa0>;
156			rom-val = /bits/ 8 <0xff>;
157		};
158		rom-a1h {
159			rom-addr = /bits/ 8 <0xa1>;
160			rom-val = /bits/ 8 <0x3f>;
161		};
162		rom-a2h {
163			rom-addr = /bits/ 8 <0xa2>;
164			rom-val = /bits/ 8 <0x20>;
165		};
166		rom-a3h {
167			rom-addr = /bits/ 8 <0xa3>;
168			rom-val = /bits/ 8 <0x5e>;
169		};
170		rom-a4h {
171			rom-addr = /bits/ 8 <0xa4>;
172			rom-val = /bits/ 8 <0x02>;
173		};
174		rom-a5h {
175			rom-addr = /bits/ 8 <0xa5>;
176			rom-val = /bits/ 8 <0x04>;
177		};
178		rom-a6h {
179			rom-addr = /bits/ 8 <0xa6>;
180			rom-val = /bits/ 8 <0x80>;
181		};
182		rom-a7h {
183			rom-addr = /bits/ 8 <0xa7>;
184			rom-val = /bits/ 8 <0xf7>;
185		};
186		rom-a9h {
187			rom-addr = /bits/ 8 <0xa9>;
188			rom-val = /bits/ 8 <0x80>;
189		};
190		rom-aah {
191			rom-addr = /bits/ 8 <0xaa>;
192			rom-val = /bits/ 8 <0x0f>;
193		};
194		rom-aeh {
195			rom-addr = /bits/ 8 <0xae>;
196			rom-val = /bits/ 8 <0x0f>;
197		};
198	};
199};
200
201&blsp2_uart1 {
202	status = "okay";
203
204	bluetooth {
205		compatible = "brcm,bcm43438-bt";
206		max-speed = <3000000>;
207
208		pinctrl-names = "default";
209		pinctrl-0 = <&bt_host_wake_pin>, <&bt_dev_wake_pin>, <&bt_reg_on_pin>;
210
211		host-wakeup-gpios = <&tlmm 95 GPIO_ACTIVE_HIGH>;
212		device-wakeup-gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
213		shutdown-gpios = <&pm8941_gpios 16 GPIO_ACTIVE_HIGH>;
214	};
215};
216
217&pm8941_coincell {
218	status = "okay";
219
220	qcom,rset-ohms = <2100>;
221	qcom,vset-millivolts = <3000>;
222};
223
224&pm8941_gpios {
225	gpio_keys_pin_a: gpio-keys-active-state {
226		pins = "gpio2", "gpio5";
227		function = "normal";
228
229		bias-pull-up;
230		power-source = <PM8941_GPIO_S3>;
231	};
232
233	bt_reg_on_pin: bt-reg-on-state {
234		pins = "gpio16";
235		function = "normal";
236
237		output-low;
238		power-source = <PM8941_GPIO_S3>;
239	};
240
241	wlan_sleep_clk_pin: wl-sleep-clk-state {
242		pins = "gpio17";
243		function = "func2";
244
245		output-high;
246		power-source = <PM8941_GPIO_S3>;
247	};
248
249	wlan_regulator_pin: wl-reg-active-state {
250		pins = "gpio18";
251		function = "normal";
252
253		bias-disable;
254		power-source = <PM8941_GPIO_S3>;
255	};
256
257	lcd_dcdc_en_pin_a: lcd-dcdc-en-active-state {
258		pins = "gpio20";
259		function = "normal";
260
261		bias-disable;
262		power-source = <PM8941_GPIO_S3>;
263		input-disable;
264		output-low;
265	};
266
267};
268
269&pm8941_lpg {
270	status = "okay";
271
272	qcom,power-source = <1>;
273
274	multi-led {
275		color = <LED_COLOR_ID_RGB>;
276		function = LED_FUNCTION_STATUS;
277
278		#address-cells = <1>;
279		#size-cells = <0>;
280
281		led@5 {
282			reg = <5>;
283			color = <LED_COLOR_ID_BLUE>;
284		};
285
286		led@6 {
287			reg = <6>;
288			color = <LED_COLOR_ID_GREEN>;
289		};
290
291		led@7 {
292			reg = <7>;
293			color = <LED_COLOR_ID_RED>;
294		};
295	};
296};
297
298&remoteproc_adsp {
299	cx-supply = <&pm8841_s2>;
300};
301
302&remoteproc_mss {
303	cx-supply = <&pm8841_s2>;
304	mss-supply = <&pm8841_s3>;
305	mx-supply = <&pm8841_s1>;
306	pll-supply = <&pm8941_l12>;
307};
308
309&rpm_requests {
310	regulators-0 {
311		compatible = "qcom,rpm-pm8841-regulators";
312
313		pm8841_s1: s1 {
314			regulator-min-microvolt = <675000>;
315			regulator-max-microvolt = <1050000>;
316		};
317
318		pm8841_s2: s2 {
319			regulator-min-microvolt = <500000>;
320			regulator-max-microvolt = <1050000>;
321		};
322
323		pm8841_s3: s3 {
324			regulator-min-microvolt = <500000>;
325			regulator-max-microvolt = <1050000>;
326		};
327
328		pm8841_s4: s4 {
329			regulator-min-microvolt = <500000>;
330			regulator-max-microvolt = <1050000>;
331		};
332	};
333
334	regulators-1 {
335		compatible = "qcom,rpm-pm8941-regulators";
336
337		vdd_l1_l3-supply = <&pm8941_s1>;
338		vdd_l2_lvs1_2_3-supply = <&pm8941_s3>;
339		vdd_l4_l11-supply = <&pm8941_s1>;
340		vdd_l5_l7-supply = <&pm8941_s2>;
341		vdd_l6_l12_l14_l15-supply = <&pm8941_s2>;
342		vdd_l9_l10_l17_l22-supply = <&vreg_boost>;
343		vdd_l13_l20_l23_l24-supply = <&vreg_boost>;
344		vdd_l21-supply = <&vreg_boost>;
345
346		pm8941_s1: s1 {
347			regulator-min-microvolt = <1300000>;
348			regulator-max-microvolt = <1300000>;
349			regulator-always-on;
350			regulator-boot-on;
351		};
352
353		pm8941_s2: s2 {
354			regulator-min-microvolt = <2150000>;
355			regulator-max-microvolt = <2150000>;
356			regulator-boot-on;
357		};
358
359		pm8941_s3: s3 {
360			regulator-min-microvolt = <1800000>;
361			regulator-max-microvolt = <1800000>;
362			regulator-system-load = <154000>;
363			regulator-always-on;
364			regulator-boot-on;
365		};
366
367		pm8941_s4: s4 {
368			regulator-min-microvolt = <5000000>;
369			regulator-max-microvolt = <5000000>;
370		};
371
372		pm8941_l1: l1 {
373			regulator-min-microvolt = <1225000>;
374			regulator-max-microvolt = <1225000>;
375			regulator-always-on;
376			regulator-boot-on;
377		};
378
379		pm8941_l2: l2 {
380			regulator-min-microvolt = <1200000>;
381			regulator-max-microvolt = <1200000>;
382		};
383
384		pm8941_l3: l3 {
385			regulator-min-microvolt = <1200000>;
386			regulator-max-microvolt = <1200000>;
387		};
388
389		pm8941_l4: l4 {
390			regulator-min-microvolt = <1225000>;
391			regulator-max-microvolt = <1225000>;
392		};
393
394		pm8941_l5: l5 {
395			regulator-min-microvolt = <1800000>;
396			regulator-max-microvolt = <1800000>;
397		};
398
399		pm8941_l6: l6 {
400			regulator-min-microvolt = <1800000>;
401			regulator-max-microvolt = <1800000>;
402			regulator-boot-on;
403		};
404
405		pm8941_l7: l7 {
406			regulator-min-microvolt = <1800000>;
407			regulator-max-microvolt = <1800000>;
408			regulator-boot-on;
409		};
410
411		pm8941_l8: l8 {
412			regulator-min-microvolt = <1800000>;
413			regulator-max-microvolt = <1800000>;
414		};
415
416		pm8941_l9: l9 {
417			regulator-min-microvolt = <1800000>;
418			regulator-max-microvolt = <2950000>;
419		};
420
421		pm8941_l11: l11 {
422			regulator-min-microvolt = <1300000>;
423			regulator-max-microvolt = <1350000>;
424		};
425
426		pm8941_l12: l12 {
427			regulator-min-microvolt = <1800000>;
428			regulator-max-microvolt = <1800000>;
429			regulator-always-on;
430			regulator-boot-on;
431		};
432
433		pm8941_l13: l13 {
434			regulator-min-microvolt = <1800000>;
435			regulator-max-microvolt = <2950000>;
436			regulator-boot-on;
437		};
438
439		pm8941_l14: l14 {
440			regulator-min-microvolt = <1800000>;
441			regulator-max-microvolt = <1800000>;
442		};
443
444		pm8941_l15: l15 {
445			regulator-min-microvolt = <2050000>;
446			regulator-max-microvolt = <2050000>;
447		};
448
449		pm8941_l16: l16 {
450			regulator-min-microvolt = <2700000>;
451			regulator-max-microvolt = <2700000>;
452		};
453
454		pm8941_l17: l17 {
455			regulator-min-microvolt = <2700000>;
456			regulator-max-microvolt = <2700000>;
457		};
458
459		pm8941_l18: l18 {
460			regulator-min-microvolt = <2850000>;
461			regulator-max-microvolt = <2850000>;
462		};
463
464		pm8941_l19: l19 {
465			regulator-min-microvolt = <2850000>;
466			regulator-max-microvolt = <2850000>;
467		};
468
469		pm8941_l20: l20 {
470			regulator-min-microvolt = <2950000>;
471			regulator-max-microvolt = <2950000>;
472			regulator-system-load = <500000>;
473			regulator-allow-set-load;
474			regulator-boot-on;
475		};
476
477		pm8941_l21: l21 {
478			regulator-min-microvolt = <2950000>;
479			regulator-max-microvolt = <2950000>;
480			regulator-boot-on;
481		};
482
483		pm8941_l22: l22 {
484			regulator-min-microvolt = <3000000>;
485			regulator-max-microvolt = <3000000>;
486		};
487
488		pm8941_l23: l23 {
489			regulator-min-microvolt = <2800000>;
490			regulator-max-microvolt = <2800000>;
491		};
492
493		pm8941_l24: l24 {
494			regulator-min-microvolt = <3075000>;
495			regulator-max-microvolt = <3075000>;
496			regulator-boot-on;
497		};
498
499		pm8941_lvs3: lvs3 {};
500	};
501};
502
503&sdhc_1 {
504	status = "okay";
505
506	vmmc-supply = <&pm8941_l20>;
507	vqmmc-supply = <&pm8941_s3>;
508
509	pinctrl-names = "default", "sleep";
510	pinctrl-0 = <&sdc1_on>;
511	pinctrl-1 = <&sdc1_off>;
512};
513
514&sdhc_2 {
515	status = "okay";
516
517	vmmc-supply = <&pm8941_l21>;
518	vqmmc-supply = <&pm8941_l13>;
519
520	cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>;
521
522	pinctrl-names = "default", "sleep";
523	pinctrl-0 = <&sdc2_on>;
524	pinctrl-1 = <&sdc2_off>;
525};
526
527&sdhc_3 {
528	status = "okay";
529
530	max-frequency = <100000000>;
531	vmmc-supply = <&vreg_wlan>;
532	non-removable;
533
534	pinctrl-names = "default";
535	pinctrl-0 = <&sdc3_on>;
536
537	#address-cells = <1>;
538	#size-cells = <0>;
539
540	bcrmf@1 {
541		compatible = "brcm,bcm4339-fmac", "brcm,bcm4329-fmac";
542		reg = <1>;
543
544		brcm,drive-strength = <10>;
545
546		pinctrl-names = "default";
547		pinctrl-0 = <&wlan_sleep_clk_pin>;
548	};
549};
550
551&smbb {
552	qcom,fast-charge-safe-current = <1500000>;
553	qcom,fast-charge-current-limit = <1500000>;
554	qcom,dc-current-limit = <1800000>;
555	usb-charge-current-limit = <1800000>;
556	qcom,fast-charge-safe-voltage = <4400000>;
557	qcom,fast-charge-high-threshold-voltage = <4350000>;
558	qcom,fast-charge-low-threshold-voltage = <3400000>;
559	qcom,auto-recharge-threshold-voltage = <4200000>;
560	qcom,minimum-input-voltage = <4300000>;
561};
562
563&tlmm {
564	lcd_backlight_en_pin_a: lcd-backlight-vddio-state {
565		pins = "gpio69";
566		function = "gpio";
567		drive-strength = <10>;
568		output-low;
569		bias-disable;
570	};
571
572	sdc1_on: sdc1-on-state {
573		clk-pins {
574			pins = "sdc1_clk";
575			drive-strength = <16>;
576			bias-disable;
577		};
578
579		cmd-data-pins {
580			pins = "sdc1_cmd", "sdc1_data";
581			drive-strength = <10>;
582			bias-pull-up;
583		};
584	};
585
586	sdc2_on: sdc2-on-state {
587		clk-pins {
588			pins = "sdc2_clk";
589			drive-strength = <6>;
590			bias-disable;
591		};
592
593		cmd-data-pins {
594			pins = "sdc2_cmd", "sdc2_data";
595			drive-strength = <6>;
596			bias-pull-up;
597		};
598
599		cd-pins {
600			pins = "gpio62";
601			function = "gpio";
602			drive-strength = <2>;
603			bias-disable;
604		};
605	};
606
607	sdc3_on: sdc3-on-state {
608		clk-pins {
609			pins = "gpio40";
610			function = "sdc3";
611			drive-strength = <10>;
612			bias-disable;
613		};
614
615		cmd-pins {
616			pins = "gpio39";
617			function = "sdc3";
618			drive-strength = <10>;
619			bias-pull-up;
620		};
621
622		data-pins {
623			pins = "gpio35", "gpio36", "gpio37", "gpio38";
624			function = "sdc3";
625			drive-strength = <10>;
626			bias-pull-up;
627		};
628	};
629
630	ts_int_pin: ts-int-pin-state {
631		pins = "gpio86";
632		function = "gpio";
633		drive-strength = <2>;
634		bias-disable;
635	};
636
637	bt_host_wake_pin: bt-host-wake-state {
638		pins = "gpio95";
639		function = "gpio";
640		drive-strength = <2>;
641		bias-disable;
642		output-low;
643	};
644
645	bt_dev_wake_pin: bt-dev-wake-state {
646		pins = "gpio96";
647		function = "gpio";
648		drive-strength = <2>;
649		bias-disable;
650	};
651};
652
653&usb {
654	status = "okay";
655
656	phys = <&usb_hs1_phy>;
657	phy-select = <&tcsr 0xb000 0>;
658	extcon = <&smbb>, <&usb_id>;
659	vbus-supply = <&chg_otg>;
660
661	hnp-disable;
662	srp-disable;
663	adp-disable;
664};
665
666&usb_hs1_phy {
667	status = "okay";
668
669	v1p8-supply = <&pm8941_l6>;
670	v3p3-supply = <&pm8941_l24>;
671
672	extcon = <&smbb>;
673	qcom,init-seq = /bits/ 8 <0x1 0x64>;
674};
675