1/*
2 * Copyright 2014 Siarhei Siamashka <siarhei.siamashka@gmail.com>
3 * Copyright 2015 Karsten Merker <merker@debian.org>
4 * Copyright 2015 Chen-Yu Tsai <wens@csie.org>
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 "sun6i-a31s.dtsi"
47#include "sunxi-common-regulators.dtsi"
48
49#include <dt-bindings/gpio/gpio.h>
50#include <dt-bindings/input/input.h>
51
52/ {
53	model = "MSI Primo81 tablet";
54	compatible = "msi,primo81", "allwinner,sun6i-a31s";
55
56	hdmi-connector {
57		compatible = "hdmi-connector";
58		type = "c";
59
60		port {
61			hdmi_con_in: endpoint {
62				remote-endpoint = <&hdmi_out_con>;
63			};
64		};
65	};
66};
67
68&cpu0 {
69	cpu-supply = <&reg_dcdc3>;
70};
71
72&de {
73	status = "okay";
74};
75
76&ehci0 {
77	/* rtl8188etv wifi is connected here */
78	status = "okay";
79};
80
81&hdmi {
82	status = "okay";
83};
84
85&hdmi_out {
86	hdmi_out_con: endpoint {
87		remote-endpoint = <&hdmi_con_in>;
88	};
89};
90
91&i2c0 {
92	/* pull-ups and device VDDIO use AXP221 DLDO3 */
93	pinctrl-names = "default";
94	pinctrl-0 = <&i2c0_pins_a>;
95	status = "failed";
96};
97
98&i2c1 {
99	pinctrl-names = "default";
100	pinctrl-0 = <&i2c1_pins_a>;
101	status = "okay";
102
103	ctp@5d {
104		pinctrl-names = "default";
105		pinctrl-0 = <&gt911_int_primo81>;
106		compatible = "goodix,gt911";
107		reg = <0x5d>;
108		interrupt-parent = <&pio>;
109		interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */
110		touchscreen-swapped-x-y;
111	};
112};
113
114&i2c2 {
115	pinctrl-names = "default";
116	pinctrl-0 = <&i2c2_pins_a>;
117	status = "okay";
118
119	accelerometer@1c {
120		pinctrl-names = "default";
121		pinctrl-0 = <&mma8452_int_primo81>;
122		compatible = "fsl,mma8452";
123		reg = <0x1c>;
124		interrupt-parent = <&pio>;
125		interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>; /* PA9 */
126		#io-channel-cells = <1>;
127	};
128};
129
130&lradc {
131	vref-supply = <&reg_aldo3>;
132	status = "okay";
133
134	button@158 {
135		label = "Volume Up";
136		linux,code = <KEY_VOLUMEUP>;
137		channel = <0>;
138		voltage = <158730>;
139	};
140
141	button@349 {
142		label = "Volume Down";
143		linux,code = <KEY_VOLUMEDOWN>;
144		channel = <0>;
145		voltage = <349206>;
146	};
147};
148
149&mmc0 {
150	pinctrl-names = "default";
151	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_primo81>;
152	vmmc-supply = <&reg_dcdc1>;
153	bus-width = <4>;
154	cd-gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
155	status = "okay";
156};
157
158&pio {
159	gt911_int_primo81: gt911_int_pin@0 {
160		pins = "PA3";
161		function = "gpio_in";
162	};
163
164	mma8452_int_primo81: mma8452_int_pin@0 {
165		pins = "PA9";
166		function = "gpio_in";
167		bias-pull-up;
168	};
169
170	mmc0_cd_pin_primo81: mmc0_cd_pin@0 {
171		pins = "PA8";
172		function = "gpio_in";
173		bias-pull-up;
174	};
175};
176
177&p2wi {
178	status = "okay";
179
180	axp22x: pmic@68 {
181		compatible = "x-powers,axp221";
182		reg = <0x68>;
183		interrupt-parent = <&nmi_intc>;
184		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
185		x-powers,drive-vbus-en;
186	};
187};
188
189#include "axp22x.dtsi"
190
191&battery_power_supply {
192	status = "okay";
193};
194
195&reg_aldo3 {
196	regulator-always-on;
197	regulator-min-microvolt = <2700000>;
198	regulator-max-microvolt = <3300000>;
199	regulator-name = "avcc";
200};
201
202&reg_dc1sw {
203	regulator-name = "vcc-lcd";
204};
205
206&reg_dc5ldo {
207	regulator-min-microvolt = <700000>;
208	regulator-max-microvolt = <1320000>;
209	regulator-name = "vdd-cpus"; /* This is an educated guess */
210};
211
212&reg_dcdc1 {
213	regulator-always-on;
214	regulator-min-microvolt = <3000000>;
215	regulator-max-microvolt = <3000000>;
216	regulator-name = "vcc-3v0";
217};
218
219&reg_dcdc2 {
220	regulator-min-microvolt = <700000>;
221	regulator-max-microvolt = <1320000>;
222	regulator-name = "vdd-gpu";
223};
224
225&reg_dcdc3 {
226	regulator-always-on;
227	regulator-min-microvolt = <700000>;
228	regulator-max-microvolt = <1320000>;
229	regulator-name = "vdd-cpu";
230};
231
232&reg_dcdc4 {
233	regulator-always-on;
234	regulator-min-microvolt = <700000>;
235	regulator-max-microvolt = <1320000>;
236	regulator-name = "vdd-sys-dll";
237};
238
239&reg_dcdc5 {
240	regulator-always-on;
241	regulator-min-microvolt = <1500000>;
242	regulator-max-microvolt = <1500000>;
243	regulator-name = "vcc-dram";
244};
245
246&reg_dldo1 {
247	regulator-min-microvolt = <3300000>;
248	regulator-max-microvolt = <3300000>;
249	regulator-name = "vcc-wifi";
250};
251
252&reg_dldo3 {
253	regulator-min-microvolt = <2800000>;
254	regulator-max-microvolt = <2800000>;
255	regulator-name = "vddio-csi";
256};
257
258&reg_drivevbus {
259	regulator-name = "usb0-vbus";
260	status = "okay";
261};
262
263&reg_eldo3 {
264	regulator-min-microvolt = <1080000>;
265	regulator-max-microvolt = <1320000>;
266	regulator-name = "vdd-mipi-bridge";
267};
268
269&simplefb_lcd {
270	vcc-lcd-supply = <&reg_dc1sw>;
271	vdd-mipi-bridge-supply = <&reg_eldo3>;
272};
273
274&usb_otg {
275	dr_mode = "otg";
276	status = "okay";
277};
278
279&usb_power_supply {
280	status = "okay";
281};
282
283&usbphy {
284	usb0_id_det-gpio = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
285	usb0_vbus_power-supply = <&usb_power_supply>;
286	usb0_vbus-supply = <&reg_drivevbus>;
287	usb1_vbus-supply = <&reg_dldo1>;
288	status = "okay";
289};
290