hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
 */
 
/dts-v1/;
 
#include "rv1106.dtsi"
#include "rv1106-evb-v10.dtsi"
#include "dt-bindings/display/media-bus-format.h"
#include "rv1106-thunder-boot-emmc.dtsi"
 
/ {
   model = "Rockchip RV1106G EVB2 V11 Trailcam Board";
   compatible = "rockchip,rv1106g-evb2-v11-trailcam-emmc", "rockchip,rv1106";
 
   chosen {
       bootargs = "loglevel=0 rootfstype=erofs rootflags=dax console=ttyFIQ0 root=/dev/rd0 snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0 driver_async_probe=dwmmc_rockchip";
   };
 
   /delete-node/ adc-keys;
   adc-keys {
       compatible = "adc-keys";
       io-channels = <&saradc 0>;
       io-channel-names = "buttons";
       poll-interval = <100>;
       keyup-threshold-microvolt = <901715>;
 
       key_volumeup-key {
           label = "key_volumeup";
           linux,code = <KEY_VOLUMEUP>;
           press-threshold-microvolt = <17578>;
       };
   };
 
   backlight: backlight {
       status = "okay";
       compatible = "pwm-backlight";
       pwms = <&pwm7 0 25000 0>;
       brightness-levels = <
             0   1   2   3   4   5   6   7
             8   9  10  11  12  13  14  15
            16  17  18  19  20  21  22  23
            24  25  26  27  28  29  30  31
            32  33  34  35  36  37  38  39
            40  41  42  43  44  45  46  47
            48  49  50  51  52  53  54  55
            56  57  58  59  60  61  62  63
            64  65  66  67  68  69  70  71
            72  73  74  75  76  77  78  79
            80  81  82  83  84  85  86  87
            88  89  90  91  92  93  94  95
            96  97  98  99 100 101 102 103
           104 105 106 107 108 109 110 111
           112 113 114 115 116 117 118 119
           120 121 122 123 124 125 126 127
           128 129 130 131 132 133 134 135
           136 137 138 139 140 141 142 143
           144 145 146 147 148 149 150 151
           152 153 154 155 156 157 158 159
           160 161 162 163 164 165 166 167
           168 169 170 171 172 173 174 175
           176 177 178 179 180 181 182 183
           184 185 186 187 188 189 190 191
           192 193 194 195 196 197 198 199
           200 201 202 203 204 205 206 207
           208 209 210 211 212 213 214 215
           216 217 218 219 220 221 222 223
           224 225 226 227 228 229 230 231
           232 233 234 235 236 237 238 239
           240 241 242 243 244 245 246 247
           248 249 250 251 252 253 254 255>;
       default-brightness-level = <200>;
   };
 
   gpio-keys {
       compatible = "gpio-keys";
       autorepeat;
 
       key {
           gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
           linux,code = <KEY_VOLUMEDOWN>;
           label = "GPIO Key";
           debounce-interval = <100>;
       };
   };
 
   reserved-memory {
       #address-cells = <1>;
       #size-cells = <1>;
       ranges;
/*
       linux,cma {
           compatible = "shared-dma-pool";
           inactive;
           reusable;
           size = <0x300000>;
           linux,cma-default;
       };
*/
       drm_logo: drm-logo@00000000 {
           compatible = "rockchip,drm-logo";
           reg = <0x0 0x0>;
       };
   };
 
   vcc_1v8: vcc-1v8 {
       compatible = "regulator-fixed";
       regulator-name = "vcc_1v8";
       regulator-always-on;
       regulator-boot-on;
       regulator-min-microvolt = <1800000>;
       regulator-max-microvolt = <1800000>;
   };
 
   vcc_3v3: vcc-3v3 {
       compatible = "regulator-fixed";
       regulator-name = "vcc_3v3";
       regulator-always-on;
       regulator-boot-on;
       regulator-min-microvolt = <3300000>;
       regulator-max-microvolt = <3300000>;
   };
 
   vcc3v3_sd: vcc3v3-sd {
       compatible = "regulator-fixed";
       gpio = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>;
       regulator-name = "vcc3v3_sd";
       regulator-min-microvolt = <3300000>;
       regulator-max-microvolt = <3300000>;
       pinctrl-names = "default";
       pinctrl-0 = <&sdmmc_pwren>;
   };
 
   wireless_wlan: wireless-wlan {
       compatible = "wlan-platdata";
       WIFI,host_wake_irq = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>;
       status = "okay";
   };
};
 
