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