1/*
2 * Google Gru-Kevin Rev 6+ board device tree source
3 *
4 * Copyright 2016-2017 Google, Inc
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This file is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This file is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 *  Or, alternatively,
22 *
23 *  b) Permission is hereby granted, free of charge, to any person
24 *     obtaining a copy of this software and associated documentation
25 *     files (the "Software"), to deal in the Software without
26 *     restriction, including without limitation the rights to use,
27 *     copy, modify, merge, publish, distribute, sublicense, and/or
28 *     sell copies of the Software, and to permit persons to whom the
29 *     Software is furnished to do so, subject to the following
30 *     conditions:
31 *
32 *     The above copyright notice and this permission notice shall be
33 *     included in all copies or substantial portions of the Software.
34 *
35 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42 *     OTHER DEALINGS IN THE SOFTWARE.
43 */
44
45/dts-v1/;
46#include "rk3399-gru.dtsi"
47#include <dt-bindings/input/linux-event-codes.h>
48
49/*
50 * Kevin-specific things
51 *
52 * Things in this section should use names from Kevin schematic since no
53 * equivalent exists in Gru schematic.  If referring to signals that exist
54 * in Gru we use the Gru names, though.  Confusing enough for you?
55 */
56/ {
57	model = "Google Kevin";
58	compatible = "google,kevin-rev15", "google,kevin-rev14",
59		     "google,kevin-rev13", "google,kevin-rev12",
60		     "google,kevin-rev11", "google,kevin-rev10",
61		     "google,kevin-rev9", "google,kevin-rev8",
62		     "google,kevin-rev7", "google,kevin-rev6",
63		     "google,kevin", "google,gru", "rockchip,rk3399";
64
65	/* Power tree */
66
67	p3_3v_dig: p3-3v-dig {
68		compatible = "regulator-fixed";
69		regulator-name = "p3.3v_dig";
70		pinctrl-names = "default";
71		pinctrl-0 = <&cpu3_pen_pwr_en>;
72
73		enable-active-high;
74		gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>;
75		vin-supply = <&pp3300>;
76	};
77
78	backlight: backlight {
79		compatible = "pwm-backlight";
80		pwms = <&cros_ec_pwm 1>;
81		brightness-levels = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
82				     17 18 19 20 21 22 23 24 25 26 27 28 29 30
83				     31 32 33 34 35 36 37 38 39 40 41 42 43 44
84				     45 46 47 48 49 50 51 52 53 54 55 56 57 58
85				     59 60 61 62 63 64 65 66 67 68 69 70 71 72
86				     73 74 75 76 77 78 79 80 81 82 83 84 85 86
87				     87 88 89 90 91 92 93 94 95 96 97 98 99 100>;
88		default-brightness-level = <51>;
89		enable-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
90		power-supply = <&pp3300_disp>;
91		pinctrl-names = "default";
92		pinctrl-0 = <&bl_en>;
93		pwm-delay-us = <10000>;
94	};
95
96	thermistor_ppvar_bigcpu: thermistor-ppvar-bigcpu {
97		compatible = "murata,ncp15wb473";
98		pullup-uv = <1800000>;
99		pullup-ohm = <25500>;
100		pulldown-ohm = <0>;
101		io-channels = <&saradc 2>;
102		#thermal-sensor-cells = <0>;
103	};
104
105	thermistor_ppvar_litcpu: thermistor-ppvar-litcpu {
106		compatible = "murata,ncp15wb473";
107		pullup-uv = <1800000>;
108		pullup-ohm = <25500>;
109		pulldown-ohm = <0>;
110		io-channels = <&saradc 3>;
111		#thermal-sensor-cells = <0>;
112	};
113};
114
115&gpio_keys {
116	pinctrl-names = "default";
117	pinctrl-0 = <&bt_host_wake_l>, <&cpu1_pen_eject>;
118
119	pen-insert {
120		label = "Pen Insert";
121		/* Insert = low, eject = high */
122		gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
123		linux,code = <SW_PEN_INSERTED>;
124		linux,input-type = <EV_SW>;
125		wakeup-source;
126	};
127};
128
129&thermal_zones {
130	bigcpu_reg_thermal: bigcpu-reg-thermal {
131		polling-delay-passive = <100>; /* milliseconds */
132		polling-delay = <1000>; /* milliseconds */
133		thermal-sensors = <&thermistor_ppvar_bigcpu 0>;
134		sustainable-power = <4000>;
135
136		ppvar_bigcpu_trips: trips {
137			ppvar_bigcpu_on: ppvar-bigcpu-on {
138				temperature = <40000>;	/* millicelsius */
139				hysteresis = <2000>;	/* millicelsius */
140				type = "passive";
141			};
142
143			ppvar_bigcpu_alert: ppvar-bigcpu-alert {
144				temperature = <50000>;	/* millicelsius */
145				hysteresis = <2000>;	/* millicelsius */
146				type = "passive";
147			};
148
149			ppvar_bigcpu_crit: ppvar-bigcpu-crit {
150				temperature = <90000>;	/* millicelsius */
151				hysteresis = <0>;	/* millicelsius */
152				type = "critical";
153			};
154		};
155
156		cooling-maps {
157			map0 {
158				trip = <&ppvar_bigcpu_alert>;
159				cooling-device =
160					<&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
161				contribution = <4096>;
162			};
163			map1 {
164				trip = <&ppvar_bigcpu_alert>;
165				cooling-device =
166					<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
167				contribution = <1024>;
168			};
169		};
170	};
171
172	litcpu_reg_thermal: litcpu-reg-thermal {
173		polling-delay-passive = <100>; /* milliseconds */
174		polling-delay = <1000>; /* milliseconds */
175		thermal-sensors = <&thermistor_ppvar_litcpu 0>;
176		sustainable-power = <4000>;
177
178		ppvar_litcpu_trips: trips {
179			ppvar_litcpu_on: ppvar-litcpu-on {
180				temperature = <40000>;	/* millicelsius */
181				hysteresis = <2000>;	/* millicelsius */
182				type = "passive";
183			};
184
185			ppvar_litcpu_alert: ppvar-litcpu-alert {
186				temperature = <50000>;	/* millicelsius */
187				hysteresis = <2000>;	/* millicelsius */
188				type = "passive";
189			};
190
191			ppvar_litcpu_crit: ppvar-litcpu-crit {
192				temperature = <90000>;	/* millicelsius */
193				hysteresis = <0>;	/* millicelsius */
194				type = "critical";
195			};
196		};
197	};
198};
199
200ap_i2c_tpm: &i2c0 {
201	status = "okay";
202
203	clock-frequency = <400000>;
204
205	/* These are relatively safe rise/fall times. */
206	i2c-scl-falling-time-ns = <50>;
207	i2c-scl-rising-time-ns = <300>;
208
209	tpm: tpm@20 {
210		compatible = "infineon,slb9645tt";
211		reg = <0x20>;
212		powered-while-suspended;
213	};
214};
215
216ap_i2c_dig: &i2c2 {
217	status = "okay";
218
219	clock-frequency = <400000>;
220
221	/* These are relatively safe rise/fall times. */
222	i2c-scl-falling-time-ns = <50>;
223	i2c-scl-rising-time-ns = <300>;
224
225	digitizer: digitizer@9 {
226		/* wacom,w9013 */
227		compatible = "hid-over-i2c";
228		reg = <0x9>;
229		pinctrl-names = "default";
230		pinctrl-0 = <&cpu1_dig_irq_l &cpu1_dig_pdct_l>;
231
232		vdd-supply = <&p3_3v_dig>;
233		post-power-on-delay-ms = <100>;
234
235		interrupt-parent = <&gpio2>;
236		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
237
238		hid-descr-addr = <0x1>;
239	};
240};
241
242/* Adjustments to things in the gru baseboard */
243
244&ap_i2c_tp {
245	trackpad@4a {
246		compatible = "atmel,atmel_mxt_tp";
247		reg = <0x4a>;
248		pinctrl-names = "default";
249		pinctrl-0 = <&trackpad_int_l>;
250		interrupt-parent = <&gpio1>;
251		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
252		wakeup-source;
253	};
254};
255
256&ap_i2c_ts {
257	touchscreen@4b {
258		compatible = "atmel,atmel_mxt_ts";
259		reg = <0x4b>;
260		pinctrl-names = "default";
261		pinctrl-0 = <&touch_int_l>;
262		interrupt-parent = <&gpio3>;
263		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
264	};
265};
266
267&ppvar_bigcpu_pwm {
268	regulator-min-microvolt = <798674>;
269	regulator-max-microvolt = <1302172>;
270};
271
272&ppvar_bigcpu {
273	regulator-min-microvolt = <798674>;
274	regulator-max-microvolt = <1302172>;
275	ctrl-voltage-range = <798674 1302172>;
276};
277
278&ppvar_litcpu_pwm {
279	regulator-min-microvolt = <799065>;
280	regulator-max-microvolt = <1303738>;
281};
282
283&ppvar_litcpu {
284	regulator-min-microvolt = <799065>;
285	regulator-max-microvolt = <1303738>;
286	ctrl-voltage-range = <799065 1303738>;
287};
288
289&ppvar_gpu_pwm {
290	regulator-min-microvolt = <785782>;
291	regulator-max-microvolt = <1217729>;
292};
293
294&ppvar_gpu {
295	regulator-min-microvolt = <785782>;
296	regulator-max-microvolt = <1217729>;
297	ctrl-voltage-range = <785782 1217729>;
298};
299
300&ppvar_centerlogic_pwm {
301	regulator-min-microvolt = <800069>;
302	regulator-max-microvolt = <1049692>;
303};
304
305&ppvar_centerlogic {
306	regulator-min-microvolt = <800069>;
307	regulator-max-microvolt = <1049692>;
308	ctrl-voltage-range = <800069 1049692>;
309};
310
311&saradc {
312	status = "okay";
313	vref-supply = <&pp1800_ap_io>;
314};
315
316&mvl_wifi {
317	marvell,wakeup-pin = <14>; /* GPIO_14 on Marvell */
318};
319
320&pinctrl {
321	digitizer {
322		/* Has external pullup */
323		cpu1_dig_irq_l: cpu1-dig-irq-l {
324			rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>;
325		};
326
327		/* Has external pullup */
328		cpu1_dig_pdct_l: cpu1-dig-pdct-l {
329			rockchip,pins = <2 5 RK_FUNC_GPIO &pcfg_pull_none>;
330		};
331	};
332
333	discrete-regulators {
334		cpu3_pen_pwr_en: cpu3-pen-pwr-en {
335			rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_none>;
336		};
337	};
338
339	pen {
340		cpu1_pen_eject: cpu1-pen-eject {
341			rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_up>;
342		};
343	};
344
345	wifi {
346		wlan_host_wake_l: wlan-host-wake-l {
347			rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
348		};
349	};
350};
351