&acodec {
   pa-ctl-gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_HIGH>;
};
 
&csi2_dphy_hw {
   status = "okay";
};
 
&csi2_dphy0 {
   status = "okay";
 
   ports {
       #address-cells = <1>;
       #size-cells = <0>;
 
       port@0 {
           reg = <0>;
           #address-cells = <1>;
           #size-cells = <0>;
 
           csi_dphy_input0: endpoint@0 {
               reg = <0>;
               remote-endpoint = <&sc3338_out>;
               data-lanes = <1 2>;
           };
       };
 
       port@1 {
           reg = <1>;
           #address-cells = <1>;
           #size-cells = <0>;
 
           csi_dphy_output: endpoint@0 {
               reg = <0>;
               remote-endpoint = <&mipi_csi2_input>;
           };
       };
   };
};
 
&display_subsystem {
   status = "okay";
   logo-memory-region = <&drm_logo>;
};
 
&emmc {
   status = "okay";
};
 
&fiq_debugger {
   rockchip,baudrate = <1500000>;
   pinctrl-names = "default";
   pinctrl-0 = <&uart2m1_xfer>;
};
 
&i2c4 {
   rockchip,amp-shared;
 
   sc3338: sc3338@30 {
       compatible = "smartsens,sc3338";
       status = "okay";
       reg = <0x30>;
       clocks = <&cru MCLK_REF_MIPI0>;
       clock-names = "xvclk";
       pwdn-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
       pinctrl-names = "default";
       pinctrl-0 = <&mipi_refclk_out0>;
       rockchip,camera-module-index = <0>;
       rockchip,camera-module-facing = "back";
       rockchip,camera-module-name = "FKO1";
       rockchip,camera-module-lens-name = "30IRC-F16";
       port {
           sc3338_out: endpoint {
               remote-endpoint = <&csi_dphy_input0>;
               data-lanes = <1 2>;
           };
       };
   };
};
 
&mipi0_csi2 {
   status = "okay";
 
   ports {
       #address-cells = <1>;
       #size-cells = <0>;
 
       port@0 {
           reg = <0>;
           #address-cells = <1>;
           #size-cells = <0>;
 
           mipi_csi2_input: endpoint@1 {
               reg = <1>;
               remote-endpoint = <&csi_dphy_output>;
           };
       };
 
       port@1 {
           reg = <1>;
           #address-cells = <1>;
           #size-cells = <0>;
 
           mipi_csi2_output: endpoint@0 {
               reg = <0>;
               remote-endpoint = <&cif_mipi_in>;
           };
       };
   };
};
 
&mailbox {
   status = "okay";
};
 
&pwm7 {
   status = "okay";
   pinctrl-names = "active";
   pinctrl-0 = <&pwm7m1_pins>;
};
 
&pinctrl {
   sdmmc {
       /omit-if-no-ref/
       sdmmc_pwren: sdmmc-pwren {
           rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
       };
   };
};
 
&pwm10 {
   status = "okay";
};
 
&pwm11 {
   status = "okay";
};
 
