arm64: dts: set right backlight pwm polarity for rk3399-tb
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / boot / dts / rockchip / rk3399-tb.dtsi
1 /*
2  * Copyright (c) 2016 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 "rk3399.dtsi"
45
46 / {
47         compatible = "rockchip,tb", "rockchip,rk3399";
48
49         vdd_log: vdd-log {
50                 compatible = "pwm-regulator";
51                 pwms = <&pwm2 0 1000>;
52                 regulator-name = "vdd_log";
53                 regulator-min-microvolt = <800000>;
54                 regulator-max-microvolt = <1400000>;
55                 regulator-always-on;
56                 status = "okay";
57         };
58
59         vdd_center: vdd-center {
60                 compatible = "pwm-regulator";
61                 pwms = <&pwm3 0 1000>;
62                 regulator-name = "vdd_center";
63                 regulator-min-microvolt = <800000>;
64                 regulator-max-microvolt = <1400000>;
65                 regulator-always-on;
66                 status = "okay";
67         };
68
69         vcc3v3_sys: vcc3v3-sys {
70                 compatible = "regulator-fixed";
71                 regulator-name = "vcc3v3_sys";
72                 regulator-always-on;
73                 regulator-boot-on;
74                 regulator-min-microvolt = <3300000>;
75                 regulator-max-microvolt = <3300000>;
76         };
77
78         backlight: backlight {
79                 compatible = "pwm-backlight";
80                 pwms = <&pwm0 0 25000 0>;
81                 brightness-levels = <
82                           0   1   2   3   4   5   6   7
83                           8   9  10  11  12  13  14  15
84                          16  17  18  19  20  21  22  23
85                          24  25  26  27  28  29  30  31
86                          32  33  34  35  36  37  38  39
87                          40  41  42  43  44  45  46  47
88                          48  49  50  51  52  53  54  55
89                          56  57  58  59  60  61  62  63
90                          64  65  66  67  68  69  70  71
91                          72  73  74  75  76  77  78  79
92                          80  81  82  83  84  85  86  87
93                          88  89  90  91  92  93  94  95
94                          96  97  98  99 100 101 102 103
95                         104 105 106 107 108 109 110 111
96                         112 113 114 115 116 117 118 119
97                         120 121 122 123 124 125 126 127
98                         128 129 130 131 132 133 134 135
99                         136 137 138 139 140 141 142 143
100                         144 145 146 147 148 149 150 151
101                         152 153 154 155 156 157 158 159
102                         160 161 162 163 164 165 166 167
103                         168 169 170 171 172 173 174 175
104                         176 177 178 179 180 181 182 183
105                         184 185 186 187 188 189 190 191
106                         192 193 194 195 196 197 198 199
107                         200 201 202 203 204 205 206 207
108                         208 209 210 211 212 213 214 215
109                         216 217 218 219 220 221 222 223
110                         224 225 226 227 228 229 230 231
111                         232 233 234 235 236 237 238 239
112                         240 241 242 243 244 245 246 247
113                         248 249 250 251 252 253 254 255>;
114                 default-brightness-level = <200>;
115                 enable-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
116         };
117
118         ext_gmac: external-gmac-clock {
119                 compatible = "fixed-clock";
120                 clock-frequency = <125000000>;
121                 clock-output-names = "ext_gmac";
122                 #clock-cells = <0>;
123         };
124
125         vcc_phy: vcc-phy-regulator {
126                 compatible = "regulator-fixed";
127                 regulator-name = "vcc_phy";
128                 regulator-always-on;
129                 regulator-boot-on;
130         };
131
132         io-domains {
133                 compatible = "rockchip,rk3399-io-voltage-domain";
134                 rockchip,grf = <&grf>;
135
136                 bt656-supply = <&vcc1v8_dvp>;
137                 audio-supply = <&vcca1v8_codec>;
138                 sdmmc-supply = <&vcc_sd>;
139                 gpio1830-supply = <&vcc_3v0>;
140         };
141
142         pmu-io-domains {
143                 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
144                 rockchip,grf = <&pmugrf>;
145
146                 pmu1830-supply = <&vcc1v8_pmu>;
147         };
148
149         es8316-sound {
150                 compatible = "simple-audio-card";
151                 simple-audio-card,format = "i2s";
152                 simple-audio-card,name = "rockchip,es8316-codec";
153                 simple-audio-card,mclk-fs = <256>;
154                 simple-audio-card,widgets =
155                         "Microphone", "Mic Jack",
156                         "Headphone", "Headphone Jack";
157                 simple-audio-card,routing =
158                         "Mic Jack", "MICBIAS1",
159                         "IN1P", "Mic Jack",
160                         "Headphone Jack", "HPOL",
161                         "Headphone Jack", "HPOR";
162                 simple-audio-card,cpu {
163                         sound-dai = <&i2s0>;
164                 };
165                 simple-audio-card,codec {
166                         sound-dai = <&es8316>;
167                 };
168         };
169
170         spdif-sound {
171                 compatible = "simple-audio-card";
172                 simple-audio-card,name = "rockchip,spdif";
173                 simple-audio-card,cpu {
174                         sound-dai = <&spdif>;
175                 };
176                 simple-audio-card,codec {
177                         sound-dai = <&spdif_out>;
178                 };
179         };
180
181         spdif_out: spdif-out {
182                 compatible = "linux,spdif-dit";
183                 #sound-dai-cells = <0>;
184         };
185 };
186
187 &sdmmc {
188         clock-frequency = <37500000>;
189         clock-freq-min-max = <400000 37500000>;
190         supports-sd;
191         bus-width = <4>;
192         cap-mmc-highspeed;
193         cap-sd-highspeed;
194         disable-wp;
195         num-slots = <1>;
196         pinctrl-names = "default";
197         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
198         status = "disabled";
199 };
200
201 &sdio0 {
202         clock-frequency = <37500000>;
203         clock-freq-min-max = <200000 37500000>;
204         supports-sdio;
205         bus-width = <4>;
206         disable-wp;
207         cap-sd-highspeed;
208         cap-sdio-irq;
209         keep-power-in-suspend;
210         //mmc-pwrseq = <&sdio_pwrseq>;
211         non-removable;
212         num-slots = <1>;
213         pinctrl-names = "default";
214         pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
215         sd-uhs-sdr104;
216         status = "disabled";
217 };
218
219 &emmc_phy {
220         status = "okay";
221 };
222
223 &sdhci {
224         bus-width = <8>;
225         supports-emmc;
226         non-removable;
227         max-frequency = <50000000>;
228         status = "okay";
229 };
230
231 &i2s0 {
232         status = "okay";
233         rockchip,i2s-broken-burst-len;
234         rockchip,playback-channels = <8>;
235         rockchip,capture-channels = <8>;
236         #sound-dai-cells = <0>;
237 };
238
239 &spdif {
240         status = "okay";
241         #sound-dai-cells = <0>;
242 };
243
244 &i2c0 {
245         status = "okay";
246         i2c-scl-rising-time-ns = <450>;
247         i2c-scl-falling-time-ns = <15>;
248
249         mp8865: mp8865@68 {
250                 compatible = "mps,mp8865";
251                 reg = <0x68>;
252                 status = "okay";
253                 regulators {
254                         vdd_gpu: mp8865_dcdc1 {
255                                 regulator-name = "vdd_gpu";
256                                 regulator-min-microvolt = <712500>;
257                                 regulator-max-microvolt = <1500000>;
258                                 regulator-always-on;
259                                 regulator-boot-on;
260                         };
261                 };
262         };
263
264         rk808: pmic@1b {
265                 compatible = "rockchip,rk808";
266                 reg = <0x1b>;
267                 interrupt-parent = <&gpio1>;
268                 interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
269                 pinctrl-names = "default";
270                 pinctrl-0 = <&pmic_int_l>;
271                 rockchip,system-power-controller;
272                 wakeup-source;
273                 #clock-cells = <1>;
274                 clock-output-names = "xin32k", "rk808-clkout2";
275
276                 vcc1-supply = <&vcc3v3_sys>;
277                 vcc2-supply = <&vcc3v3_sys>;
278                 vcc3-supply = <&vcc3v3_sys>;
279                 vcc4-supply = <&vcc3v3_sys>;
280                 vcc6-supply = <&vcc3v3_sys>;
281                 vcc7-supply = <&vcc3v3_sys>;
282                 vcc8-supply = <&vcc3v3_sys>;
283                 vcc9-supply = <&vcc3v3_sys>;
284                 vcc10-supply = <&vcc3v3_sys>;
285                 vcc11-supply = <&vcc3v3_sys>;
286                 vcc12-supply = <&vcc3v3_sys>;
287                 vddio-supply = <&vcc1v8_pmu>;
288
289                 regulators {
290                         vdd_cpu_b: DCDC_REG1 {
291                                 regulator-always-on;
292                                 regulator-boot-on;
293                                 regulator-min-microvolt = <750000>;
294                                 regulator-max-microvolt = <1350000>;
295                                 regulator-name = "vdd_cpu_b";
296                                 regulator-state-mem {
297                                         regulator-off-in-suspend;
298                                 };
299                         };
300
301                         vdd_cpu_l: DCDC_REG2 {
302                                 regulator-always-on;
303                                 regulator-boot-on;
304                                 regulator-min-microvolt = <750000>;
305                                 regulator-max-microvolt = <1350000>;
306                                 regulator-name = "vdd_cpu_l";
307                                 regulator-state-mem {
308                                         regulator-off-in-suspend;
309                                 };
310                         };
311
312                         vcc_ddr: DCDC_REG3 {
313                                 regulator-always-on;
314                                 regulator-boot-on;
315                                 regulator-name = "vcc_ddr";
316                                 regulator-state-mem {
317                                         regulator-on-in-suspend;
318                                 };
319                         };
320
321                         vcc_1v8: DCDC_REG4 {
322                                 regulator-always-on;
323                                 regulator-boot-on;
324                                 regulator-min-microvolt = <1800000>;
325                                 regulator-max-microvolt = <1800000>;
326                                 regulator-name = "vcc_1v8";
327                                 regulator-state-mem {
328                                         regulator-on-in-suspend;
329                                         regulator-suspend-microvolt = <1800000>;
330                                 };
331                         };
332
333                         vcc1v8_dvp: LDO_REG1 {
334                                 regulator-always-on;
335                                 regulator-boot-on;
336                                 regulator-min-microvolt = <1800000>;
337                                 regulator-max-microvolt = <1800000>;
338                                 regulator-name = "vcc1v8_dvp";
339                                 regulator-state-mem {
340                                         regulator-on-in-suspend;
341                                         regulator-suspend-microvolt = <1800000>;
342                                 };
343                         };
344
345                         vcc3v0_tp: LDO_REG2 {
346                                 regulator-always-on;
347                                 regulator-boot-on;
348                                 regulator-min-microvolt = <3000000>;
349                                 regulator-max-microvolt = <3000000>;
350                                 regulator-name = "vcc3v0_tp";
351                                 regulator-state-mem {
352                                         regulator-off-in-suspend;
353                                 };
354                         };
355
356                         vcc1v8_pmu: LDO_REG3 {
357                                 regulator-always-on;
358                                 regulator-boot-on;
359                                 regulator-min-microvolt = <1800000>;
360                                 regulator-max-microvolt = <1800000>;
361                                 regulator-name = "vcc1v8_pmu";
362                                 regulator-state-mem {
363                                         regulator-on-in-suspend;
364                                         regulator-suspend-microvolt = <1800000>;
365                                 };
366                         };
367
368                         vcc_sd: LDO_REG4 {
369                                 regulator-always-on;
370                                 regulator-boot-on;
371                                 regulator-min-microvolt = <1800000>;
372                                 regulator-max-microvolt = <3300000>;
373                                 regulator-name = "vcc_sd";
374                                 regulator-state-mem {
375                                         regulator-on-in-suspend;
376                                         regulator-suspend-microvolt = <3300000>;
377                                 };
378                         };
379
380                         vcca3v0_codec: LDO_REG5 {
381                                 regulator-always-on;
382                                 regulator-boot-on;
383                                 regulator-min-microvolt = <3000000>;
384                                 regulator-max-microvolt = <3000000>;
385                                 regulator-name = "vcca3v0_codec";
386                                 regulator-state-mem {
387                                         regulator-on-in-suspend;
388                                         regulator-suspend-microvolt = <3000000>;
389                                 };
390                         };
391
392                         vcc_1v5: LDO_REG6 {
393                                 regulator-always-on;
394                                 regulator-boot-on;
395                                 regulator-min-microvolt = <1500000>;
396                                 regulator-max-microvolt = <1500000>;
397                                 regulator-name = "vcc_1v5";
398                                 regulator-state-mem {
399                                         regulator-on-in-suspend;
400                                         regulator-suspend-microvolt = <1500000>;
401                                 };
402                         };
403
404                         vcca1v8_codec: LDO_REG7 {
405                                 regulator-always-on;
406                                 regulator-boot-on;
407                                 regulator-min-microvolt = <1800000>;
408                                 regulator-max-microvolt = <1800000>;
409                                 regulator-name = "vcca1v8_codec";
410                                 regulator-state-mem {
411                                         regulator-on-in-suspend;
412                                         regulator-suspend-microvolt = <1800000>;
413                                 };
414                         };
415
416                         vcc_3v0: LDO_REG8 {
417                                 regulator-always-on;
418                                 regulator-boot-on;
419                                 regulator-min-microvolt = <3000000>;
420                                 regulator-max-microvolt = <3000000>;
421                                 regulator-name = "vcc_3v0";
422                                 regulator-state-mem {
423                                         regulator-on-in-suspend;
424                                         regulator-suspend-microvolt = <3000000>;
425                                 };
426                         };
427
428                         vcc3v3_s3: SWITCH_REG1 {
429                                 regulator-always-on;
430                                 regulator-boot-on;
431                                 regulator-name = "vcc3v3_s3";
432                                 regulator-state-mem {
433                                         regulator-on-in-suspend;
434                                 };
435                         };
436
437                         vcc3v3_s0: SWITCH_REG2 {
438                                 regulator-always-on;
439                                 regulator-boot-on;
440                                 regulator-name = "vcc3v3_s0";
441                                 regulator-state-mem {
442                                         regulator-on-in-suspend;
443                                 };
444                         };
445                 };
446         };
447 };
448
449 &i2c4 {
450         status = "okay";
451         i2c-scl-rising-time-ns = <600>;
452         i2c-scl-falling-time-ns = <20>;
453
454         gt9xx: gt9xx@14 {
455                 compatible = "goodix,gt9xx";
456                 reg = <0x14>;
457                 touch-gpio = <&gpio1 20 IRQ_TYPE_LEVEL_LOW>;
458                 reset-gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>;
459                 max-x = <1200>;
460                 max-y = <1900>;
461                 tp-size = <911>;
462                 tp-supply = <&vcc3v0_tp>;
463                 status = "disabled";
464         };
465 };
466
467 &i2c1 {
468         status = "okay";
469         i2c-scl-rising-time-ns = <300>;
470         i2c-scl-falling-time-ns = <15>;
471
472         es8316: es8316@10 {
473                 #sound-dai-cells = <0>;
474                 compatible = "everest,es8316";
475                 reg = <0x10>;
476                 clocks = <&cru SCLK_I2S_8CH_OUT>;
477                 clock-names = "mclk";
478                 spk-con-gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
479                 hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_LOW>;
480         };
481 };
482
483 &pwm2 {
484         status = "okay";
485 };
486
487 &pwm3 {
488         status = "okay";
489 };
490
491 &tsadc {
492         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
493         rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
494         status = "okay";
495 };
496
497 &uart2 {
498         status = "okay";
499 };
500
501 &usb_host0_echi {
502         status = "okay";
503 };
504
505 &usb_host0_ohci {
506         status = "okay";
507 };
508
509 &usb_host1_echi {
510         status = "okay";
511 };
512
513 &usb_host1_ohci {
514         status = "okay";
515 };
516
517 &usbdrd3_0 {
518         status = "okay";
519 };
520
521 &usbdrd_dwc3_0 {
522         status = "okay";
523 };
524
525 &usbdrd3_1 {
526         status = "okay";
527 };
528
529 &usbdrd_dwc3_1 {
530         status = "okay";
531 };
532
533 &pwm0 {
534         status = "okay";
535 };
536
537 &cpu_l0 {
538         cpu-supply = <&vdd_cpu_l>;
539 };
540
541 &cpu_l1 {
542         cpu-supply = <&vdd_cpu_l>;
543 };
544
545 &cpu_l2 {
546         cpu-supply = <&vdd_cpu_l>;
547 };
548
549 &cpu_l3 {
550         cpu-supply = <&vdd_cpu_l>;
551 };
552
553 &cpu_b0 {
554         cpu-supply = <&vdd_cpu_b>;
555 };
556
557 &cpu_b1 {
558         cpu-supply = <&vdd_cpu_b>;
559 };
560
561 &gmac {
562         phy-supply = <&vcc_phy>;
563         phy-mode = "rgmii";
564         clock_in_out = "input";
565         snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>;
566         snps,reset-active-low;
567         snps,reset-delays-us = <0 10000 50000>;
568         assigned-clocks = <&cru SCLK_MAC>;
569         assigned-clock-parents = <&ext_gmac>;
570         pinctrl-names = "default";
571         pinctrl-0 = <&rgmii_pins>;
572         tx_delay = <0x30>;
573         rx_delay = <0x10>;
574         status = "disabled";
575 };
576
577 &gpu {
578         mali-supply = <&vdd_gpu>;
579         status = "okay";
580 };