1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Devicetree for the Samsung Galaxy Amp SGH-I407 also known as Kyle.
4 *
5 * The code also refers to "Kyle AT&T" reflecting that this mobile phone
6 * was customized for the AT&T subsidiary Aio Wireless (All In One) and
7 * offered by the company in 2013.
8 */
9
10/dts-v1/;
11#include "ste-db8500.dtsi"
12#include "ste-ab8505.dtsi"
13#include "ste-dbx5x0-pinctrl.dtsi"
14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/leds/common.h>
16#include <dt-bindings/input/input.h>
17#include <dt-bindings/interrupt-controller/irq.h>
18
19/ {
20	model = "Samsung Galaxy Amp (SGH-I407)";
21	compatible = "samsung,kyle", "st-ericsson,u8500";
22
23	chosen {
24		stdout-path = &serial2;
25	};
26
27	/* TI TXS0206 level translator for 2.9 V */
28	sd_level_translator: regulator-gpio {
29		compatible = "regulator-fixed";
30
31		/* GPIO87 EN */
32		gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
33		enable-active-high;
34
35		regulator-name = "sd-level-translator";
36		regulator-min-microvolt = <2900000>;
37		regulator-max-microvolt = <2900000>;
38		regulator-type = "voltage";
39
40		startup-delay-us = <200>;
41
42		pinctrl-names = "default";
43		pinctrl-0 = <&sd_level_translator_default>;
44	};
45
46	/* External LDO MIC5366-3.3YMT for eMMC */
47	ldo_3v3_reg: regulator-gpio-ldo-3v3 {
48		compatible = "regulator-fixed";
49		regulator-name = "en-3v3-fixed-supply";
50		regulator-min-microvolt = <3300000>;
51		regulator-max-microvolt = <3300000>;
52		gpio = <&gpio6 31 GPIO_ACTIVE_HIGH>;
53		startup-delay-us = <5000>;
54		enable-active-high;
55		pinctrl-names = "default";
56		pinctrl-0 = <&emmc_ldo_en_default_mode>;
57	};
58
59	/*
60	 * External Ricoh RP152L010B-TR LCD LDO regulator for the display.
61	 * LCD_PWR_EN controls both a 3.0V and 1.8V output.
62	 */
63	lcd_3v0_reg: regulator-gpio-lcd-3v0 {
64		compatible = "regulator-fixed";
65		/* Supplied in turn by VBAT */
66		regulator-name = "VREG_LCD_3V0";
67		regulator-min-microvolt = <3000000>;
68		regulator-max-microvolt = <3000000>;
69		/* GPIO219 controls this regulator */
70		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
71		enable-active-high;
72		pinctrl-names = "default";
73		pinctrl-0 = <&lcd_pwr_en_default_mode>;
74	};
75	lcd_1v8_reg: regulator-gpio-lcd-1v8 {
76		compatible = "regulator-fixed";
77		/* Supplied in turn by VBAT */
78		regulator-name = "VREG_LCD_1V8";
79		regulator-min-microvolt = <1800000>;
80		regulator-max-microvolt = <1800000>;
81		/* GPIO219 controls this regulator too */
82		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
83		enable-active-high;
84		pinctrl-names = "default";
85		pinctrl-0 = <&lcd_pwr_en_default_mode>;
86	};
87
88	wlan_en: regulator-gpio-wlan-en {
89		compatible = "regulator-fixed";
90		regulator-name = "wl-reg-on";
91		regulator-min-microvolt = <3000000>;
92		regulator-max-microvolt = <3000000>;
93		startup-delay-us = <200000>;
94		/* GPIO215 WLAN_EN */
95		gpio = <&gpio6 23 GPIO_ACTIVE_HIGH>;
96		enable-active-high;
97		pinctrl-names = "default";
98		pinctrl-0 = <&wlan_en_default_mode>;
99	};
100
101	vibrator {
102		compatible = "gpio-vibrator";
103		enable-gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>;
104		pinctrl-names = "default";
105		pinctrl-0 = <&vibrator_default>;
106	};
107
108	gpio-keys {
109		compatible = "gpio-keys";
110		pinctrl-names = "default";
111		pinctrl-0 = <&gpio_keys_default_mode>;
112
113		button-home {
114			linux,code = <KEY_HOME>;
115			label = "HOME";
116			/* GPIO91 */
117			gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
118		};
119		button-volup {
120			linux,code = <KEY_VOLUMEUP>;
121			label = "VOL+";
122			/* GPIO67 */
123			gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
124		};
125		button-voldown {
126			linux,code = <KEY_VOLUMEDOWN>;
127			label = "VOL-";
128			/* GPIO92 */
129			gpios = <&gpio2 28 GPIO_ACTIVE_LOW>;
130		};
131	};
132
133	ktd253: backlight {
134		compatible = "kinetic,ktd253";
135		/* GPIO 69 */
136		enable-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
137		/* Default to 13/32 brightness */
138		default-brightness = <13>;
139		pinctrl-names = "default";
140		pinctrl-0 = <&gpio_backlight_default_mode>;
141	};
142
143	/* Richtek RT8515GQW Flash LED Driver IC */
144	flash {
145		compatible = "richtek,rt8515";
146		/* GPIO 140 */
147		enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
148		/* GPIO 141 */
149		ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
150		/*
151		 * RFS is 16 kOhm and RTS is 100 kOhm giving
152		 * the flash max current 343mA and torch max
153		 * current 55 mA.
154		 */
155		richtek,rfs-ohms = <16000>;
156		richtek,rts-ohms = <100000>;
157		pinctrl-names = "default";
158		pinctrl-0 = <&gpio_flash_default_mode>;
159
160		led {
161			function = LED_FUNCTION_FLASH;
162			color = <LED_COLOR_ID_WHITE>;
163			flash-max-timeout-us = <250000>;
164			flash-max-microamp = <343750>;
165			led-max-microamp = <55000>;
166		};
167	};
168
169	i2c-gpio-0 {
170		compatible = "i2c-gpio";
171		sda-gpios = <&gpio4 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
172		scl-gpios = <&gpio4 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
173		pinctrl-names = "default";
174		pinctrl-0 = <&i2c_gpio_0_default>;
175		#address-cells = <1>;
176		#size-cells = <0>;
177		/* TODO: this should be used by the NCP6914 Camera power management unit */
178	};
179
180	i2c-gpio-1 {
181		compatible = "i2c-gpio";
182		sda-gpios = <&gpio4 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
183		scl-gpios = <&gpio4 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
184		pinctrl-names = "default";
185		pinctrl-0 = <&i2c_gpio_1_default>;
186		#address-cells = <1>;
187		#size-cells = <0>;
188		magnetometer@c {
189			compatible = "alps,hscdtd008a";
190			reg = <0x0c>;
191			avdd-supply = <&ab8500_ldo_aux1_reg>;
192			dvdd-supply = <&ab8500_ldo_aux6_reg>;
193		};
194	};
195
196	soc {
197		// External Micro SD slot
198		mmc@80126000 {
199			arm,primecell-periphid = <0x10480180>;
200			max-frequency = <100000000>;
201			bus-width = <4>;
202			cap-sd-highspeed;
203			cap-mmc-highspeed;
204			st,sig-pin-fbclk;
205			full-pwr-cycle;
206			vmmc-supply = <&ab8500_ldo_aux3_reg>;
207			vqmmc-supply = <&sd_level_translator>;
208			pinctrl-names = "default", "sleep";
209			pinctrl-0 = <&mc0_a_1_default>;
210			pinctrl-1 = <&mc0_a_1_sleep>;
211			cd-gpios  = <&gpio6 25 GPIO_ACTIVE_LOW>; // GPIO217
212			status = "okay";
213		};
214
215		// WLAN SDIO channel
216		mmc@80118000 {
217			arm,primecell-periphid = <0x10480180>;
218			max-frequency = <50000000>;
219			bus-width = <4>;
220			non-removable;
221			cap-sd-highspeed;
222			vmmc-supply = <&wlan_en>;
223			pinctrl-names = "default", "sleep";
224			pinctrl-0 = <&mc1_a_2_default>;
225			pinctrl-1 = <&mc1_a_2_sleep>;
226			status = "okay";
227			#address-cells = <1>;
228			#size-cells = <0>;
229
230			wifi@1 {
231				compatible = "brcm,bcm4334-fmac", "brcm,bcm4329-fmac";
232				reg = <1>;
233				/* GPIO216 WL_HOST_WAKE */
234				interrupt-parent = <&gpio6>;
235				interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
236				interrupt-names = "host-wake";
237				pinctrl-names = "default";
238				pinctrl-0 = <&wlan_default_mode>;
239			};
240		};
241
242		/*
243		 * eMMC seems to be mostly Samsung KLM4G1YE4C "4YMD1R"
244		 */
245		mmc@80005000 {
246			arm,primecell-periphid = <0x10480180>;
247		        max-frequency = <100000000>;
248			bus-width = <8>;
249			non-removable;
250			cap-mmc-highspeed;
251			mmc-ddr-1_8v;
252			no-sdio;
253			no-sd;
254			/* From datasheet page 26 figure 9: 300 ms set-up time for 4GB */
255			post-power-on-delay-ms = <300>;
256			vmmc-supply = <&ldo_3v3_reg>;
257			pinctrl-names = "default", "sleep";
258			pinctrl-0 = <&mc2_a_1_default>;
259			pinctrl-1 = <&mc2_a_1_sleep>;
260
261			status = "okay";
262		};
263
264		/* GBF (Bluetooth) UART */
265		uart@80120000 {
266			pinctrl-names = "default", "sleep";
267			pinctrl-0 = <&u0_a_1_default>;
268			pinctrl-1 = <&u0_a_1_sleep>;
269			status = "okay";
270
271			bluetooth {
272				/* BCM4334B0 actually */
273				compatible = "brcm,bcm4330-bt";
274				shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>;
275				device-wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
276				host-wakeup-gpios = <&gpio3 1 GPIO_ACTIVE_HIGH>;
277				pinctrl-names = "default";
278				pinctrl-0 = <&bluetooth_default_mode>;
279			};
280		};
281
282		/* GPF UART */
283		uart@80121000 {
284			status = "okay";
285			pinctrl-names = "default", "sleep";
286			pinctrl-0 = <&u1rxtx_a_1_default &u1ctsrts_a_1_default>;
287			pinctrl-1 = <&u1rxtx_a_1_sleep &u1ctsrts_a_1_sleep>;
288		};
289
290		/* Debugging console UART connected to AB8505 USB */
291		uart@80007000 {
292			status = "okay";
293			pinctrl-names = "default", "sleep";
294			pinctrl-0 = <&u2rxtx_c_1_default>;
295			pinctrl-1 = <&u2rxtx_c_1_sleep>;
296		};
297
298		prcmu@80157000 {
299			ab8505 {
300				ab8500_usb {
301					pinctrl-names = "default", "sleep";
302					pinctrl-0 = <&usb_a_1_default>;
303					pinctrl-1 = <&usb_a_1_sleep>;
304				};
305
306				ab8505-regulators {
307					ab8500_ldo_aux1 {
308						/* Used for VDD for sensors */
309						regulator-name = "AUX1";
310						regulator-min-microvolt = <3000000>;
311						regulator-max-microvolt = <3300000>;
312					};
313
314					ab8500_ldo_aux2 {
315						/* Supplies the MMS touchscreen only with 3.3V */
316						regulator-name = "AUX2";
317						regulator-min-microvolt = <3300000>;
318						regulator-max-microvolt = <3300000>;
319					};
320
321					ab8500_ldo_aux3 {
322						/* Used for voltage for external MMC/SD card */
323						regulator-name = "AUX3";
324						regulator-min-microvolt = <1100000>;
325						regulator-max-microvolt = <3300000>;
326					};
327
328					ab8500_ldo_aux4 {
329						regulator-name = "AUX4";
330						/* Hammer to 3.3V for the touchscreen */
331						regulator-min-microvolt = <3300000>;
332						regulator-max-microvolt = <3300000>;
333					};
334
335					ab8500_ldo_aux5 {
336						regulator-name = "AUX5";
337						/* 1.8V for the touchscreen */
338						regulator-min-microvolt = <1800000>;
339						regulator-max-microvolt = <1800000>;
340					};
341
342					ab8500_ldo_aux6 {
343						regulator-name = "AUX6";
344						/* Used by sensors for 1.8 V in R0.1+ */
345						regulator-min-microvolt = <1800000>;
346						regulator-max-microvolt = <1800000>;
347					};
348
349					ab8500_ldo_aux8 {
350						/* Unused */
351						regulator-name = "AUX8";
352					};
353				};
354			};
355		};
356
357		/* I2C0 */
358		i2c@80004000 {
359			status = "okay";
360
361			pinctrl-names = "default", "sleep";
362			pinctrl-0 = <&i2c0_a_1_default>;
363			pinctrl-1 = <&i2c0_a_1_sleep>;
364
365			proximity@44 {
366				compatible = "sharp,gp2ap002s00f";
367				clock-frequency = <400000>;
368				reg = <0x44>;
369
370				interrupt-parent = <&gpio4>;
371				interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
372				vdd-supply = <&ab8500_ldo_aux1_reg>;
373				vio-supply = <&ab8500_ldo_aux6_reg>;
374				pinctrl-names = "default";
375				pinctrl-0 = <&gp2ap002_kyle_default>;
376				sharp,proximity-far-hysteresis = /bits/ 8 <0x2f>;
377				sharp,proximity-close-hysteresis = /bits/ 8 <0x0f>;
378			};
379		};
380
381		/* I2C2 */
382		i2c@80128000 {
383			status = "okay";
384
385			pinctrl-names = "default", "sleep";
386			pinctrl-0 = <&i2c2_b_2_default>;
387			pinctrl-1 = <&i2c2_b_2_sleep>;
388
389			accel@18 {
390				compatible = "bosch,bma254";
391				clock-frequency = <400000>;
392				reg = <0x18>;
393
394				mount-matrix = "-1", "0", "0",
395					       "0", "-1", "0",
396					       "0", "0", "-1";
397				vdd-supply = <&ab8500_ldo_aux1_reg>;
398				vddio-supply = <&ab8500_ldo_aux6_reg>;
399			};
400		};
401
402		/* I2C3 */
403		i2c@80110000 {
404			status = "okay";
405
406			pinctrl-names = "default", "sleep";
407			pinctrl-0 = <&i2c3_c_2_default>;
408			pinctrl-1 = <&i2c3_c_2_sleep>;
409
410			/* Melfas MMS134S touchscreen */
411			touchscreen@48 {
412				compatible = "melfas,mms134s";
413				reg = <0x48>;
414				/* GPIO218 for IRQ */
415				interrupt-parent = <&gpio6>;
416				interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
417				/* AVDD is "analog supply", 2.57-3.47 V */
418				avdd-supply = <&ab8500_ldo_aux2_reg>;
419				/* VDD is "digital supply" 1.71-3.47V */
420				vdd-supply = <&ab8500_ldo_aux5_reg>;
421
422				touchscreen-size-x = <480>;
423				touchscreen-size-y = <800>;
424
425				pinctrl-names = "default";
426				pinctrl-0 = <&mms134s_kyle_default>;
427			};
428		};
429
430		mcde@a0350000 {
431			status = "okay";
432			pinctrl-names = "default";
433			pinctrl-0 = <&dsi_default_mode>;
434
435			dsi@a0351000 {
436				panel {
437					/*
438					 * NT35510-based Hydis HVA40WV1
439					 * Apparently some Kyle models can have a NT35512 fitted
440					 * here instead. In that case the boot loader needs to
441					 * modify this compatible.
442					 */
443					compatible = "hydis,hva40wv1", "novatek,nt35510";
444					reg = <0>;
445					/* v_lcd_3v0 2.3-4.8V */
446					vdd-supply = <&lcd_3v0_reg>;
447					/* v_lcd_1v8 1.65-3.3V */
448					vddi-supply = <&lcd_1v8_reg>;
449					/* GPIO 139 */
450					reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
451					pinctrl-names = "default";
452					pinctrl-0 = <&display_default_mode>;
453					backlight = <&ktd253>;
454				};
455			};
456		};
457	};
458};
459
460&pinctrl {
461	/*
462	 * This extends the MC0_A_1 default config to include
463	 * the card detect GPIO217 line.
464	 */
465	sdi0 {
466		mc0_a_1_default {
467			default_cfg1 {
468				/* GPIO18, 19 & 20 unused so pull down */
469				ste,config = <&gpio_in_pd>;
470			};
471			default_cfg4 {
472				pins = "GPIO217_AH12"; /* card detect */
473				ste,config = <&gpio_in_pd>;
474			};
475		};
476	};
477
478	mcde {
479		dsi_default_mode: dsi_default {
480			default_mux1 {
481				/* Mux in VSI0 used for DSI TE */
482				function = "lcd";
483				groups = "lcdvsi0_a_1"; /* VSI0 for LCD */
484			};
485			default_cfg1 {
486				pins = "GPIO68_E1"; /* VSI0 */
487				ste,config = <&in_nopull>;
488			};
489		};
490	};
491
492	/* Two GPIO lines used by the display */
493	display {
494		display_default_mode: display_default {
495			kyle_cfg1 {
496				/*
497				 * OLED DETECT or check_pba, this appears to be high
498				 * on "PBA" which I guess is "prototype board A".
499				 */
500				pins = "GPIO93_B7";
501				ste,config = <&gpio_in_nopull>;
502			};
503			kyle_cfg2 {
504				pins = "GPIO139_C9";
505				/*
506				 * MIPI_DSI0_RESET_N resets the display, leave high
507				 * (de-asserted) so we only assert reset explicitly
508				 * from the display driver.
509				 */
510				ste,config = <&gpio_out_hi>;
511			};
512		};
513	};
514
515	/* GPIO that enables the LDO regulator for the LCD display */
516	lcd-ldo {
517		lcd_pwr_en_default_mode: lcd_pwr_en_default {
518			/* LCD_PWR_EN on GPIO219 */
519			kyle_cfg1 {
520				pins = "GPIO219_AG10";
521				ste,config = <&gpio_out_hi>;
522			};
523		};
524	};
525
526	backlight {
527		gpio_backlight_default_mode: backlight_default {
528			kyle_cfg1 {
529				pins = "GPIO69_E2"; /* LCD_BL_CTRL */
530				ste,config = <&gpio_out_lo>;
531			};
532		};
533	};
534	flash {
535		gpio_flash_default_mode: flash_default {
536			kyle_cfg1 {
537				pins = "GPIO140_B11", "GPIO141_C12";
538				ste,config = <&gpio_out_lo>;
539			};
540		};
541	};
542	/* GPIO that enables the 2.9V SD card level translator */
543	sd-level-translator {
544		sd_level_translator_default: sd_level_translator_default {
545			/* level shifter on GPIO87 */
546			kyle_cfg1 {
547				pins = "GPIO87_B3";
548				ste,config = <&gpio_out_hi>;
549			};
550		};
551	};
552	/* GPIO that enables the LDO regulator for the eMMC */
553	emmc-ldo {
554		emmc_ldo_en_default_mode: emmc_ldo_default {
555			/* LDO enable on GPIO223 */
556			kyle_cfg1 {
557				pins = "GPIO223_AH9";
558				ste,config = <&gpio_out_hi>;
559			};
560		};
561	};
562	/* GPIO keys */
563	gpio-keys {
564		gpio_keys_default_mode: gpio_keys_default {
565			kyle_cfg1 {
566				pins = "GPIO67_G2", /* VOL UP */
567				       "GPIO91_B6", /* HOME */
568				       "GPIO92_D6"; /* VOL DOWN */
569					ste,config = <&gpio_in_pu>;
570			};
571		};
572	};
573	/* Interrupt line for light/proximity sensor GP2AP002 */
574	gp2ap002 {
575		gp2ap002_kyle_default: gp2ap002_kyle {
576			kyle_cfg1 {
577				pins = "GPIO146_D13";
578				ste,config = <&gpio_in_nopull>;
579			};
580		};
581	};
582	/* GPIO-based I2C bus for NCP6914 */
583	i2c-gpio-0 {
584		i2c_gpio_0_default: i2c_gpio_0 {
585			kyle_cfg1 {
586				pins = "GPIO143_D12", "GPIO144_B13";
587				ste,config = <&gpio_in_nopull>;
588			};
589		};
590	};
591	/* GPIO-based I2C bus for ALPS HSCD compass */
592	i2c-gpio-1 {
593		i2c_gpio_1_default: i2c_gpio_1 {
594			kyle_cfg1 {
595				pins = "GPIO151_B17", "GPIO152_D16";
596				ste,config = <&gpio_in_nopull>;
597			};
598		};
599	};
600	wlan {
601		wlan_default_mode: wlan_default {
602			kyle_cfg1 {
603				pins = "GPIO216_AG12";
604				ste,config = <&gpio_in_pd>;
605			};
606		};
607		wlan_en_default_mode: wlan_en_default {
608			kyle_cfg2 {
609				pins = "GPIO215_AH13";
610				ste,config = <&gpio_out_lo>;
611			};
612		};
613	};
614	bluetooth {
615		bluetooth_default_mode: bluetooth_default {
616			kyle_cfg1 {
617				pins = "GPIO199_AH23", "GPIO222_AJ9";
618				ste,config = <&gpio_out_lo>;
619			};
620			kyle_cfg2 {
621				pins = "GPIO97_D9";
622				ste,config = <&gpio_in_nopull>;
623			};
624		};
625	};
626	vibrator {
627		vibrator_default: vibrator_default {
628			kyle_cfg1 {
629				pins = "GPIO195_AG28";	/* MOT_EN */
630				ste,config = <&gpio_out_lo>;
631			};
632		};
633	};
634	/* Interrupt line for the Melfas MMS134S touchscreen */
635	touchscreen {
636		mms134s_kyle_default: mms134s_kyle {
637			kyle_cfg1 {
638				pins = "GPIO218_AH11";
639				ste,config = <&gpio_in_nopull>;
640			};
641		};
642	};
643};
644
645&ab8505_gpio {
646	/* Hog a few default settings */
647	pinctrl-names = "default";
648	pinctrl-0 = <&gpio_default>;
649
650	gpio {
651		gpio_default: gpio_default {
652			kyle_mux {
653				/* Change unused pins to GPIO mode */
654				function = "gpio";
655				groups = "gpio3_a_1",	/* default: SysClkReq4 */
656					 "gpio14_a_1";	/* default: PWMOut1 */
657			};
658			kyle_cfg1 {
659				pins = "GPIO11_B17", "GPIO13_D17", "GPIO50_L4";
660				bias-disable;
661			};
662		};
663	};
664};
665