&rgb {
   status = "okay";
   rockchip,data-sync-bypass;
   pinctrl-names = "default";
   /*
    * rgb3x8_pins for RGB3x8(8bit)
    * rgb565_pins for RGB565(16bit)
    */
   pinctrl-0 = <&rgb3x8_pins>;
 
   /*
    * 320x480 RGB/MCU screen K350C4516T
    */
   mcu_panel: mcu-panel {
       /*
        * MEDIA_BUS_FMT_RGB888_3X8  for RGB3x8(8bit)
        * MEDIA_BUS_FMT_RGB565_1X16 for RGB565(16bit)
        */
       bus-format = <MEDIA_BUS_FMT_RGB888_3X8>;
       backlight = <&backlight>;
       enable-gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>;
       enable-delay-ms = <20>;
       reset-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_LOW>;
       reset-delay-ms = <10>;
       prepare-delay-ms = <20>;
       unprepare-delay-ms = <20>;
       disable-delay-ms = <20>;
       init-delay-ms = <10>;
       width-mm = <217>;
       height-mm = <136>;
 
       // type:0 is cmd, 1 is data
       panel-init-sequence = [
           //type delay num val1 val2 val3
             00   00  01  e0
             01   00  01  00
             01   00  01  07
             01   00  01  0f
             01   00  01  0d
             01   00  01  1b
             01   00  01  0a
             01   00  01  3c
 
             01   00  01  78
             01   00  01  4a
             01   00  01  07
             01   00  01  0e
             01   00  01  09
             01   00  01  1b
             01   00  01  1e
             01   00  01  0f
 
             00   00  01  e1
             01   00  01  00
             01   00  01  22
             01   00  01  24
             01   00  01  06
             01   00  01  12
             01   00  01  07
             01   00  01  36
 
             01   00  01  47
             01   00  01  47
             01   00  01  06
             01   00  01  0a
             01   00  01  07
             01   00  01  30
             01   00  01  37
             01   00  01  0f
 
             00   00  01  c0
             01   00  01  10
             01   00  01  10
 
             00   00  01  c1
             01   00  01  41
 
             00   00  01  c5
             01   00  01  00
             01   00  01  22
             01   00  01  80
 
             00   00  01  36
             01   00  01  48
 
             00   00  01  3a
             01   00  01  66 /*
                      * interface pixel format:
                      * 66 for RGB3x8(8bit)
                      * 55 for RGB565(16bit)
                      */
 
             00   00  01  b0
             01   00  01  00
 
             00   00  01  b1
             01   00  01  70 /*
                      * frame rate control:
                      * 70 (45hz) for RGB3x8(8bit)
                      * a0 (60hz) for RGB565(16bit)
                      */
             01   00  01  11
             00   00  01  b4
             01   00  01  02
             00   00  01  B6
             01   00  01  02 /*
                      * display function control:
                      * 32 for RGB
                      * 02 for MCU
                      */
             01   00  01  02
 
             00   00  01  b7
             01   00  01  c6
 
             00   00  01  be
             01   00  01  00
             01   00  01  04
 
             00   00  01  e9
             01   00  01  00
 
             00   00  01  f7
             01   00  01  a9
             01   00  01  51
             01   00  01  2c
             01   00  01  82
 
             00   78  01  11
             00   32  01  29
             00   00  01  2c
       ];
 
       panel-exit-sequence = [
           //type delay num val1 val2 val3
           00   0a  01  28
           00   78  01  10
       ];
 
       display-timings {
           native-mode = <&kd050fwfba002_timing>;
 
           kd050fwfba002_timing: timing0 {
               /*
                * 7840125  for frame rate 45Hz
                * 10453500 for frame rate 60Hz
                */
               clock-frequency = <7840125>;
               hactive = <320>;
               vactive = <480>;
               hback-porch = <10>;
               hfront-porch = <5>;
               vback-porch = <10>;
               vfront-porch = <5>;
               hsync-len = <10>;
               vsync-len = <10>;
               hsync-active = <0>;
               vsync-active = <0>;
               de-active = <0>;
               pixelclk-active = <1>;
           };
       };
 
       port {
           panel_in_rgb: endpoint {
               remote-endpoint = <&rgb_out_panel>;
           };
       };
   };
 
   ports {
       rgb_out: port@1 {
           reg = <1>;
           #address-cells = <1>;
           #size-cells = <0>;
 
           rgb_out_panel: endpoint@0 {
               reg = <0>;
               remote-endpoint = <&panel_in_rgb>;
           };
       };
   };
};
 
