arm: dts: rk3288-evb: use rockchip_key to replace adc_key
[firefly-linux-kernel-4.4.55.git] / arch / arm / boot / dts / rk3288-evb.dtsi
1 /*
2  * Copyright (c) 2015~2017 Fuzhou Rockchip Electronics Co., Ltd
3  *
4  * This file is dual-licensed: you can use it either under the terms
5  * of the GPL or the X11 license, at your option. Note that this dual
6  * licensing only applies to this file, and not this project as a
7  * whole.
8  *
9  *  a) This file is free software; you can redistribute it and/or
10  *     modify it under the terms of the GNU General Public License as
11  *     published by the Free Software Foundation; either version 2 of the
12  *     License, or (at your option) any later version.
13  *
14  *     This file is distributed in the hope that it will be useful,
15  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *     GNU General Public License for more details.
18  *
19  * Or, alternatively,
20  *
21  *  b) Permission is hereby granted, free of charge, to any person
22  *     obtaining a copy of this software and associated documentation
23  *     files (the "Software"), to deal in the Software without
24  *     restriction, including without limitation the rights to use,
25  *     copy, modify, merge, publish, distribute, sublicense, and/or
26  *     sell copies of the Software, and to permit persons to whom the
27  *     Software is furnished to do so, subject to the following
28  *     conditions:
29  *
30  *     The above copyright notice and this permission notice shall be
31  *     included in all copies or substantial portions of the Software.
32  *
33  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40  *     OTHER DEALINGS IN THE SOFTWARE.
41  */
42
43 #include <dt-bindings/pwm/pwm.h>
44 #include <dt-bindings/input/input.h>
45 #include "rk3288.dtsi"
46
47 / {
48         chosen {
49                 bootargs = "earlycon=uart8250,mmio32,0xff690000 swiotlb=1";
50         };
51
52         backlight: backlight {
53                 compatible = "pwm-backlight";
54                 brightness-levels = <
55                           0   1   2   3   4   5   6   7
56                           8   9  10  11  12  13  14  15
57                          16  17  18  19  20  21  22  23
58                          24  25  26  27  28  29  30  31
59                          32  33  34  35  36  37  38  39
60                          40  41  42  43  44  45  46  47
61                          48  49  50  51  52  53  54  55
62                          56  57  58  59  60  61  62  63
63                          64  65  66  67  68  69  70  71
64                          72  73  74  75  76  77  78  79
65                          80  81  82  83  84  85  86  87
66                          88  89  90  91  92  93  94  95
67                          96  97  98  99 100 101 102 103
68                         104 105 106 107 108 109 110 111
69                         112 113 114 115 116 117 118 119
70                         120 121 122 123 124 125 126 127
71                         128 129 130 131 132 133 134 135
72                         136 137 138 139 140 141 142 143
73                         144 145 146 147 148 149 150 151
74                         152 153 154 155 156 157 158 159
75                         160 161 162 163 164 165 166 167
76                         168 169 170 171 172 173 174 175
77                         176 177 178 179 180 181 182 183
78                         184 185 186 187 188 189 190 191
79                         192 193 194 195 196 197 198 199
80                         200 201 202 203 204 205 206 207
81                         208 209 210 211 212 213 214 215
82                         216 217 218 219 220 221 222 223
83                         224 225 226 227 228 229 230 231
84                         232 233 234 235 236 237 238 239
85                         240 241 242 243 244 245 246 247
86                         248 249 250 251 252 253 254 255>;
87                 default-brightness-level = <128>;
88                 enable-gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
89                 pinctrl-names = "default";
90                 pinctrl-0 = <&bl_en>;
91                 pwms = <&pwm0 0 1000000 PWM_POLARITY_INVERTED>;
92         };
93
94         rk_key: rockchip-key {
95                 compatible = "rockchip,key";
96                 status = "okay";
97
98                 io-channels = <&saradc 1>;
99
100                 vol-up-key {
101                         linux,code = <115>;
102                         label = "volume up";
103                         rockchip,adc_value = <1>;
104                 };
105
106                 vol-down-key {
107                         linux,code = <114>;
108                         label = "volume down";
109                         rockchip,adc_value = <170>;
110                 };
111
112                 power-key {
113                         gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
114                         linux,code = <116>;
115                         pinctrl-names = "default";
116                         pinctrl-0 = <&pwrbtn>;
117                         label = "power";
118                         gpio-key,wakeup;
119                 };
120
121                 menu-key {
122                         linux,code = <59>;
123                         label = "menu";
124                         rockchip,adc_value = <355>;
125                 };
126
127                 home-key {
128                         linux,code = <102>;
129                         label = "home";
130                         rockchip,adc_value = <746>;
131                 };
132
133                 back-key {
134                         linux,code = <158>;
135                         label = "back";
136                         rockchip,adc_value = <560>;
137                 };
138
139                 camera-key {
140                         linux,code = <212>;
141                         label = "camera";
142                         rockchip,adc_value = <450>;
143                 };
144         };
145
146         panel: panel {
147                 compatible ="lg,lp079qx1-sp0v", "simple-panel";
148                 backlight = <&backlight>;
149                 enable-gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
150                 pinctrl-0 = <&lcd_cs>;
151                 ports {
152                         panel_in: port {
153                                 panel_in_edp: endpoint {
154                                         remote-endpoint = <&edp_out_panel>;
155                                 };
156                         };
157                 };
158         };
159
160         sound {
161                 compatible = "simple-audio-card";
162                 simple-audio-card,format = "i2s";
163                 simple-audio-card,name = "rockchip,rt5640-codec";
164                 simple-audio-card,mclk-fs = <512>;
165                 simple-audio-card,widgets =
166                         "Microphone", "Microphone Jack",
167                         "Headphone", "Headphone Jack";
168                 simple-audio-card,routing =
169                         "MIC1", "Microphone Jack",
170                         "MIC2", "Microphone Jack",
171                         "Microphone Jack", "micbias1",
172                         "Headphone Jack", "HPOL",
173                         "Headphone Jack", "HPOR";
174
175                 simple-audio-card,dai-link@0 {
176                         format = "i2s";
177                         cpu {
178                                 sound-dai = <&i2s>;
179                         };
180
181                         codec {
182                                 sound-dai = <&rt5640>;
183                         };
184                 };
185
186                 simple-audio-card,dai-link@1 {
187                         format = "i2s";
188                         cpu {
189                                 sound-dai = <&i2s>;
190                         };
191
192                         codec {
193                                 sound-dai = <&hdmi>;
194                         };
195                 };
196         };
197
198         lvds_panel: lvds_panel {
199                 compatible ="auo,b101ew05","simple-panel";
200                 backlight = <&backlight>;
201                 enable-gpios = <&gpio7 4 GPIO_ACTIVE_HIGH>;
202                 pinctrl-0 = <&lcd_cs>;
203                 status = "disabled";
204         };
205
206         ext_gmac: external-gmac-clock {
207                 compatible = "fixed-clock";
208                 clock-frequency = <125000000>;
209                 clock-output-names = "ext_gmac";
210                 #clock-cells = <0>;
211         };
212
213         vccadc_ref: vccadc-ref {
214                 compatible = "regulator-fixed";
215                 regulator-name = "vcc1v8_sys";
216                 regulator-always-on;
217                 regulator-boot-on;
218                 regulator-min-microvolt = <1800000>;
219                 regulator-max-microvolt = <1800000>;
220         };
221
222         /* This turns on USB vbus for both host0 (ehci) and host1 (dwc2) */
223         vcc_host: vcc-host-regulator {
224                 compatible = "regulator-fixed";
225                 enable-active-high;
226                 gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
227                 pinctrl-names = "default";
228                 pinctrl-0 = <&host_vbus_drv>;
229                 regulator-name = "vcc_host";
230                 regulator-always-on;
231                 regulator-boot-on;
232         };
233
234         vcc_phy: vcc-phy-regulator {
235                 compatible = "regulator-fixed";
236                 enable-active-high;
237                 gpio = <&gpio0 6 GPIO_ACTIVE_HIGH>;
238                 pinctrl-names = "default";
239                 pinctrl-0 = <&eth_phy_pwr>;
240                 regulator-name = "vcc_phy";
241                 regulator-min-microvolt = <3300000>;
242                 regulator-max-microvolt = <3300000>;
243                 regulator-always-on;
244                 regulator-boot-on;
245         };
246
247         vcc_sys: vsys-regulator {
248                 compatible = "regulator-fixed";
249                 regulator-name = "vcc_sys";
250                 regulator-min-microvolt = <5000000>;
251                 regulator-max-microvolt = <5000000>;
252                 regulator-always-on;
253                 regulator-boot-on;
254         };
255
256         /* This switch DIO3222 HOST_DP_HOST to host2 (dwc2) */
257         vcc_3g: vcc-3g-regulator {
258                 compatible = "regulator-fixed";
259                 enable-active-high;
260                 gpio = <&gpio7 8 GPIO_ACTIVE_HIGH>;
261                 pinctrl-names = "default";
262                 pinctrl-0 = <&pwr_3g>;
263                 regulator-name = "vcc_3g";
264         };
265
266         /*
267          * NOTE: vcc_sd isn't hooked up on v1.0 boards where power comes from
268          * vcc_io directly.  Those boards won't be able to power cycle SD cards
269          * but it shouldn't hurt to toggle this pin there anyway.
270          */
271         vcc_sd: sdmmc-regulator {
272                 compatible = "regulator-fixed";
273                 pinctrl-names = "default";
274                 pinctrl-0 = <&sdmmc_pwr>;
275                 regulator-name = "vcc_sd";
276                 regulator-min-microvolt = <3300000>;
277                 regulator-max-microvolt = <3300000>;
278                 startup-delay-us = <100000>;
279                 vin-supply = <&vcc_io>;
280         };
281
282         wireless-bluetooth {
283                 compatible = "bluetooth-platdata";
284                 uart_rts_gpios = <&gpio4 19 GPIO_ACTIVE_LOW>;
285                 pinctrl-names = "default", "rts_gpio";
286                 pinctrl-0 = <&uart0_rts>;
287                 pinctrl-1 = <&uart0_gpios>;
288                 BT,reset_gpio    = <&gpio4 29 GPIO_ACTIVE_HIGH>;
289                 BT,wake_gpio     = <&gpio4 26 GPIO_ACTIVE_HIGH>;
290                 BT,wake_host_irq = <&gpio4 31 GPIO_ACTIVE_HIGH>;
291                 status = "okay";
292         };
293
294         wireless-wlan {
295                 compatible = "wlan-platdata";
296                 rockchip,grf = <&grf>;
297                 wifi_chip_type = "ap6335";
298                 sdio_vref = <1800>;
299                 WIFI,host_wake_irq = <&gpio4 30 GPIO_ACTIVE_HIGH>;
300                 status = "okay";
301         };
302 };
303
304 &emmc {
305         bus-width = <8>;
306         cap-mmc-highspeed;
307         disable-wp;
308         non-removable;
309         num-slots = <1>;
310         pinctrl-names = "default";
311         pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_pwr &emmc_bus8>;
312         status = "okay";
313 };
314
315 &gmac {
316         phy-supply = <&vcc_phy>;
317         phy-mode = "rgmii";
318         clock_in_out = "input";
319         snps,reset-gpio = <&gpio4 7 0>;
320         snps,reset-active-low;
321         snps,reset-delays-us = <0 10000 1000000>;
322         assigned-clocks = <&cru SCLK_MAC>;
323         assigned-clock-parents = <&ext_gmac>;
324         pinctrl-names = "default";
325         pinctrl-0 = <&rgmii_pins>;
326         tx_delay = <0x30>;
327         rx_delay = <0x10>;
328         status = "okay";
329 };
330
331 &hdmi {
332         #address-cells = <1>;
333         #size-cells = <0>;
334         #sound-dai-cells = <0>;
335         status = "okay";
336
337         /* Don't use vopl for HDMI */
338         ports {
339                 hdmi_in: port {
340                         /delete-node/ endpoint@1;
341                 };
342         };
343 };
344
345 &saradc {
346         vref-supply = <&vccadc_ref>;
347         status = "okay";
348 };
349
350 &sdmmc {
351         supports-sd;
352         bus-width = <4>;
353         cap-mmc-highspeed;
354         sd-uhs-sdr12;
355         sd-uhs-sdr25;
356         sd-uhs-sdr50;
357         sd-uhs-sdr104;
358         cap-sd-highspeed;
359         card-detect-delay = <200>;
360         disable-wp;                     /* wp not hooked up */
361         num-slots = <1>;
362         pinctrl-names = "default";
363         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
364         status = "okay";
365         vmmc-supply = <&vcc_sd>;
366         vqmmc-supply = <&vccio_sd>;
367         supports-sd;
368 };
369
370 &edp_phy {
371         status = "okay";
372 };
373
374 &edp {
375         force-hpd;
376         status = "okay";
377
378         ports {
379                 /* Don't use vopb for eDP */
380                 edp_in: port@0 {
381                         /delete-node/ endpoint@0;
382                 };
383
384                 edp_out: port@1 {
385                         reg = <1>;
386                         #address-cells = <1>;
387                         #size-cells = <0>;
388                         edp_out_panel: endpoint {
389                                 reg = <0>;
390                                 remote-endpoint = <&panel_in_edp>;
391                         };
392                 };
393         };
394 };
395
396 &hevc_service {
397         status = "okay";
398 };
399
400 &i2c0 {
401         status = "okay";
402 };
403
404 &i2c2 {
405         status = "okay";
406
407         rt5640: rt5640@1c {
408                 #sound-dai-cells = <0>;
409                 compatible = "realtek,rt5640";
410                 reg = <0x1c>;
411                 clocks = <&cru SCLK_I2S0_OUT>;
412                 clock-names = "mclk";
413                 interrupt-parent = <&gpio6>;
414                 interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
415         };
416 };
417
418 &i2s {
419         #sound-dai-cells = <0>;
420         status = "okay";
421 };
422
423 &io_domains {
424         status = "okay";
425
426         sdcard-supply = <&vccio_sd>;
427         wifi-supply = <&vcc_18>;
428 };
429
430 &wdt {
431         status = "okay";
432 };
433
434 &pwm0 {
435         status = "okay";
436 };
437
438 &rga {
439         status = "okay";
440 };
441
442 &sdio0 {
443         status = "okay";
444
445         clock-frequency = <50000000>;
446         clock-freq-min-max = <200000 50000000>;
447
448         bus-width = <4>;
449         cap-sd-highspeed;
450         cap-sdio-irq;
451         disable-wp;
452         keep-power-in-suspend;
453         mmc-pwrseq = <&sdio_pwrseq>;
454         non-removable;
455         num-slots = <1>;
456         pinctrl-names = "default";
457         pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk &sdio0_int>;
458         sd-uhs-sdr104;
459         supports-sdio;
460 };
461
462 &uart0 {
463         pinctrl-names = "default";
464         pinctrl-0 = <&uart0_xfer &uart0_cts>;
465         status = "okay";
466 };
467
468 &uart2 {
469         status = "okay";
470 };
471
472 &vpu_service {
473         status = "okay";
474 };
475
476 &tsadc {
477         rockchip,hw-tshut-mode = <0>; /* tshut mode 0:CRU 1:GPIO */
478         rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
479         status = "okay";
480 };
481
482 &usbphy {
483         status = "okay";
484 };
485
486 &usb_host0_ehci {
487         status = "okay";
488 };
489
490 &usb_host1 {
491         status = "okay";
492 };
493
494 &usb_otg {
495         status = "okay";
496 };
497
498 &lvds {
499         rockchip,data-mapping = "jeida";
500         rockchip,data-width = <24>;
501         rockchip,output = "lvds";
502         rockchip,panel = <&lvds_panel>;
503         status = "disabled";
504 };
505
506 &vopb {
507         status = "okay";
508
509         /* Don't use vopb for eDP, save it for HDMI */
510         vopb_out: port {
511                 /delete-node/ endpoint@1;
512         };
513 };
514
515 &vopb_mmu {
516         status = "okay";
517 };
518
519 &vopl {
520         status = "okay";
521
522         /* Don't use vopb for HDMI, save it for eDP */
523         vopl_out: port {
524                 /delete-node/ endpoint@0;
525         };
526 };
527
528 &vopl_mmu {
529         status = "okay";
530 };
531
532 &pinctrl {
533         pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
534                 drive-strength = <8>;
535         };
536
537         pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
538                 bias-pull-up;
539                 drive-strength = <8>;
540         };
541
542         backlight {
543                 bl_en: bl-en {
544                         rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
545                 };
546         };
547
548         buttons {
549                 pwrbtn: pwrbtn {
550                         rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
551                 };
552         };
553
554         pmic {
555                 pmic_int: pmic-int {
556                         rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
557                 };
558         };
559
560         sdio-pwrseq {
561                 wifi_enable_h: wifi-enable-h {
562                         rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
563                 };
564         };
565
566         sdmmc {
567                 /*
568                  * Default drive strength isn't enough to achieve even
569                  * high-speed mode on EVB board so bump up to 8ma.
570                  */
571                 sdmmc_bus4: sdmmc-bus4 {
572                         rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
573                                         <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
574                                         <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
575                                         <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
576                 };
577
578                 sdmmc_clk: sdmmc-clk {
579                         rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
580                 };
581
582                 sdmmc_cmd: sdmmc-cmd {
583                         rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
584                 };
585
586                 sdmmc_pwr: sdmmc-pwr {
587                         rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
588                 };
589         };
590
591         usb {
592                 host_vbus_drv: host-vbus-drv {
593                         rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
594                 };
595
596                 pwr_3g: pwr-3g {
597                         rockchip,pins = <7 8 RK_FUNC_GPIO &pcfg_pull_none>;
598                 };
599         };
600
601         eth_phy {
602                 eth_phy_pwr: eth-phy-pwr {
603                         rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
604                 };
605         };
606
607         lcd {
608                 lcd_cs: lcd-cs {
609                         rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_none>;
610                 };
611         };
612
613         wireless-bluetooth {
614                 uart0_gpios: uart0-gpios {
615                         rockchip,pins = <4 19 RK_FUNC_GPIO &pcfg_pull_none>;
616                 };
617         };
618 };