1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Device Tree for the TVK1281618 R3 user interface board (UIB)
4 * also known as the "CYTTSP board"
5 */
6
7#include <dt-bindings/interrupt-controller/irq.h>
8#include <dt-bindings/input/input.h>
9
10/ {
11	gpio_keys {
12		compatible = "gpio-keys";
13		#address-cells = <1>;
14		#size-cells = <0>;
15		vdd-supply = <&ab8500_ldo_aux1_reg>;
16		pinctrl-names = "default";
17		pinctrl-0 = <&hall_tvk_mode>;
18
19		button@145 {
20			/* Hall sensor */
21			gpios = <&gpio4 17 GPIO_ACTIVE_HIGH>;
22			linux,code = <0>; /* SW_LID */
23			label = "HED54XXU11 Hall Effect Sensor";
24		};
25	};
26
27	soc {
28		i2c@80004000 {
29			tc35893@44 {
30				compatible = "toshiba,tc35893";
31				reg = <0x44>;
32				interrupt-parent = <&gpio2>;
33				interrupts = <0 IRQ_TYPE_EDGE_RISING>;
34				pinctrl-names = "default";
35				pinctrl-0 = <&tc35893_tvk_mode>;
36
37				interrupt-controller;
38				#interrupt-cells = <1>;
39				status = "disabled";
40
41				tc3589x_gpio {
42					compatible = "toshiba,tc3589x-gpio";
43					interrupts = <0>;
44
45					interrupt-controller;
46					#interrupt-cells = <2>;
47					gpio-controller;
48					#gpio-cells = <2>;
49				};
50				tc3589x_keypad {
51					compatible = "toshiba,tc3589x-keypad";
52					interrupts = <6>;
53					debounce-delay-ms = <4>;
54					keypad,num-columns = <8>;
55					keypad,num-rows = <8>;
56					linux,no-autorepeat;
57					wakeup-source;
58					linux,keymap = <MATRIX_KEY(3, 1, KEY_END)>,
59						       <MATRIX_KEY(4, 1, KEY_HOME)>,
60						       <MATRIX_KEY(6, 4, KEY_VOLUMEDOWN)>,
61						       <MATRIX_KEY(4, 2, KEY_EMAIL)>,
62						       <MATRIX_KEY(3, 3, KEY_RIGHT)>,
63						       <MATRIX_KEY(2, 5, KEY_BACKSPACE)>,
64						       <MATRIX_KEY(6, 7, KEY_MENU)>,
65						       <MATRIX_KEY(5, 0, KEY_ENTER)>,
66						       <MATRIX_KEY(4, 3, KEY_0)>,
67						       <MATRIX_KEY(3, 4, KEY_DOT)>,
68						       <MATRIX_KEY(5, 2, KEY_UP)>,
69						       <MATRIX_KEY(3, 5, KEY_DOWN)>,
70						       <MATRIX_KEY(4, 5, KEY_SEND)>,
71						       <MATRIX_KEY(0, 5, KEY_BACK)>,
72						       <MATRIX_KEY(6, 2, KEY_VOLUMEUP)>,
73						       <MATRIX_KEY(1, 3, KEY_SPACE)>,
74						       <MATRIX_KEY(7, 6, KEY_LEFT)>,
75						       <MATRIX_KEY(5, 5, KEY_SEARCH)>;
76				};
77			};
78		};
79
80		i2c@80128000 {
81			accelerometer@19 {
82				compatible = "st,lsm303dlhc-accel";
83				st,drdy-int-pin = <1>;
84				reg = <0x19>;
85				vdd-supply = <&ab8500_ldo_aux1_reg>;
86				vddio-supply = <&db8500_vsmps2_reg>;
87				interrupt-parent = <&gpio2>;
88				interrupts = <18 IRQ_TYPE_EDGE_RISING>,
89					     <19 IRQ_TYPE_EDGE_RISING>;
90				pinctrl-names = "default";
91				pinctrl-0 = <&accel_tvk_mode>;
92				mount-matrix = "0", "-1", "0",
93					       "-1", "0", "0",
94					       "0", "0", "-1";
95			};
96			magnetometer@1e {
97				compatible = "st,lsm303dlm-magn";
98				reg = <0x1e>;
99				vdd-supply = <&ab8500_ldo_aux1_reg>;
100				vddio-supply = <&db8500_vsmps2_reg>;
101				// This interrupt is not properly working with the driver
102				// interrupt-parent = <&gpio1>;
103				// interrupts = <0 IRQ_TYPE_EDGE_RISING>;
104				pinctrl-names = "default";
105				pinctrl-0 = <&magn_tvk_mode>;
106			};
107			gyroscope@68 {
108				/* Gyroscope */
109				compatible = "st,l3g4200d-gyro";
110				reg = <0x68>;
111				vdd-supply = <&ab8500_ldo_aux1_reg>;
112				vddio-supply = <&db8500_vsmps2_reg>;
113			};
114			pressure@5c {
115				/* Barometer/pressure sensor */
116				compatible = "st,lps001wp-press";
117				reg = <0x5c>;
118				vdd-supply = <&ab8500_ldo_aux1_reg>;
119				vddio-supply = <&db8500_vsmps2_reg>;
120			};
121		};
122
123		spi@80111000 {
124			num-cs = <1>;
125			cs-gpios = <&gpio6 24 GPIO_ACTIVE_LOW>;
126			pinctrl-names = "default";
127			pinctrl-0 = <&spi2_default_mode>;
128			status = "okay";
129
130			touchscreen@0 {
131				compatible = "cypress,cy8ctma340";
132				/*
133				 * Actually the max frequency is 6 MHz, but over 2 MHz the
134				 * data rate needs to be restricted to max 2Mbps which the
135				 * SPI framework cannot handle.
136				 */
137				spi-max-frequency = <2000000>;
138				reg = <0>;
139				interrupt-parent = <&gpio2>;
140				interrupts = <20 IRQ_TYPE_EDGE_FALLING>;
141				vcpin-supply = <&ab8500_ldo_aux1_reg>;
142				vdd-supply = <&db8500_vsmps2_reg>;
143				reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
144				touchscreen-size-x = <480>;
145				touchscreen-size-y = <854>;
146				active-interval-ms = <0>;
147				touch-timeout-ms = <255>;
148				lowpower-interval-ms = <10>;
149				bootloader-key = /bits/ 8 <0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07>;
150				pinctrl-names = "default";
151				pinctrl-0 = <&cyttsp_tvk_mode>;
152			};
153		};
154
155		mcde@a0350000 {
156			status = "okay";
157
158			dsi@a0351000 {
159				panel {
160					compatible = "sony,acx424akp";
161					reg = <0>;
162					vddi-supply = <&ab8500_ldo_aux1_reg>;
163					reset-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
164				};
165			};
166		};
167
168		pinctrl {
169			hall {
170				hall_tvk_mode: hall_tvk {
171					tvk_cfg {
172						pins = "GPIO145_C13";
173						ste,config = <&gpio_in_pu>;
174					};
175				};
176			};
177			tc35893 {
178				/* IRQ from the TC35893 */
179				tc35893_tvk_mode: tc35893_tvk {
180					tvk_cfg {
181						pins = "GPIO64_F3";
182						ste,config = <&gpio_in_pu>;
183					};
184				};
185			};
186			accelerometer {
187				accel_tvk_mode: accel_tvk {
188					/* Accelerometer interrupt lines 1 & 2 */
189					tvk_cfg {
190						pins = "GPIO82_C1", "GPIO83_D3";
191						ste,config = <&gpio_in_pd>;
192					};
193				};
194			};
195			magnetometer {
196				magn_tvk_mode: magn_tvk {
197					/* GPIO 32 used for DRDY, pull this down */
198					tvk_cfg {
199						pins = "GPIO32_V2";
200						ste,config = <&gpio_in_pd>;
201					};
202				};
203			};
204			cyttsp {
205				cyttsp_tvk_mode: cyttsp_tvk {
206					/* Touchscreen uses GPIO84 for IRQ */
207					tvk_cfg1 {
208						pins = "GPIO84_C2";
209						ste,config = <&gpio_in_pu>;
210					};
211					/* GPIO143 is reset */
212					tvk_cfg2 {
213						pins = "GPIO143_D12";
214						ste,config = <&gpio_out_hi>;
215					};
216				};
217			};
218		};
219	};
220};
221