&rgb_in_vop {
   status = "okay";
};
 
&route_rgb {
   status = "disabled";
};
 
/*
 * The pins of sdmmc1 and lcd are multiplexed
 */
&sdio {
   status = "disabled";
};
 
&saradc {
   status = "okay";
   vref-supply = <&vcc_1v8>;
};
 
&thunder_boot_service {
   status = "okay";
};
 
&rkisp_thunderboot {
   /* reg's offset MUST match with RTOS */
   /*
    * vicap, capture raw10, ceil(w*10/8/256)*256*h *4(buf num)
    * e.g. 2304x1296: 0xf30000
    */
   reg = <0x00860000 0xf30000>;
};
 
&ramdisk_r {
   reg = <0x1790000 (20 * 0x00100000)>;
};
 
&ramdisk_c {
   reg = <0x2b90000 (10 * 0x00100000)>;
};
 
&rkcif {
   status = "okay";
};
 
&rkcif_mipi_lvds {
   status = "okay";
   memory-region-thunderboot = <&rkisp_thunderboot>;
 
   pinctrl-names = "default";
   pinctrl-0 = <&mipi_pins>;
   port {
       /* MIPI CSI-2 endpoint */
       cif_mipi_in: endpoint {
           remote-endpoint = <&mipi_csi2_output>;
       };
   };
};
 
&rkcif_mipi_lvds_sditf {
   status = "okay";
 
   port {
       /* MIPI CSI-2 endpoint */
       mipi_lvds_sditf: endpoint {
           remote-endpoint = <&isp_in>;
       };
   };
};
 
&rkisp {
   status = "okay";
};
 
&rkisp_vir0 {
   status = "okay";
 
   port@0 {
       isp_in: endpoint {
           remote-endpoint = <&mipi_lvds_sditf>;
       };
   };
};
 
&sdio {
   max-frequency = <50000000>;
   bus-width = <1>;
   cap-sd-highspeed;
   cap-sdio-irq;
   keep-power-in-suspend;
   non-removable;
   rockchip,default-sample-phase = <90>;
   no-sd;
   no-mmc;
   supports-sdio;
   pinctrl-names = "default";
   pinctrl-0 = <&sdmmc1m0_cmd &sdmmc1m0_clk &sdmmc1m0_bus4>;
   status = "okay";
};
 
&sdmmc {
   max-frequency = <200000000>;
   no-sdio;
   no-mmc;
   bus-width = <4>;
   cap-mmc-highspeed;
   cap-sd-highspeed;
   disable-wp;
   pinctrl-names = "normal",  "idle";
   pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_bus4>;
   pinctrl-1 = <&sdmmc0_idle_pins &sdmmc0_det>;
   vmmc-supply = <&vcc3v3_sd>;
   status = "okay";
};
 
&sfc {
   assigned-clocks = <&cru SCLK_SFC>;
   assigned-clock-rates = <125000000>;
   status = "disabled";
 
   flash@0 {
       compatible = "jedec,spi-nor";
       reg = <0>;
       spi-max-frequency = <125000000>;
       spi-rx-bus-width = <4>;
       spi-tx-bus-width = <1>;
   };
};
 
&usbdrd_dwc3 {
   dr_mode = "peripheral";
};
 
&vop {
   status = "okay";
 
   /*
    * Default config is as follows:
    *
    * mcu-pix-total = <9>;
    * mcu-cs-pst = <1>;
    * mcu-cs-pend = <8>;
    * mcu-rw-pst = <2>;
    * mcu-rw-pend = <5>;
    * mcu-hold-mode = <0>; // default set to 0
    *
    * To increase the frame rate, reduce all parameters because
    * the max dclk rate of mcu is 150M in rv1103/rv1106.
    */
   mcu-timing {
       mcu-pix-total = <5>;
       mcu-cs-pst = <1>;
       mcu-cs-pend = <4>;
       mcu-rw-pst = <2>;
       mcu-rw-pend = <3>;
 
       mcu-hold-mode = <0>; // default set to 0
   };
};