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	edp_panel: edp-panel {
97		compatible = "sharp,lq123p1jx31", "simple-panel";
98		backlight = <&backlight>;
99		power-supply = <&pp3300_disp>;
100
101		ports {
102			panel_in_edp: endpoint {
103				remote-endpoint = <&edp_out_panel>;
104			};
105		};
106	};
107
108	thermistor_ppvar_bigcpu: thermistor-ppvar-bigcpu {
109		compatible = "murata,ncp15wb473";
110		pullup-uv = <1800000>;
111		pullup-ohm = <25500>;
112		pulldown-ohm = <0>;
113		io-channels = <&saradc 2>;
114		#thermal-sensor-cells = <0>;
115	};
116
117	thermistor_ppvar_litcpu: thermistor-ppvar-litcpu {
118		compatible = "murata,ncp15wb473";
119		pullup-uv = <1800000>;
120		pullup-ohm = <25500>;
121		pulldown-ohm = <0>;
122		io-channels = <&saradc 3>;
123		#thermal-sensor-cells = <0>;
124	};
125};
126
127&gpio_keys {
128	pinctrl-names = "default";
129	pinctrl-0 = <&bt_host_wake_l>, <&cpu1_pen_eject>;
130
131	pen-insert {
132		label = "Pen Insert";
133		/* Insert = low, eject = high */
134		gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
135		linux,code = <SW_PEN_INSERTED>;
136		linux,input-type = <EV_SW>;
137		wakeup-source;
138	};
139};
140
141&thermal_zones {
142	bigcpu_reg_thermal: bigcpu-reg-thermal {
143		polling-delay-passive = <100>; /* milliseconds */
144		polling-delay = <1000>; /* milliseconds */
145		thermal-sensors = <&thermistor_ppvar_bigcpu 0>;
146		sustainable-power = <4000>;
147
148		ppvar_bigcpu_trips: trips {
149			ppvar_bigcpu_on: ppvar-bigcpu-on {
150				temperature = <40000>;	/* millicelsius */
151				hysteresis = <2000>;	/* millicelsius */
152				type = "passive";
153			};
154
155			ppvar_bigcpu_alert: ppvar-bigcpu-alert {
156				temperature = <50000>;	/* millicelsius */
157				hysteresis = <2000>;	/* millicelsius */
158				type = "passive";
159			};
160
161			ppvar_bigcpu_crit: ppvar-bigcpu-crit {
162				temperature = <90000>;	/* millicelsius */
163				hysteresis = <0>;	/* millicelsius */
164				type = "critical";
165			};
166		};
167
168		cooling-maps {
169			map0 {
170				trip = <&ppvar_bigcpu_alert>;
171				cooling-device =
172					<&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
173				contribution = <4096>;
174			};
175			map1 {
176				trip = <&ppvar_bigcpu_alert>;
177				cooling-device =
178					<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
179				contribution = <1024>;
180			};
181		};
182	};
183
184	litcpu_reg_thermal: litcpu-reg-thermal {
185		polling-delay-passive = <100>; /* milliseconds */
186		polling-delay = <1000>; /* milliseconds */
187		thermal-sensors = <&thermistor_ppvar_litcpu 0>;
188		sustainable-power = <4000>;
189
190		ppvar_litcpu_trips: trips {
191			ppvar_litcpu_on: ppvar-litcpu-on {
192				temperature = <40000>;	/* millicelsius */
193				hysteresis = <2000>;	/* millicelsius */
194				type = "passive";
195			};
196
197			ppvar_litcpu_alert: ppvar-litcpu-alert {
198				temperature = <50000>;	/* millicelsius */
199				hysteresis = <2000>;	/* millicelsius */
200				type = "passive";
201			};
202
203			ppvar_litcpu_crit: ppvar-litcpu-crit {
204				temperature = <90000>;	/* millicelsius */
205				hysteresis = <0>;	/* millicelsius */
206				type = "critical";
207			};
208		};
209	};
210};
211
212ap_i2c_tpm: &i2c0 {
213	status = "okay";
214
215	clock-frequency = <400000>;
216
217	/* These are relatively safe rise/fall times. */
218	i2c-scl-falling-time-ns = <50>;
219	i2c-scl-rising-time-ns = <300>;
220
221	tpm: tpm@20 {
222		compatible = "infineon,slb9645tt";
223		reg = <0x20>;
224		powered-while-suspended;
225	};
226};
227
228ap_i2c_dig: &i2c2 {
229	status = "okay";
230
231	clock-frequency = <400000>;
232
233	/* These are relatively safe rise/fall times. */
234	i2c-scl-falling-time-ns = <50>;
235	i2c-scl-rising-time-ns = <300>;
236
237	digitizer: digitizer@9 {
238		/* wacom,w9013 */
239		compatible = "hid-over-i2c";
240		reg = <0x9>;
241		pinctrl-names = "default";
242		pinctrl-0 = <&cpu1_dig_irq_l &cpu1_dig_pdct_l>;
243
244		vdd-supply = <&p3_3v_dig>;
245		post-power-on-delay-ms = <100>;
246
247		interrupt-parent = <&gpio2>;
248		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
249
250		hid-descr-addr = <0x1>;
251	};
252};
253
254/* Adjustments to things in the gru baseboard */
255
256&ap_i2c_tp {
257	trackpad@4a {
258		compatible = "atmel,atmel_mxt_tp";
259		reg = <0x4a>;
260		pinctrl-names = "default";
261		pinctrl-0 = <&trackpad_int_l>;
262		interrupt-parent = <&gpio1>;
263		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
264		linux,gpio-keymap = <KEY_RESERVED
265				     KEY_RESERVED
266				     KEY_RESERVED
267				     BTN_LEFT>;
268		wakeup-source;
269	};
270};
271
272&ap_i2c_ts {
273	touchscreen@4b {
274		compatible = "atmel,atmel_mxt_ts";
275		reg = <0x4b>;
276		pinctrl-names = "default";
277		pinctrl-0 = <&touch_int_l>;
278		interrupt-parent = <&gpio3>;
279		interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
280	};
281};
282
283&edp {
284	status = "okay";
285
286	ports {
287		edp_out: port@1 {
288			reg = <1>;
289			#address-cells = <1>;
290			#size-cells = <0>;
291
292			edp_out_panel: endpoint@0 {
293				reg = <0>;
294				remote-endpoint = <&panel_in_edp>;
295			};
296		};
297	};
298};
299
300&ppvar_bigcpu_pwm {
301	regulator-min-microvolt = <798674>;
302	regulator-max-microvolt = <1302172>;
303};
304
305&ppvar_bigcpu {
306	regulator-min-microvolt = <798674>;
307	regulator-max-microvolt = <1302172>;
308	ctrl-voltage-range = <798674 1302172>;
309};
310
311&ppvar_litcpu_pwm {
312	regulator-min-microvolt = <799065>;
313	regulator-max-microvolt = <1303738>;
314};
315
316&ppvar_litcpu {
317	regulator-min-microvolt = <799065>;
318	regulator-max-microvolt = <1303738>;
319	ctrl-voltage-range = <799065 1303738>;
320};
321
322&ppvar_gpu_pwm {
323	regulator-min-microvolt = <785782>;
324	regulator-max-microvolt = <1217729>;
325};
326
327&ppvar_gpu {
328	regulator-min-microvolt = <785782>;
329	regulator-max-microvolt = <1217729>;
330	ctrl-voltage-range = <785782 1217729>;
331};
332
333&ppvar_centerlogic_pwm {
334	regulator-min-microvolt = <800069>;
335	regulator-max-microvolt = <1049692>;
336};
337
338&ppvar_centerlogic {
339	regulator-min-microvolt = <800069>;
340	regulator-max-microvolt = <1049692>;
341	ctrl-voltage-range = <800069 1049692>;
342};
343
344&saradc {
345	status = "okay";
346	vref-supply = <&pp1800_ap_io>;
347};
348
349&mvl_wifi {
350	marvell,wakeup-pin = <14>; /* GPIO_14 on Marvell */
351};
352
353&pinctrl {
354	digitizer {
355		/* Has external pullup */
356		cpu1_dig_irq_l: cpu1-dig-irq-l {
357			rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>;
358		};
359
360		/* Has external pullup */
361		cpu1_dig_pdct_l: cpu1-dig-pdct-l {
362			rockchip,pins = <2 5 RK_FUNC_GPIO &pcfg_pull_none>;
363		};
364	};
365
366	discrete-regulators {
367		cpu3_pen_pwr_en: cpu3-pen-pwr-en {
368			rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_none>;
369		};
370	};
371
372	pen {
373		cpu1_pen_eject: cpu1-pen-eject {
374			rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_up>;
375		};
376	};
377
378	wifi {
379		wlan_host_wake_l: wlan-host-wake-l {
380			rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
381		};
382	};
383};
384