1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Device Tree for the TVK1281618 R2 user interface board (UIB)
4 */
5
6#include <dt-bindings/interrupt-controller/irq.h>
7#include <dt-bindings/input/input.h>
8
9/ {
10	gpio_keys {
11		compatible = "gpio-keys";
12		#address-cells = <1>;
13		#size-cells = <0>;
14		vdd-supply = <&ab8500_ldo_aux1_reg>;
15		pinctrl-names = "default";
16		pinctrl-0 = <&prox_tvk_mode>, <&hall_tvk_mode>;
17
18		button@139 {
19			/* Proximity sensor */
20			gpios = <&gpio6 25 GPIO_ACTIVE_HIGH>;
21			linux,code = <11>; /* SW_FRONT_PROXIMITY */
22			label = "SFH7741 Proximity Sensor";
23		};
24		button@145 {
25			/* Hall sensor */
26			gpios = <&gpio4 17 GPIO_ACTIVE_HIGH>;
27			linux,code = <0>; /* SW_LID */
28			label = "HED54XXU11 Hall Effect Sensor";
29		};
30	};
31
32	soc {
33		i2c@80004000 {
34			tc35893@44 {
35				compatible = "toshiba,tc35893";
36				reg = <0x44>;
37				interrupt-parent = <&gpio6>;
38				interrupts = <26 IRQ_TYPE_EDGE_RISING>;
39				pinctrl-names = "default";
40				pinctrl-0 = <&tc35893_tvk_mode>;
41
42				interrupt-controller;
43				#interrupt-cells = <1>;
44				status = "disabled";
45
46				tc3589x_gpio {
47					compatible = "toshiba,tc3589x-gpio";
48					interrupts = <0>;
49
50					interrupt-controller;
51					#interrupt-cells = <2>;
52					gpio-controller;
53					#gpio-cells = <2>;
54				};
55				tc3589x_keypad {
56					compatible = "toshiba,tc3589x-keypad";
57					interrupts = <6>;
58					debounce-delay-ms = <4>;
59					keypad,num-columns = <8>;
60					keypad,num-rows = <8>;
61					linux,no-autorepeat;
62					wakeup-source;
63					linux,keymap = <MATRIX_KEY(3, 1, KEY_END)>,
64						       <MATRIX_KEY(4, 1, KEY_HOME)>,
65						       <MATRIX_KEY(6, 4, KEY_VOLUMEDOWN)>,
66						       <MATRIX_KEY(4, 2, KEY_EMAIL)>,
67						       <MATRIX_KEY(3, 3, KEY_RIGHT)>,
68						       <MATRIX_KEY(2, 5, KEY_BACKSPACE)>,
69						       <MATRIX_KEY(6, 7, KEY_MENU)>,
70						       <MATRIX_KEY(5, 0, KEY_ENTER)>,
71						       <MATRIX_KEY(4, 3, KEY_0)>,
72						       <MATRIX_KEY(3, 4, KEY_DOT)>,
73						       <MATRIX_KEY(5, 2, KEY_UP)>,
74						       <MATRIX_KEY(3, 5, KEY_DOWN)>,
75						       <MATRIX_KEY(4, 5, KEY_SEND)>,
76						       <MATRIX_KEY(0, 5, KEY_BACK)>,
77						       <MATRIX_KEY(6, 2, KEY_VOLUMEUP)>,
78						       <MATRIX_KEY(1, 3, KEY_SPACE)>,
79						       <MATRIX_KEY(7, 6, KEY_LEFT)>,
80						       <MATRIX_KEY(5, 5, KEY_SEARCH)>;
81				};
82			};
83		};
84
85		i2c@80128000 {
86			accelerometer@18 {
87				/* Accelerometer */
88				compatible = "st,lsm303dlh-accel";
89				st,drdy-int-pin = <1>;
90				drive-open-drain;
91				reg = <0x18>;
92				vdd-supply = <&ab8500_ldo_aux1_reg>;
93				vddio-supply = <&db8500_vsmps2_reg>;
94				pinctrl-names = "default";
95				pinctrl-0 = <&accel_tvk_mode>;
96				/*
97				 * These interrupts cannot be used: the other component
98				 * ST-Micro L3D4200D gyro that is connected to the same lines
99				 * cannot set its DRDY line to open drain, so it cannot be
100				 * shared with other peripherals. The should be defined for
101				 * the falling edge if they could be wired together.
102				 *
103				 * interrupts-extended =
104				 * <&gpio1 0 IRQ_TYPE_EDGE_FALLING>,
105				 * <&gpio2 19 IRQ_TYPE_EDGE_FALLING>;
106				 */
107				mount-matrix = "0", "1", "0",
108					       "1", "0", "0",
109					       "0", "0", "-1";
110			};
111			magnetometer@1e {
112				/* Magnetometer */
113				compatible = "st,lsm303dlh-magn";
114				reg = <0x1e>;
115				vdd-supply = <&ab8500_ldo_aux1_reg>;
116				vddio-supply = <&db8500_vsmps2_reg>;
117				/*
118				 * These interrupts cannot be used: the other component
119				 * ST-Micro L3D4200D gyro that is connected to the same lines
120				 * cannot set its DRDY line to open drain, so it cannot be
121				 * shared with other peripherals. The should be defined for
122				 * the falling edge if they could be wired together.
123				 *
124				 * interrupts-extended =
125				 * <&gpio1 0 IRQ_TYPE_EDGE_FALLING>,
126				 * <&gpio2 19 IRQ_TYPE_EDGE_FALLING>;
127				 */
128			};
129			accelerometer@1c {
130				/* Accelerometer */
131				compatible = "st,lis331dl-accel";
132				st,drdy-int-pin = <1>;
133				reg = <0x1c>;
134				vdd-supply = <&ab8500_ldo_aux1_reg>;
135				vddio-supply = <&db8500_vsmps2_reg>;
136				pinctrl-names = "default";
137				pinctrl-0 = <&accel_tvk_mode>;
138				interrupt-parent = <&gpio2>;
139				/* INT2 would need to be open drain */
140				interrupts = <18 IRQ_TYPE_EDGE_RISING>,
141					     <19 IRQ_TYPE_EDGE_RISING>;
142				mount-matrix = "0", "-1", "0",
143					       "-1", "0", "0",
144					       "0", "0", "-1";
145			};
146			magnetometer@f {
147				/* Magnetometer */
148				compatible = "asahi-kasei,ak8974";
149				reg = <0x0f>;
150				avdd-supply = <&ab8500_ldo_aux1_reg>;
151				dvdd-supply = <&db8500_vsmps2_reg>;
152				pinctrl-names = "default";
153				pinctrl-0 = <&gyro_magn_tvk_mode>;
154				/*
155				 * These interrupts cannot be used: the other component
156				 * ST-Micro L3D4200D gyro that is connected to the same lines
157				 * cannot set its DRDY line to open drain, so it cannot be
158				 * shared with other peripherals. The should be defined for
159				 * the falling edge if they could be wired together.
160				 *
161				 * interrupts-extended =
162				 * <&gpio1 0 IRQ_TYPE_EDGE_FALLING>,
163				 * <&gpio0 31 IRQ_TYPE_EDGE_FALLING>;
164				 */
165			};
166			gyroscope@68 {
167				/* Gyroscope */
168				compatible = "st,l3g4200d-gyro";
169				st,drdy-int-pin = <2>;
170				reg = <0x68>;
171				vdd-supply = <&ab8500_ldo_aux1_reg>;
172				vddio-supply = <&db8500_vsmps2_reg>;
173				pinctrl-names = "default";
174				pinctrl-0 = <&gyro_magn_tvk_mode>;
175				interrupts-extended =
176				<&gpio1 0 IRQ_TYPE_EDGE_RISING>,
177				<&gpio0 31 IRQ_TYPE_EDGE_RISING>;
178			};
179			pressure@5c {
180				/* Barometer/pressure sensor */
181				compatible = "st,lps001wp-press";
182				reg = <0x5c>;
183				vdd-supply = <&ab8500_ldo_aux1_reg>;
184				vddio-supply = <&db8500_vsmps2_reg>;
185			};
186		};
187		i2c@80110000 {
188			synaptics@4b {
189				/* Synaptics RMI4 TM1217 touchscreen */
190				compatible = "syna,rmi4-i2c";
191				#address-cells = <1>;
192				#size-cells = <0>;
193				reg = <0x4b>;
194				vdd-supply = <&ab8500_ldo_aux1_reg>;
195				vddio-supply = <&db8500_vsmps2_reg>;
196				pinctrl-names = "default";
197				pinctrl-0 = <&synaptics_tvk_mode>;
198				interrupt-parent = <&gpio2>;
199				interrupts = <20 IRQ_TYPE_EDGE_FALLING>;
200
201				rmi4-f01@1 {
202					reg = <0x1>;
203					syna,nosleep = <1>;
204				};
205				rmi4-f11@11 {
206					reg = <0x11>;
207					syna,sensor-type = <1>;
208					/* This is a landscape display */
209					touchscreen-swapped-x-y;
210				};
211			};
212		};
213		mcde@a0350000 {
214			status = "okay";
215
216			dsi@a0351000 {
217				panel {
218					compatible = "samsung,s6d16d0";
219					reg = <0>;
220					vdd1-supply = <&ab8500_ldo_aux1_reg>;
221					reset-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
222				};
223			};
224		};
225		pinctrl {
226			prox {
227				prox_tvk_mode: prox_tvk {
228					tvk_cfg {
229						pins = "GPIO217_AH12";
230						ste,config = <&gpio_in_pu>;
231					};
232				};
233			};
234			hall {
235				hall_tvk_mode: hall_tvk {
236					tvk_cfg {
237						pins = "GPIO145_C13";
238						ste,config = <&gpio_in_pu>;
239					};
240				};
241			};
242			tc35893 {
243				/* IRQ from the TC35893 */
244				tc35893_tvk_mode: tc35893_tvk {
245					tvk_cfg {
246						pins = "GPIO218_AH11";
247						ste,config = <&gpio_in_pu>;
248					};
249				};
250			};
251			accelerometer {
252				accel_tvk_mode: accel_tvk {
253					/* Accelerometer interrupt lines 1 & 2 */
254					tvk_cfg {
255						pins = "GPIO82_C1", "GPIO83_D3";
256						ste,config = <&gpio_in_pd>;
257					};
258				};
259			};
260			gyroscope {
261				/*
262				 * These lines are shared between Gyroscope l3g400dh
263				 * and AK8974 magnetometer.
264				 */
265				gyro_magn_tvk_mode: gyro_magn_tvk {
266					 /* GPIO 31 used for INT pull down the line */
267					tvk_cfg1 {
268						pins = "GPIO31_V3";
269						ste,config = <&gpio_in_pd>;
270					};
271					/* GPIO 32 used for DRDY, pull this down */
272					tvk_cfg2 {
273						pins = "GPIO32_V2";
274						ste,config = <&gpio_in_pd>;
275					};
276				};
277			};
278			synaptics {
279				synaptics_tvk_mode: synaptics_tvk {
280					/* Touchscreen uses GPIO 84 */
281					tvk_cfg1 {
282						pins = "GPIO84_C2";
283						ste,config = <&gpio_in_pu>;
284					};
285				};
286			};
287		};
288	};
289};
290