hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
add eDP LVDS PCIE WIFI6
20 files added
7 files modified
1889 ■■■■■ changed files
kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi 176 ●●●● patch | view | raw | blame | history
kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi 28 ●●●●● patch | view | raw | blame | history
kernel/arch/arm64/boot/dts/rockchip/rk3568.dtsi 10 ●●●● patch | view | raw | blame | history
kernel/drivers/misc/nkio/nk_io_core.c 102 ●●●● patch | view | raw | blame | history
kernel/drivers/misc/nkio/nkio.h 2 ●●● patch | view | raw | blame | history
lcdparamservice/chglcd.sh 28 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/10.1_LVDS_1280x800 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/12.1_LVDS_1024x768 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/15_LVDS_1024X768 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/17_LVDS_1280x1024 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/18.5_LVDS_1366x768 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/19_LVDS_1280x1024 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/19_LVDS_1400x900 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/21.5_LVDS_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/21.8_LVDS_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/23.8_LVDS_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/LVDS/8_LVDS_800x600 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/eDP/12.5_eDP_1366x768 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/eDP/12.5_eDP_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/eDP/13.3_eDP_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/eDP/15.6_eDP_1920x1080 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcd_parameters/eDP/15.6_eDP_1920x1080_NV156FHM 25 ●●●●● patch | view | raw | blame | history
lcdparamservice/lcdparamservice patch | view | raw | blame | history
lcdparamservice/lcdparamservice.c 547 ●●●●● patch | view | raw | blame | history
rtl8852be @ 68212c patch | view | raw | blame | history
u-boot/arch/arm/mach-rockchip/kernel_dtb.c 497 ●●●●● patch | view | raw | blame | history
u-boot/drivers/video/drm/rockchip_panel.c 99 ●●●●● patch | view | raw | blame | history
kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi
....@@ -8,6 +8,7 @@
88
99 #include <dt-bindings/gpio/gpio.h>
1010 #include <dt-bindings/pinctrl/rockchip.h>
11
+#include <dt-bindings/display/media-bus-format.h>
1112 #include "rk3568.dtsi"
1213 #include "rk3568-evb.dtsi"
1314
....@@ -58,7 +59,9 @@
5859 regulator-name = "vcc3v3_pcie";
5960 regulator-min-microvolt = <3300000>;
6061 regulator-max-microvolt = <3300000>;
62
+ regulator-always-on;
6163 enable-active-high;
64
+ regulator-boot-on;
6265 gpio = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
6366 startup-delay-us = <5000>;
6467 vin-supply = <&dc_12v>;
....@@ -88,13 +91,9 @@
8891
8992 nk_io_init {
9093 compatible = "nk_io_control";
91
-// usb_en_oc_gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; //USB_EN_OC_GPIO0_A5
92
- lcd_bk_en_gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; //LCD0_BKLT_EN_3V3
93
- lcd_pwblk_gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; //LCD0_BKLT_EN_3V3
9494 vcc3_io_en_gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; //VCC3_IO_EN_GPIO0_C4_3V3
9595 hub_host2_5V_rest_gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; //HUB_RST_GPIO4_D2_3V3
9696 hub_host3_5v_gpio = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>; //HOST3_EN_GPIO4_B2_1V8
97
-// hub_host3_5V_rest_gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
9897 vcc_5v_io = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>; //VCC5_IO_EN_GPIO1_A4_3V3
9998 vcc_12v_io = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; //VCC12_IO_EN_GPIO0_C7_3V3
10099 en_4g_gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; //4G_PWREN_H_GPIO0_C6
....@@ -102,23 +101,55 @@
102101 air_mode_4g_gpio = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; //4G_AIR_MODE_GPIO01_B0_3V3
103102 wake_4g_gpio = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>; //4G_WAKEUP_GPIO01_B1_3V3
104103 hp_en_gpio = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;//HP_EN_GPIO3_A6_3V3
105
- spk_out_gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;//AMP_SD_GPIO4_C2_3V3
106
-
107
- edp_enable_gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
108
- edp_gpio0 = <&gpio3 RK_PD2 GPIO_ACTIVE_HIGH>; //7511_GPIO0-GPIO3_D2
109
- edp_gpio1 = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; //7511_GPIO1-GPIO3_D3
110
- edp_gpio2 = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; //7511_GPIO2-GPIO3_D4
111
- edp_gpio3 = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; //7511_GPIO3-GPIO3_D5
112
- edp_reset = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; //7511_RST_GPIO3_D1
113
-// tp_reset = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>;
114
-// vddio_mipi = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
115
-
104
+ spk_out_gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;//AMP_SD_GPIO4_C2_3V3
116105 wifi_power_en_gpio = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>; //WIFI_PWREN_GPIO3_C6_1V8
117
-
106
+// pcie_power_en_gpio = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;//PCIE_PWREN_H_GPIO0_D4
118107 pinctrl-names = "default";
119
- pinctrl-0 = <&nk_io_gpio>;
120
- nodka_lvds = <9>;
108
+ pinctrl-0 = <&nk_io_gpio>;
121109 };
110
+
111
+ panel: panel {
112
+ compatible = "simple-panel";
113
+ backlight = <&backlight>;
114
+ power-supply = <&vcc3v3_lcd0_n>;
115
+ enable-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; //LCD0_VDD_H_GPIO2_D4
116
+ reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_LOW>; //7511_RST_GPIO3_D1
117
+ edp-bl-gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; //LCD0_BKLT_EN_3V3
118
+ edp-bl-en = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; //LCD0_BKLT_EN_3V3
119
+ bus-format = <MEDIA_BUS_FMT_RGB888_1X24>;
120
+ bpc = <8>;
121
+ prepare-delay-ms = <200>;
122
+ enable-delay-ms = <20>;
123
+ lvds-gpio0 = <&gpio3 RK_PD2 GPIO_ACTIVE_HIGH>; //7511_GPIO0-GPIO3_D2
124
+ lvds-gpio1 = <&gpio3 RK_PD3 GPIO_ACTIVE_HIGH>; //7511_GPIO1-GPIO3_D3
125
+ lvds-gpio2 = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; //7511_GPIO2-GPIO3_D4
126
+ lvds-gpio3 = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>; //7511_GPIO3-GPIO3_D5
127
+ nodka-lvds = <9>;
128
+
129
+ display-timings {
130
+ native-mode = <&timing0>;
131
+ timing0: timing0 {
132
+ clock-frequency = <142300000>;
133
+ hactive = <1920>;
134
+ vactive = <1080>;
135
+ hfront-porch = <48>;
136
+ hsync-len = <32>;
137
+ hback-porch = <100>;
138
+ vfront-porch = <7>;
139
+ vsync-len = <20>;
140
+ vback-porch = <23>;
141
+ hsync-active = <0>;
142
+ vsync-active = <0>;
143
+ de-active = <0>;
144
+ pixelclk-active = <0>;
145
+ };
146
+ };
147
+ ports {
148
+ panel_in: endpoint {
149
+ remote-endpoint = <&edp_out>;
150
+ };
151
+ };
152
+ };
122153 };
123154
124155 &combphy0_us {
....@@ -134,11 +165,11 @@
134165 };
135166
136167 &csi2_dphy_hw {
137
- status = "okay";
168
+ status = "disabled";
138169 };
139170
140171 &csi2_dphy0 {
141
- status = "okay";
172
+ status = "disabled";
142173
143174 ports {
144175 #address-cells = <1>;
....@@ -181,8 +212,12 @@
181212 * video_phy0 needs to be enabled
182213 * when dsi0 is enabled
183214 */
215
+&video_phy0 {
216
+ status = "disabled";
217
+};
218
+
184219 &dsi0 {
185
- status = "okay";
220
+ status = "disabled";
186221 };
187222
188223 &dsi0_in_vp0 {
....@@ -190,7 +225,7 @@
190225 };
191226
192227 &dsi0_in_vp1 {
193
- status = "okay";
228
+ status = "disabled";
194229 };
195230
196231 &dsi0_panel {
....@@ -201,6 +236,10 @@
201236 * video_phy1 needs to be enabled
202237 * when dsi1 is enabled
203238 */
239
+
240
+&video_phy1 {
241
+ status = "disabled";
242
+};
204243 &dsi1 {
205244 status = "disabled";
206245 };
....@@ -217,22 +256,82 @@
217256 power-supply = <&vcc3v3_lcd1_n>;
218257 };
219258
259
+/*
260
+* edp_start
261
+*/
262
+
220263 &edp {
221
- hpd-gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
222
- status = "okay";
264
+ force-hpd;
265
+ status = "okay";
266
+ ports {
267
+ port@1 {
268
+ reg = <1>;
269
+ edp_out: endpoint {
270
+ remote-endpoint = <&panel_in>;
271
+ };
272
+ };
273
+ };
223274 };
224275
225276 &edp_phy {
226
- status = "okay";
277
+ status = "okay";
227278 };
228279
229280 &edp_in_vp0 {
230
- status = "okay";
281
+ status = "disabled";
231282 };
232283
233284 &edp_in_vp1 {
285
+ status = "okay";
286
+};
287
+
288
+&route_edp {
289
+ status = "okay";
290
+ connect = <&vp1_out_edp>;
291
+};
292
+
293
+&route_edp {
294
+ status = "okay";
295
+};
296
+/*
297
+* edp_end
298
+*/
299
+
300
+/*
301
+* Hdmi_start
302
+*/
303
+
304
+&hdmi {
305
+ status = "okay";
306
+ rockchip,phy-table =
307
+ <92812500 0x8009 0x0000 0x0270>,
308
+ <165000000 0x800b 0x0000 0x026d>,
309
+ <185625000 0x800b 0x0000 0x01ed>,
310
+ <297000000 0x800b 0x0000 0x01ad>,
311
+ <594000000 0x8029 0x0000 0x0088>,
312
+ <000000000 0x0000 0x0000 0x0000>;
313
+};
314
+
315
+&route_hdmi {
316
+ status = "okay";
317
+ connect = <&vp0_out_hdmi>;
318
+};
319
+
320
+&hdmi_in_vp0 {
321
+ status = "okay";
322
+};
323
+
324
+&hdmi_in_vp1 {
234325 status = "disabled";
235326 };
327
+
328
+&hdmi_sound {
329
+ status = "okay";
330
+};
331
+
332
+/*
333
+ * Hdmi_END
334
+*/
236335
237336 &gmac0 {
238337 phy-mode = "rgmii";
....@@ -409,20 +508,14 @@
409508 };
410509 };
411510
412
-&video_phy0 {
413
- status = "okay";
414
-};
415511
416
-&video_phy1 {
417
- status = "disabled";
418
-};
419512
420513 &pcie30phy {
421514 status = "okay";
422515 };
423516
424
-&pcie3x2 {
425
- reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
517
+&pcie2x1 {
518
+ reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
426519 vpcie3v3-supply = <&vcc3v3_pcie>;
427520 status = "okay";
428521 };
....@@ -477,15 +570,15 @@
477570 };
478571
479572 &rkisp {
480
- status = "okay";
573
+ status = "disabled";
481574 };
482575
483576 &rkisp_mmu {
484
- status = "okay";
577
+ status = "disabled";
485578 };
486579
487580 &rkisp_vir0 {
488
- status = "okay";
581
+ status = "disabled";
489582
490583 port {
491584 #address-cells = <1>;
....@@ -499,14 +592,11 @@
499592 };
500593
501594 &route_dsi0 {
502
- status = "okay";
595
+ status = "disabled";
503596 connect = <&vp1_out_dsi0>;
504597 };
505598
506
-&route_edp {
507
- status = "okay";
508
- connect = <&vp0_out_edp>;
509
-};
599
+
510600
511601 &sata2 {
512602 status = "okay";
....@@ -545,7 +635,7 @@
545635 };
546636
547637 &vcc3v3_lcd0_n {
548
- gpio = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
638
+ gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
549639 enable-active-high;
550640 };
551641
kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi
....@@ -291,7 +291,7 @@
291291 regulator-min-microvolt = <3300000>;
292292 regulator-max-microvolt = <3300000>;
293293 enable-active-high;
294
- gpio = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
294
+ gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; //VCC3_IO_EN_GPIO0_C4_3V3
295295 vin-supply = <&vcc3v3_sys>;
296296
297297 regulator-state-mem {
....@@ -1070,28 +1070,7 @@
10701070 status = "okay";
10711071 };
10721072
1073
-&hdmi {
1074
- status = "okay";
1075
- rockchip,phy-table =
1076
- <92812500 0x8009 0x0000 0x0270>,
1077
- <165000000 0x800b 0x0000 0x026d>,
1078
- <185625000 0x800b 0x0000 0x01ed>,
1079
- <297000000 0x800b 0x0000 0x01ad>,
1080
- <594000000 0x8029 0x0000 0x0088>,
1081
- <000000000 0x0000 0x0000 0x0000>;
1082
-};
10831073
1084
-&hdmi_in_vp0 {
1085
- status = "okay";
1086
-};
1087
-
1088
-&hdmi_in_vp1 {
1089
- status = "disabled";
1090
-};
1091
-
1092
-&hdmi_sound {
1093
- status = "okay";
1094
-};
10951074
10961075 &i2c0 {
10971076 status = "okay";
....@@ -1691,10 +1670,7 @@
16911670 status = "okay";
16921671 };
16931672
1694
-&route_hdmi {
1695
- status = "okay";
1696
- connect = <&vp0_out_hdmi>;
1697
-};
1673
+
16981674
16991675 &saradc {
17001676 status = "okay";
kernel/arch/arm64/boot/dts/rockchip/rk3568.dtsi
....@@ -256,20 +256,20 @@
256256 connect = <&vp0_out_dsi1>;
257257 };
258258 route_edp: route-edp {
259
- status = "disabled";
259
+ status = "okay";
260260 logo,uboot = "logo.bmp";
261261 logo,kernel = "logo_kernel.bmp";
262262 logo,mode = "center";
263263 charge_logo,mode = "center";
264
- connect = <&vp0_out_edp>;
264
+ connect = <&vp1_out_edp>;
265265 };
266266 route_hdmi: route-hdmi {
267
- status = "disabled";
267
+ status = "okay";
268268 logo,uboot = "logo.bmp";
269269 logo,kernel = "logo_kernel.bmp";
270270 logo,mode = "center";
271271 charge_logo,mode = "center";
272
- connect = <&vp1_out_hdmi>;
272
+ connect = <&vp0_out_hdmi>;
273273 };
274274 route_lvds: route-lvds {
275275 status = "disabled";
....@@ -2397,7 +2397,7 @@
23972397 reg-names = "pcie-dbi", "pcie-apb";
23982398 resets = <&cru SRST_PCIE20_POWERUP>;
23992399 reset-names = "pipe";
2400
- status = "disabled";
2400
+ status = "okay";
24012401
24022402 pcie2x1_intc: legacy-interrupt-controller {
24032403 interrupt-controller;
kernel/drivers/misc/nkio/nk_io_core.c
....@@ -61,11 +61,8 @@
6161 {
6262 struct device_node *node = pdev->dev.of_node;
6363 struct nk_io_pdata *pdata;
64
- int gpio0, gpio1, gpio2, gpio3, reset_pin, ch342_reset;
6564 int ret;
66
- int lvds_index;
67
- int i=0;
68
- static int lvds_gpio[4] ;
65
+
6966
7067 enum of_gpio_flags flags;
7168
....@@ -97,7 +94,7 @@
9794 goto err;
9895 }
9996 }
100
-
97
+#if 0
10198 //vcc3_io_en_gpio
10299 ret = of_get_named_gpio_flags(node, "vcc3_io_en_gpio", 0, &flags);
103100 if (ret < 0) {
....@@ -117,7 +114,7 @@
117114 goto err;
118115 }
119116 }
120
-
117
+#endif
121118 //vcc_12v_io
122119 ret = of_get_named_gpio_flags(node, "vcc_12v_io", 0, &flags);
123120 if (ret < 0) {
....@@ -287,7 +284,24 @@
287284 printk("%s() gpio_direction_output hp_en_gpio set ERROR\n", __FUNCTION__);
288285 }
289286 }
290
-
287
+#if 0
288
+ //pcie_power_en_gpio
289
+ ret = of_get_named_gpio_flags(node, "pcie_power_en_gpio", 0, &flags);
290
+ if (ret < 0) {
291
+ printk("%s() Can not read property pcie_power_en_gpio\n", __FUNCTION__);
292
+ } else {
293
+ pdata->pcie_power_en_gpio = ret;
294
+
295
+ ret = devm_gpio_request(&pdev->dev, pdata->pcie_power_en_gpio, "pcie_power_en_gpio");
296
+ if(ret < 0){
297
+ printk("%s() devm_gpio_request pcie_power_en_gpio request ERROR\n", __FUNCTION__);
298
+ }
299
+ ret = gpio_direction_output(pdata->pcie_power_en_gpio,1);
300
+ if(ret < 0){
301
+ printk("%s() gpio_direction_output pcie_power_en_gpio set ERROR\n", __FUNCTION__);
302
+ }
303
+ }
304
+#endif
291305 //wifi_power_en_gpio
292306 ret = of_get_named_gpio_flags(node, "wifi_power_en_gpio", 0, &flags);
293307 if (ret < 0) {
....@@ -377,24 +391,42 @@
377391 }
378392 }
379393
380
- //ch342_enable-gpio;
381
- ret = of_get_named_gpio_flags(node, "ch342_power", 0, &flags);
394
+ //lcd_bk_en_gpio;
395
+ ret = of_get_named_gpio_flags(node, "lcd_bk_en_gpio", 0, &flags);
382396 if (ret < 0) {
383
- printk("%s() Can not read property ch342_gpio\n", __FUNCTION__);
397
+ printk("%s() Can not read property lcd_bk_en_gpio\n", __FUNCTION__);
384398 } else {
385
- pdata->ch342_power = ret;
399
+ pdata->lcd_bk_en_gpio = ret;
386400
387
- ret = devm_gpio_request(&pdev->dev, pdata->ch342_power, "ch342_power");
401
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_bk_en_gpio, "lcd_bk_en_gpio");
388402 if(ret < 0){
389
- printk("%s() devm_gpio_request ch342_power request ERROR\n", __FUNCTION__);
403
+ printk("%s() devm_gpio_request lcd_bk_en_gpio request ERROR\n", __FUNCTION__);
390404 }
391405
392
- ret = gpio_direction_output(pdata->ch342_power,1);
406
+ ret = gpio_direction_output(pdata->lcd_bk_en_gpio,1);
393407 if(ret < 0){
394
- printk("%s() gpio_direction_input ch342_power set ERROR\n", __FUNCTION__);
408
+ printk("%s() gpio_direction_output lcd_bk_en_gpio set ERROR\n", __FUNCTION__);
395409 }
396410 }
397
-*/
411
+
412
+ //lcd_pwblk_gpio;
413
+ ret = of_get_named_gpio_flags(node, "lcd_pwblk_gpio", 0, &flags);
414
+ if (ret < 0) {
415
+ printk("%s() Can not read property lcd_pwblk_gpio\n", __FUNCTION__);
416
+ } else {
417
+ pdata->lcd_pwblk_gpio = ret;
418
+
419
+ ret = devm_gpio_request(&pdev->dev, pdata->lcd_pwblk_gpio, "lcd_pwblk_gpio");
420
+ if(ret < 0){
421
+ printk("%s() devm_gpio_request lcd_pwblk_gpio request ERROR\n", __FUNCTION__);
422
+ }
423
+
424
+ ret = gpio_direction_output(pdata->lcd_pwblk_gpio,1);
425
+ if(ret < 0){
426
+ printk("%s() gpio_direction_output lcd_pwblk_gpio set ERROR\n", __FUNCTION__);
427
+ }
428
+ }
429
+
398430
399431 //edp_set_pixel-s
400432 ret = of_get_named_gpio_flags(node, "edp_reset", 0, &flags);
....@@ -498,6 +530,12 @@
498530 gpio_direction_output(gpio2, lvds_gpio[2]);
499531 gpio_direction_output(gpio3, lvds_gpio[3]);
500532
533
+
534
+ gpio_direction_output(reset_pin, 0);
535
+ usleep_range(80000, 100000);
536
+ gpio_direction_output(reset_pin, 1);
537
+ usleep_range(80000, 100000);
538
+*/
501539 printk(" #######nk_io_control_probe end####### \n");
502540 return 0;
503541
....@@ -542,38 +580,6 @@
542580
543581 static int nk_io_control_resume(struct platform_device *pdev)
544582 {
545
- int ret,reset_pin;
546
- printk("nk_io resume !!!!\n");
547
- ret = gpio_get_value(120);
548
-
549
-#if 0
550
- gpio_set_value(8,1);
551
- ret = gpio_get_value(8);
552
- printk("vcc12v gpio value : %d\n",ret);
553
-#endif
554
-#if 0
555
- gpio_set_value(15,1);
556
- ret = gpio_get_value(15);
557
- printk("edp_en gpio value : %d\n",ret);
558
- gpio_set_value(21,1);
559
- ret = gpio_get_value(21);
560
- printk("hub_host3_5v_gpio value : %d\n",ret);
561
-#endif
562
-#if 0
563
- usleep_range(80000, 100000);
564
- gpio_set_value(120,0);
565
-// gpio_direction_output(120, 0);
566
- usleep_range(80000, 100000);
567
- ret = gpio_get_value(120);
568
- printk("edp_reset gpio value : %d\n",ret);
569
-// gpio_direction_output(120, 1);
570
- gpio_set_value(120,1);
571
- usleep_range(80000, 100000);
572
- ret = gpio_get_value(120);
573
- printk("edp_reset gpio value : %d\n",ret);
574
-#endif
575
- //enable = 1;
576
- //LED_SET(11);
577583 return 0;
578584 }
579585
kernel/drivers/misc/nkio/nkio.h
....@@ -28,7 +28,7 @@
2828 unsigned int edp_power_supply_gpio;
2929 unsigned int edp_enable_gpio;
3030 unsigned int spk_out_gpio;
31
- unsigned int vddio_mipi;
31
+ unsigned int pcie_power_en_gpio;
3232 // unsigned int tp_reset;
3333 };
3434
lcdparamservice/chglcd.sh
....@@ -0,0 +1,28 @@
1
+#!/bin/bash
2
+CONFIG_PATH="/root/.config/nodka_lcd/lcd.config"
3
+EDP_PARMFILE_PATH="/nodka_test/lcd_parameters/eDP/"
4
+LVDS_PARMFILE_PATH="/nodka_test/lcd_parameters/LVDS/"
5
+
6
+choose_button=$(grep choose_button $CONFIG_PATH)
7
+choose_button=${choose_button:14}
8
+echo $choose_button
9
+
10
+edp_type=$(grep edp_type $CONFIG_PATH)
11
+edp_type=${edp_type:9}
12
+echo $edp_type
13
+
14
+lvds_type=$(grep lvds_type $CONFIG_PATH)
15
+lvds_type=${lvds_type:10}
16
+echo $lvds_type
17
+
18
+if [[ $choose_button = "button_eDP" ]];then
19
+ cp $EDP_PARMFILE_PATH$edp_type /nodka_test/nodka_lcd
20
+else
21
+ cp $LVDS_PARMFILE_PATH$lvds_type /nodka_test/nodka_lcd
22
+fi
23
+sync
24
+
25
+
26
+lcdparamservice
27
+
28
+
lcdparamservice/lcd_parameters/LVDS/10.1_LVDS_1280x800
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 72500000;
13
+hactive = 1280;
14
+hfront-porch = 70;
15
+hsync-len = 72;
16
+hback-porch = 160;
17
+vactive = 800;
18
+vfront-porch = 4;
19
+vsync-len = 21;
20
+vback-porch = 42;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 15;
lcdparamservice/lcd_parameters/LVDS/12.1_LVDS_1024x768
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 70000000;
13
+hactive = 1024;
14
+hfront-porch = 58;
15
+hsync-len = 320;
16
+hback-porch = 44;
17
+vactive = 768;
18
+vfront-porch = 3;
19
+vsync-len = 15;
20
+vback-porch = 38;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 13;
lcdparamservice/lcd_parameters/LVDS/15_LVDS_1024X768
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 70000000;
13
+hactive = 1024;
14
+hfront-porch = 48;
15
+hsync-len = 320;
16
+hback-porch = 44;
17
+vactive = 768;
18
+vfront-porch = 3;
19
+vsync-len = 15;
20
+vback-porch = 38;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 13;
lcdparamservice/lcd_parameters/LVDS/17_LVDS_1280x1024
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 107900000;
13
+hactive = 1280;
14
+hfront-porch = 96;
15
+hsync-len = 160;
16
+hback-porch = 408;
17
+vactive = 1024;
18
+vfront-porch = 7;
19
+vsync-len = 19;
20
+vback-porch = 42;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 12;
lcdparamservice/lcd_parameters/LVDS/18.5_LVDS_1366x768
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 78000000;
13
+hactive = 1366;
14
+hfront-porch = 28;
15
+hsync-len = 40;
16
+hback-porch = 240;
17
+vactive = 768;
18
+vfront-porch = 3;
19
+vsync-len = 17;
20
+vback-porch = 40;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 11;
lcdparamservice/lcd_parameters/LVDS/19_LVDS_1280x1024
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 107900000;
13
+hactive = 1280;
14
+hfront-porch = 96;
15
+hsync-len = 160;
16
+hback-porch = 408;
17
+vactive = 1024;
18
+vfront-porch = 7;
19
+vsync-len = 19;
20
+vback-porch = 42;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 12;
lcdparamservice/lcd_parameters/LVDS/19_LVDS_1400x900
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 91000000;
13
+hactive = 1440;
14
+hfront-porch = 20;
15
+hsync-len = 60;
16
+hback-porch = 160;
17
+vactive = 900;
18
+vfront-porch = 6;
19
+vsync-len = 16;
20
+vback-porch = 48;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 7;
lcdparamservice/lcd_parameters/LVDS/21.5_LVDS_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/LVDS/21.8_LVDS_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/LVDS/23.8_LVDS_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/LVDS/8_LVDS_800x600
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 40000000;
13
+hactive = 800;
14
+hfront-porch = 4;
15
+hsync-len = 214;
16
+hback-porch = 260;
17
+vactive = 600;
18
+vfront-porch = 4;
19
+vsync-len = 16;
20
+vback-porch = 39;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 6;
lcdparamservice/lcd_parameters/eDP/12.5_eDP_1366x768
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 78000000;
13
+hactive = 1366;
14
+hfront-porch = 28;
15
+hsync-len = 40;
16
+hback-porch = 140;
17
+vactive = 768;
18
+vfront-porch = 3;
19
+vsync-len = 17;
20
+vback-porch = 40;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 11;
lcdparamservice/lcd_parameters/eDP/12.5_eDP_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/eDP/13.3_eDP_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/eDP/15.6_eDP_1920x1080
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 142300000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 180;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 27;
20
+vback-porch = 50;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcd_parameters/eDP/15.6_eDP_1920x1080_NV156FHM
....@@ -0,0 +1,25 @@
1
+panel-type = 1;
2
+
3
+unprepare-delay-ms = 100;
4
+enable-delay-ms = 100;
5
+disable-delay-ms = 0;
6
+prepare-delay-ms = 100;
7
+reset-delay-ms = 100;
8
+init-delay-ms = 100;
9
+width-mm = 240;
10
+height-mm = 300;
11
+
12
+clock-frequency = 141400000;
13
+hactive = 1980;
14
+hfront-porch = 48;
15
+hsync-len = 80;
16
+hback-porch = 220;
17
+vactive = 1080;
18
+vfront-porch = 7;
19
+vsync-len = 9;
20
+vback-porch = 22;
21
+hsync-active = 0;
22
+vsync-activee = 0;
23
+de-active = 0;
24
+pixelclk-active = 0;
25
+nodka_lvds = 9;
lcdparamservice/lcdparamservice
Binary files differ
lcdparamservice/lcdparamservice.c
....@@ -0,0 +1,547 @@
1
+#include <string.h>
2
+#include <stdlib.h>
3
+#include <unistd.h>
4
+#include <termio.h>
5
+#include <stdio.h>
6
+#include <sys/ioctl.h>
7
+#include <sys/time.h>
8
+#include <ctype.h>
9
+#include <errno.h>
10
+#include <fcntl.h>
11
+//#include <cutils/properties.h>
12
+#include <sys/utsname.h>
13
+//#include <cutils/list.h>
14
+//#include <cutils/log.h>
15
+//#include <cutils/sockets.h>
16
+#include <sys/reboot.h>
17
+//#include <cutils/iosched_policy.h>
18
+
19
+#undef LOG_TAG
20
+#define LOG_TAG "LcdParamService"
21
+
22
+typedef unsigned short uint16;
23
+typedef unsigned long uint32;
24
+typedef unsigned char uint8;
25
+
26
+
27
+#define LCD_PARAMETE_FILE_UPATH "find /media/demo/usb0 -name nodka_lcd"
28
+#define LCD_PARAMETE_FILE_SDPATH "find /nodka_test -name nodka_lcd"
29
+//#define OEM_PARTITIOM_NODE_PATH "/dev/block/by-name/lcdparam"
30
+//#define BASEPARAMETER_PATH "dev/block/platform/fe330000.sdhci/by-name/baseparameter"
31
+#define BASEPARAMETER_PATH "/dev/block/by-name/baseparameter"
32
+/*#define OEM_PARTITIOM_NODE_PATH "data/oem"*/
33
+
34
+/*#define RKNAND_GET_VENDOR_SECTOR0 _IOW('v', 16, unsigned int)*/
35
+/*#define RKNAND_STORE_VENDOR_SECTOR0 _IOW('v', 17, unsigned int)*/
36
+
37
+
38
+#define RKNAND_SYS_STORGAE_DATA_LEN 512 //oem size
39
+/*#define VENDOR_SECTOR_OP_TAG 0x444E4556 // "VEND"*/
40
+
41
+#define POLY 0xEDB88320L //CRC stand
42
+#define CONFIG_NUM 27
43
+#define BASE_OFFSET 256 * 1024
44
+
45
+char *key[CONFIG_NUM] =
46
+{
47
+ "panel-type",
48
+
49
+ "unprepare-delay-ms",
50
+ "enable-delay-ms",
51
+ "disable-delay-ms",
52
+ "prepare-delay-ms",
53
+ "reset-delay-ms",
54
+ "init-delay-ms",
55
+ "width-mm",
56
+ "height-mm",
57
+
58
+ "clock-frequency",
59
+ "hactive",
60
+ "hfront-porch",
61
+ "hsync-len",
62
+ "hback-porch",
63
+ "vactive",
64
+ "vfront-porch",
65
+ "vsync-len",
66
+ "vback-porch",
67
+ "hsync-active",
68
+ "vsync-active",
69
+ "de-active",
70
+ "pixelclk-active",
71
+
72
+ "dsi,flags",
73
+ "dsi,format",
74
+ "dsi,lanes",
75
+ "panel-init-sequence",
76
+
77
+ "nodka_lvds"
78
+};
79
+
80
+typedef struct tagRKNAND_SYS_STORGAE
81
+{
82
+ /*unsigned long tag;*/
83
+ /*unsigned long len;*/
84
+ unsigned char data[RKNAND_SYS_STORGAE_DATA_LEN];
85
+}RKNAND_SYS_STORGAE;
86
+
87
+
88
+static uint32 crc32_tab[256];
89
+static uint32 nand_crc = 0;
90
+
91
+char *strreplace(char *s, char old, char new)
92
+{
93
+ for (; *s; ++s)
94
+ if (*s == old)
95
+ *s = new;
96
+ return s;
97
+}
98
+
99
+void rknand_print_hex_data(uint8 *s,uint32 * buf,uint32 len)
100
+{
101
+ uint32 i;
102
+ printf("%s\n",s);
103
+ for(i=0;i<len;i+=4)
104
+ {
105
+ printf("%lx %lx %lx %lx\n",buf[i],buf[i+1],buf[i+2],buf[i+3]);
106
+ }
107
+}
108
+
109
+
110
+void init_crc32_tab(void)
111
+{
112
+ int i = 0;
113
+ int j = 0;
114
+ uint32 crc = 0;
115
+
116
+ for(i = 0; i < 256; i++)
117
+ {
118
+ crc = (uint32)i;
119
+ for(j = 0; j < 8; j++)
120
+ {
121
+ if(crc & 0x00000001L)
122
+ crc = (crc >> 1) ^ POLY;
123
+ else
124
+ crc = crc >> 1;
125
+ }
126
+ crc32_tab[i] = crc;
127
+ }
128
+
129
+}
130
+
131
+uint32 get_crc32(uint32 crc_init, uint8 *crc_buf, uint32 buf_size)
132
+{
133
+ uint32 crc = crc_init ^ 0xffffffff;
134
+
135
+ init_crc32_tab();
136
+ while(buf_size--)
137
+ crc = (crc >> 8) ^ crc32_tab[(crc & 0xff) ^ *crc_buf++];
138
+ return crc ^ 0xfffffff;
139
+}
140
+
141
+uint32 getfile_crc(FILE *fp)
142
+{
143
+ uint32 size = 4 *1024;
144
+ uint8 crc_buf[size];
145
+ uint32 readln = 0;
146
+ uint crc = 0;
147
+
148
+ while((readln = fread(crc_buf, sizeof(uint8), size, fp)) > 0)
149
+ crc = get_crc32(crc, crc_buf, readln);
150
+
151
+ return crc;
152
+
153
+}
154
+
155
+/*
156
+ *去除字符串左端空格
157
+ */
158
+char *strtriml(char *pstr)
159
+{
160
+ int i = 0,j;
161
+ j = strlen(pstr) - 1;
162
+ while (isspace(pstr[i]) && (i <= j))
163
+ i++;
164
+ if (0<i)
165
+ strcpy(pstr, &pstr[i]);
166
+ return pstr;
167
+}
168
+
169
+/*
170
+ *去除字符串右端空格
171
+ */
172
+char *strtrimr(char *pstr)
173
+{
174
+ int i;
175
+ i = strlen(pstr) - 1;
176
+ while (isspace(pstr[i]) && (i >= 0))
177
+ pstr[i--] = '\0';
178
+ return pstr;
179
+}
180
+
181
+/*
182
+ *去除字符串两端空格
183
+ */
184
+char *strtrim(char *pstr)
185
+{
186
+ char *p;
187
+ p = strtrimr(pstr);
188
+ return strtriml(p);
189
+}
190
+
191
+
192
+char *strdelchr(char *pstr, int chr)
193
+{
194
+ int i = 0;
195
+ int l = 0;
196
+ int ll = 0;
197
+ ll = l = strlen(pstr);
198
+
199
+ while(i < l)
200
+ {
201
+ if(pstr[i] == chr)
202
+ {
203
+ memmove((pstr + i), (pstr + i + 1), (ll - i -1));
204
+ pstr[ll - 1] = '\0';
205
+ ll--;
206
+ }
207
+ i++;
208
+ }
209
+ /* for(i = 0; i < l; i++) */
210
+ /* { */
211
+ /* if(pstr[i] == chr) */
212
+ /* { */
213
+ /* memmove((pstr + i), (pstr + i + 1), (l - i -1)); */
214
+ /* pstr[l - 1] = '\0'; */
215
+ /* break; */
216
+ /* } */
217
+ /* } */
218
+ return pstr;
219
+}
220
+
221
+
222
+void strrmspace(char * str)
223
+{
224
+ char *p1, *p2;
225
+ char ch;
226
+ p1 = str; //first pointer
227
+ p2 = str; // second pointer to the remaining string
228
+ if (p1==NULL) return;
229
+ while (*p1)
230
+ {
231
+ if (*p1 != ' ')
232
+ {
233
+ ch = *p1;
234
+ *p2 = ch;
235
+ p1++;
236
+ p2++;
237
+ }
238
+ else
239
+ {
240
+ p1++;
241
+ }
242
+ }
243
+ *p2 = '\0';
244
+}
245
+uint32 getfile_crc_from_nand(void)
246
+{
247
+ int ret = 0;
248
+ uint32 crc = 0;
249
+
250
+ RKNAND_SYS_STORGAE sysData;
251
+
252
+ int sys_fd;
253
+
254
+ if (0 != access(BASEPARAMETER_PATH, R_OK | W_OK)){
255
+ printf("access fail!!!\n");
256
+ return -1;
257
+ }
258
+
259
+ memset(sysData.data, '\0', sizeof(sysData.data));
260
+ /*sysData.tag = VENDOR_SECTOR_OP_TAG;*/
261
+ /*sysData.len = RKNAND_SYS_STORGAE_DATA_LEN-8;*/
262
+ /*sys_fd = fopen(OEM_PARTITIOM_NODE_PATH, "r");*/
263
+ /*[>sys_fd = open("/dev/rknand_sys_storage",O_RDWR,0);<]*/
264
+ /*if(sys_fd == NULL)*/
265
+ /*{*/
266
+ /*printf("fopen err %s err=%d\n",OEM_PARTITIOM_NODE_PATH, sys_fd);*/
267
+ /*return -1;*/
268
+ /*}*/
269
+
270
+ sys_fd = open(BASEPARAMETER_PATH, O_RDONLY);
271
+
272
+ if (sys_fd < 0)
273
+ {
274
+ printf("fopen err %s sys_fd=,%d\n",BASEPARAMETER_PATH, sys_fd);
275
+ return -1;
276
+ }
277
+ lseek(sys_fd, BASE_OFFSET, SEEK_SET);
278
+ ret = read (sys_fd, (void*)&sysData, sizeof(sysData));
279
+ if (ret < 0)
280
+ {
281
+ printf("read err %s sys_fd=,%d\n",BASEPARAMETER_PATH, sys_fd );
282
+ return -1;
283
+ }
284
+
285
+ /*ret = ioctl(sys_fd, RKNAND_GET_VENDOR_SECTOR0, &sysData);*/
286
+ /*fread((void*)&sysData,sizeof(sysData),1,sys_fd);*/
287
+ /* rknand_print_hex_data("getfile_crc_from_nand data:",(uint32*)sysData.data,32); */
288
+ /* crc = sysData.data[24 * 4]; */
289
+ /* crc = (crc << 8) + sysData.data[24 * 4 + 1]; */
290
+ /* crc = (crc << 8) + sysData.data[24 * 4 + 2]; */
291
+ /* crc = (crc << 8) + sysData.data[24 * 4 + 3]; */
292
+ /* printf("-luoxt- crc data = 0x%02x%02x%02x%02x", sysData.data[24 * 4], */
293
+ /* sysData.data[24 * 4 + 1], */
294
+ /* sysData.data[24 * 4 + 2], */
295
+ /* sysData.data[24 * 4 + 3]); */
296
+
297
+ for(int i = 0; i < CONFIG_NUM+1; i++){
298
+ crc = sysData.data[i * 4];
299
+ crc = (crc << 8) + sysData.data[i * 4 + 1];
300
+ crc = (crc << 8) + sysData.data[i * 4 + 2];
301
+ crc = (crc << 8) + sysData.data[i * 4 + 3];
302
+ printf("-luoxt- %d nand crc data = 0X%02X%02X%02X%02X\n", i, sysData.data[i * 4],
303
+ sysData.data[i * 4 + 1],
304
+ sysData.data[i * 4 + 2],
305
+ sysData.data[i * 4 + 3]);
306
+ }
307
+
308
+
309
+ crc = sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-4];
310
+ crc = (crc << 8) + sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-3];
311
+ crc = (crc << 8) + sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-2];
312
+ crc = (crc << 8) + sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-1];
313
+ printf("-luoxt- nand crc data = 0X%02X%02X%02X%02X\n", sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-4],
314
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-3],
315
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-2],
316
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-1]);
317
+ close(sys_fd);
318
+
319
+ return crc;
320
+}
321
+
322
+int rk_update_lcd_parameters_from_sdcard(void)
323
+{
324
+
325
+ int ret = 0;
326
+ FILE *fp = 0;
327
+ char line[1024] = {0};
328
+ int i = 0;
329
+ RKNAND_SYS_STORGAE sysData;
330
+ int sys_fd = 0;
331
+ static uint32 file_crc = 0; //file lcdparameter crc data
332
+ static int updated = 0; // had store the param into the nand
333
+ static char got_crc = 0; //get file crc flag
334
+ char lcdparameter_buf[128];
335
+ FILE *stream;
336
+
337
+ memset( lcdparameter_buf, '\0', sizeof(lcdparameter_buf) );
338
+ memset(sysData.data, '\0', sizeof(sysData.data));
339
+ if((access(LCD_PARAMETE_FILE_UPATH,F_OK))!=-1)
340
+ {
341
+ printf("update form udisk\n");
342
+ stream = popen(LCD_PARAMETE_FILE_UPATH, "r");
343
+ }
344
+ else
345
+ {
346
+ printf("update form emmc\n");
347
+ stream = popen(LCD_PARAMETE_FILE_SDPATH, "r");
348
+ }
349
+ fread( lcdparameter_buf, sizeof(char), sizeof(lcdparameter_buf), stream);
350
+ strreplace(lcdparameter_buf,'\n','\0');
351
+ pclose(stream);
352
+
353
+ /*
354
+ while(access(lcdparameter_buf, 0))
355
+ {
356
+ if(updated)
357
+ updated = 0;
358
+ if(got_crc)
359
+ got_crc = 0;
360
+ return -1;
361
+ }
362
+ */
363
+
364
+ if(!updated)
365
+ {
366
+ if (!got_crc)
367
+ {
368
+ fp = fopen(lcdparameter_buf, "r");
369
+ //fp = fopen("/root/rk_lcd_parameters", "rb");
370
+ printf("---XYP_DEBUG--- ======== %s %d ========\n", __func__, __LINE__);
371
+ if(fp == NULL)
372
+ {
373
+ printf("open %s failed\n", lcdparameter_buf);
374
+ return -1;
375
+ }
376
+ else
377
+ {
378
+ printf("success open file %s \n", lcdparameter_buf);
379
+ }
380
+
381
+ file_crc = getfile_crc(fp);
382
+ got_crc = 1;
383
+ printf(" file crc is 0X%08lX nand_crc is 0X%08lX \n", file_crc, nand_crc );
384
+ fclose(fp);
385
+ }
386
+
387
+ /*sysData.tag = VENDOR_SECTOR_OP_TAG;*/
388
+ /*sysData.len = RKNAND_SYS_STORGAE_DATA_LEN - 8;*/
389
+
390
+ if((nand_crc != file_crc))
391
+ {
392
+ fp = fopen(lcdparameter_buf, "r");
393
+ if(fp == NULL)
394
+ {
395
+ printf("open %s failed\n", lcdparameter_buf);
396
+ return -1;
397
+ }
398
+ else
399
+ {
400
+ printf("success open file %s\n", lcdparameter_buf);
401
+ }
402
+
403
+
404
+ while(fgets(line, 1023, fp))
405
+ {
406
+ char *p = strtrim(line);
407
+ int len = strlen(p);
408
+ if(len <= 0)
409
+ {
410
+ continue;
411
+ }
412
+ else if(p[0]=='#')
413
+ {
414
+ continue;
415
+ }
416
+ else if( (!(strstr(p, "="))) && (!(strstr(p, ";"))) && (!(strstr(p, "screen_"))))
417
+ {
418
+ continue;
419
+ }
420
+ else
421
+ {
422
+ // get key and value string like "screen_lvds_format = 1" spilt by ";"
423
+ char *key_val_str = strtok(p, ";");
424
+ char *value = strchr(key_val_str, '=');
425
+ char cmd[4] = {'\0'};
426
+ if(value == NULL)
427
+ continue;
428
+ for(i = 0; i < CONFIG_NUM; i++)
429
+ {
430
+ if(strstr(p, key[i]))
431
+ {
432
+ char *val = strdelchr(value, '=');
433
+ strrmspace(val);
434
+ uint32 config1 = atoi(val);
435
+
436
+ if (strstr(p, "panel-init-sequence"))
437
+ {
438
+ int count=0;
439
+ int cmdlen=strlen(val)/2;
440
+
441
+ sysData.data[i * 4] =(uint8) (cmdlen >> 24);
442
+ sysData.data[i * 4 + 1] =(uint8) (cmdlen >> 16);
443
+ sysData.data[i * 4 + 2] =(uint8) (cmdlen >> 8);
444
+ sysData.data[i * 4 + 3] =(uint8) (cmdlen >> 0);
445
+ printf("-luoxt- %s=%lu val %s\n", key[i], config1, val);
446
+ i ++;
447
+ while(1)
448
+ {
449
+ cmd [0] = '0';
450
+ cmd [1] = 'x';
451
+ cmd [2] = *val;
452
+ cmd [3] = *(++val);
453
+ uint8 cmdu8 = strtol(cmd,NULL,16);
454
+ sysData.data[i * 4 + count++] = cmdu8;
455
+
456
+ printf("v1-luoxt- cmd=%d count=%d total=%d\n", cmdu8, count, cmdlen);
457
+ if (count < cmdlen)
458
+ ++val; //next cmd
459
+ else
460
+ break;
461
+ }
462
+
463
+ }
464
+ else{
465
+ sysData.data[i * 4] =(uint8) (config1 >> 24);
466
+ sysData.data[i * 4 + 1] =(uint8) (config1 >> 16);
467
+ sysData.data[i * 4 + 2] =(uint8) (config1 >> 8);
468
+ sysData.data[i * 4 + 3] =(uint8) (config1 >> 0);
469
+ printf("-luoxt- %s=%lu val %s\n", key[i], config1, val);
470
+ }
471
+ break;
472
+ }
473
+ }
474
+
475
+ }
476
+
477
+ }
478
+ // file crc data
479
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-4] = (uint8) (file_crc >> 24);
480
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-3] = (uint8) (file_crc >> 16);
481
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-2] = (uint8) (file_crc >> 8);
482
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-1] = (uint8) (file_crc >> 0);
483
+ printf("-luoxt- crc32 = 0X%02X%02X%02X%02X\n", sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-4],
484
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-3],
485
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-2],
486
+ sysData.data[RKNAND_SYS_STORGAE_DATA_LEN-1]);
487
+
488
+ /* rknand_print_hex_data("lcd paramters save:",(uint32*)sysData.data,32); */
489
+ /*ret = ioctl(sys_fd, RKNAND_STORE_VENDOR_SECTOR0, &sysData);*/
490
+
491
+ if (0 == access(BASEPARAMETER_PATH, 0))
492
+ {
493
+ sys_fd = open(BASEPARAMETER_PATH, O_WRONLY);
494
+
495
+ if (sys_fd < 0)
496
+ {
497
+ printf("open err %s err=%d\n",BASEPARAMETER_PATH, sys_fd);
498
+ return -1;
499
+ }
500
+
501
+ lseek(sys_fd, BASE_OFFSET, SEEK_SET);
502
+ ret = write (sys_fd, (void*)&sysData.data[0], RKNAND_SYS_STORGAE_DATA_LEN);
503
+ if (ret < 0)
504
+ {
505
+ printf("read err %s err=%d\n",BASEPARAMETER_PATH, sys_fd);
506
+ return -1;
507
+ }
508
+ }
509
+
510
+ close(sys_fd);
511
+ if(ret==-1){
512
+ printf("save lcdparam error\n");
513
+ }
514
+ else
515
+ {
516
+ updated = 1;
517
+ nand_crc = file_crc;
518
+ fclose(fp);
519
+ sync();
520
+ reboot(RB_AUTOBOOT);
521
+ }
522
+ fclose(fp);
523
+ return ret;
524
+ }
525
+ }
526
+ return ret;
527
+}
528
+
529
+int main(void)
530
+{
531
+ char command[128];
532
+ strcpy( command, "dd if=/dev/zero of=/dev/block/by-name/baseparameter" );
533
+ printf("CLEAN PARAMETERS\n");
534
+ system(command);
535
+ nand_crc = getfile_crc_from_nand();
536
+ while(1)
537
+ {
538
+
539
+ rk_update_lcd_parameters_from_sdcard();
540
+ //gettimeofday(&tv,NULL);
541
+ //fprintf(stderr, "[%ld] rk_update_lcd_parameters_from_sdcard sleep....\n", tv.tv_usec);
542
+ //usleep(100000);
543
+ sleep(5);
544
+ }
545
+ return 0;
546
+}
547
+
rtl8852be
+Subproject commit 68212c16b229080742280f954b3ffde173e63fcc
u-boot/arch/arm/mach-rockchip/kernel_dtb.c
old mode 100644new mode 100755
....@@ -16,6 +16,500 @@
1616
1717 DECLARE_GLOBAL_DATA_PTR;
1818
19
+
20
+#if 1
21
+struct display_fixup_data {
22
+ int type;
23
+
24
+ int delay_prepare;
25
+ int delay_enable;
26
+ int delay_disable;
27
+ int delay_unprepare;
28
+ int delay_reset;
29
+ int delay_init;
30
+ int size_width;
31
+ int size_height;
32
+
33
+ int clock_frequency;
34
+ int hactive;
35
+ int hfront_porch;
36
+ int hsync_len;
37
+ int hback_porch;
38
+ int vactive;
39
+ int vfront_porch;
40
+ int vsync_len;
41
+ int vback_porch;
42
+ int hsync_active;
43
+ int vsync_active;
44
+ int de_active;
45
+ int pixelclk_active;
46
+
47
+ /* for DSI Panel */
48
+ int flags;
49
+ int format;
50
+ int lanes;
51
+ int init_cmd_length;
52
+ u8 *init_cmd;
53
+
54
+ int nodka_lvds;
55
+};
56
+enum {
57
+ PANEL_TYPE_DSI,
58
+ PANEL_TYPE_EDP,
59
+ PANEL_TYPE_LVDS,
60
+};
61
+
62
+#define CUSTOM_PARTITION_NAME "baseparameter"
63
+#define LCD_PARAM_MAX_COUNT 27
64
+
65
+int lcdParam[LCD_PARAM_MAX_COUNT];
66
+char param_buf_temp[4*1024] = {0};
67
+
68
+void set_lcdparam_test_edp(struct display_fixup_data *data)
69
+{
70
+
71
+ data->type = PANEL_TYPE_DSI;
72
+ data->delay_prepare = 100;
73
+ data->delay_enable = 100;
74
+ data->delay_disable = 100;
75
+ data->delay_unprepare = 100;
76
+ data->delay_reset = 100;
77
+ data->delay_init = 100;
78
+ data->size_width = 240;
79
+ data->size_height = 300;
80
+ data->clock_frequency = 60000000;
81
+ data->hactive = 1024;
82
+ data->hfront_porch = 12;
83
+ data->hsync_len = 16;
84
+ data->hback_porch = 48;
85
+ data->vactive = 600;
86
+ data->vfront_porch = 8;
87
+ data->vsync_len = 4;
88
+ data->vback_porch = 8;
89
+ data->hsync_active = 0;
90
+ data->vsync_active = 0;
91
+ data->de_active = 0;
92
+ data->pixelclk_active = 0;
93
+ data->flags = 0;
94
+ data->format = 0;
95
+ data->lanes = 4;
96
+ *(data->init_cmd + 0) = 0x05;
97
+ *(data->init_cmd + 1) = 0x00;
98
+ *(data->init_cmd + 2) = 0x01;
99
+ *(data->init_cmd + 3) = 0x01;
100
+
101
+ *(data->init_cmd + 4) = 0x05;
102
+ *(data->init_cmd + 5) = 0x00;
103
+ *(data->init_cmd + 6) = 0x01;
104
+ *(data->init_cmd + 7) = 0x02;
105
+
106
+ *(data->init_cmd + 8) = 0x05;
107
+ *(data->init_cmd + 9) = 0x00;
108
+ *(data->init_cmd + 10) = 0x01;
109
+ *(data->init_cmd + 11) = 0x03;
110
+
111
+ *(data->init_cmd + 12) = 0x05;
112
+ *(data->init_cmd + 13) = 0x00;
113
+ *(data->init_cmd + 14) = 0x01;
114
+ *(data->init_cmd + 15) = 0x05;
115
+
116
+}
117
+
118
+int get_lcdparam_info_from_custom_partition(struct display_fixup_data *data)
119
+{
120
+
121
+ struct blk_desc *dev_desc;
122
+ disk_partition_t part_info;
123
+ char *boot_partname = CUSTOM_PARTITION_NAME;
124
+ int ret,i;
125
+
126
+ dev_desc = rockchip_get_bootdev();
127
+ if (!dev_desc) {
128
+ printf("%s: dev_desc is NULL!\n", __func__);
129
+ return -ENODEV;
130
+ }
131
+
132
+ ret = part_get_info_by_name(dev_desc, boot_partname, &part_info);
133
+ if (ret < 0) {
134
+ printf("%s: failed to get %s part, ret=%d\n",
135
+ __func__, boot_partname, ret);
136
+ /* RKIMG can support part table without 'boot' */
137
+ return -1;
138
+ }
139
+
140
+ printf("block num: %lu, name %s ,type %s,block size :%lu\n",part_info.size,part_info.name,part_info.type,part_info.blksz);
141
+
142
+ ret = blk_dread(dev_desc, part_info.start + 512, 1, param_buf_temp);
143
+ if (ret != 1) {
144
+ printf("%s: failed to read screen parameter, ret=%d\n",
145
+ __func__, ret);
146
+ return -1;
147
+ }
148
+
149
+ for (i = 0; i < LCD_PARAM_MAX_COUNT; i++) {
150
+ lcdParam[i] = param_buf_temp[i * 4];
151
+ lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 1];
152
+ lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 2];
153
+ lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 3];
154
+ if(lcdParam[i] < 0){
155
+ lcdParam[i] = -lcdParam[i];
156
+ }
157
+ if(lcdParam[i] > 100000 && i != 9){
158
+ lcdParam[i] = 0;
159
+ }
160
+ printf("--get-- lcd_param %d\n",lcdParam[i]);
161
+ }
162
+
163
+ if(lcdParam[14] == 0 || lcdParam[10] == 0){
164
+ return -1;
165
+ }
166
+ printf("-get- crc32 = 0X%02X%02X%02X%02X\n",
167
+ param_buf_temp[LCD_PARAM_MAX_COUNT * 4], param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 1],
168
+ param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 2], param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 3]);
169
+
170
+ data->type = lcdParam[0];
171
+ data->delay_prepare = lcdParam[4];
172
+ data->delay_enable = lcdParam[2];
173
+ data->delay_disable = lcdParam[3];
174
+ data->delay_unprepare = lcdParam[1];
175
+ data->delay_reset = lcdParam[5];
176
+ data->delay_init = lcdParam[6];
177
+ data->size_width = lcdParam[7];
178
+ data->size_height = lcdParam[8];
179
+ data->clock_frequency = lcdParam[9];
180
+ data->hactive = lcdParam[10];
181
+ data->hfront_porch = lcdParam[11];
182
+ data->hsync_len = lcdParam[12];
183
+ data->hback_porch = lcdParam[13];
184
+ data->vactive = lcdParam[14];
185
+ data->vfront_porch = lcdParam[15];
186
+ data->vsync_len = lcdParam[16];
187
+ data->vback_porch = lcdParam[17];
188
+ data->hsync_active = lcdParam[18];
189
+ data->vsync_active = lcdParam[19];
190
+ data->de_active = lcdParam[20];
191
+ data->pixelclk_active = lcdParam[21];
192
+ data->flags = lcdParam[22];
193
+ data->format = lcdParam[23];
194
+ data->lanes = lcdParam[24];
195
+ data->init_cmd_length = lcdParam[25] = 16;
196
+ data->nodka_lvds = lcdParam[26];
197
+ data->init_cmd = malloc(sizeof(*(data->init_cmd)) * data->init_cmd_length);
198
+ for(i = 0; i < data->init_cmd_length; i++){
199
+ *(data->init_cmd + i) = param_buf_temp[100 + i];
200
+ // printf("init cmd = %x\n",param_buf_temp[100 + i]);
201
+
202
+ }
203
+
204
+// set_lcdparam_test_edp(data);
205
+
206
+ return 0;
207
+}
208
+
209
+#endif
210
+
211
+
212
+static int find_connector_node(const void *blob, int node)
213
+{
214
+ int phandle, remote;
215
+ int nodedepth;
216
+
217
+ phandle = fdt_getprop_u32_default_node(blob, node, 0,
218
+ "remote-endpoint", -1);
219
+ remote = fdt_node_offset_by_phandle(blob, phandle);
220
+ nodedepth = fdt_node_depth(blob, remote);
221
+
222
+ return fdt_supernode_atdepth_offset(blob, remote,
223
+ nodedepth - 3, NULL);
224
+}
225
+
226
+static int get_panel_node(const void *blob, int conn_node)
227
+{
228
+ int panel, ports, port, ep, remote, ph, nodedepth;
229
+
230
+ panel = fdt_subnode_offset(blob, conn_node, "panel");
231
+ printf("panel_1=%d\n",panel);
232
+ if (panel > 0) {
233
+ return panel;
234
+ }
235
+
236
+ ports = fdt_subnode_offset(blob, conn_node, "ports");
237
+ if (ports < 0)
238
+ {
239
+ return -ENODEV;
240
+ }
241
+
242
+ fdt_for_each_subnode(port, blob, ports) {
243
+ fdt_for_each_subnode(ep, blob, port) {
244
+ ph = fdt_getprop_u32_default_node(blob, ep, 0,
245
+ "remote-endpoint", 0);
246
+ if (!ph)
247
+ continue;
248
+
249
+ remote = fdt_node_offset_by_phandle(blob, ph);
250
+
251
+ nodedepth = fdt_node_depth(blob, remote);
252
+ if (nodedepth < 2)
253
+ continue;
254
+
255
+ panel = fdt_supernode_atdepth_offset(blob, remote,
256
+ nodedepth - 2,
257
+ NULL);
258
+ break;
259
+ }
260
+ }
261
+ printf("panel_2=%d\n",panel);
262
+ return panel;
263
+}
264
+
265
+static int fdt_fixup_node_status(void *blob, int node, enum fdt_status status)
266
+{
267
+ int ret;
268
+
269
+// printf("My fixup %s %d\n", fdt_get_name(blob, node, NULL), status);
270
+
271
+set_status:
272
+ ret = fdt_set_node_status(blob, node, status, 0);
273
+ if (ret == -FDT_ERR_NOSPACE) {
274
+ ret = fdt_increase_size(blob, 512);
275
+ if (!ret)
276
+ goto set_status;
277
+ else
278
+ goto err_size;
279
+ } else if (ret < 0) {
280
+ printf("Can't set node status: %s\n", fdt_strerror(ret));
281
+ return ret;
282
+ }
283
+
284
+ return 0;
285
+
286
+err_size:
287
+ printf("Can't increase blob size: %s\n", fdt_strerror(ret));
288
+ return ret;
289
+}
290
+
291
+static int fdt_fixup_panel_init_sequence(void *fdt, int node,const struct display_fixup_data *data)
292
+{
293
+ #if 0
294
+ u8 init_buf[] = {0x05, 0x00, 0x01, 0x78, 0x15, 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x01, 0x14,0x39, 0x01, 0x03, 0x02, 0x29, 0x11};
295
+ u8 exit_buf[] = {0x05, 0x64, 0x01, 0x29, 0x05, 0x64, 0x01, 0x11};
296
+ #endif
297
+ int ret;
298
+
299
+add_seq:
300
+ ret = fdt_setprop(fdt, node, "panel-init-sequence", data->init_cmd, data->init_cmd_length);
301
+ if (ret == -FDT_ERR_NOSPACE) {
302
+ printf(" init sequence FDT_ERR_NOSPACE\n");
303
+ ret = fdt_increase_size(fdt, data->init_cmd_length * 4);//gln the length needs precision
304
+ if (!ret)
305
+ goto add_seq;
306
+ else
307
+ goto err_size;
308
+ } else if (ret < 0) {
309
+ printf("Can't add property: %s\n", fdt_strerror(ret));
310
+ return ret;
311
+ }
312
+
313
+#if 0
314
+add_init_seq:
315
+ ret = fdt_setprop(fdt, node, "panel-init-sequence", init_buf, sizeof(init_buf));
316
+ if (ret == -FDT_ERR_NOSPACE) {
317
+ printf(" init sequence FDT_ERR_NOSPACE\n");
318
+ ret = fdt_increase_size(fdt, 512);//gln the length needs precision
319
+ if (!ret)
320
+ goto add_init_seq;
321
+ else
322
+ goto err_size;
323
+ } else if (ret < 0) {
324
+ printf("Can't add property: %s\n", fdt_strerror(ret));
325
+ return ret;
326
+ }
327
+add_exit_seq:
328
+ ret = fdt_setprop(fdt, node, "panel-exit-sequence", exit_buf, sizeof(exit_buf));
329
+ if (ret == -FDT_ERR_NOSPACE) {
330
+ printf(" init sequence FDT_ERR_NOSPACE\n");
331
+ ret = fdt_increase_size(fdt, 512);//gln the length needs precision
332
+ if (!ret)
333
+ goto add_exit_seq;
334
+ else
335
+ goto err_size;
336
+ } else if (ret < 0) {
337
+ printf("Can't add property: %s\n", fdt_strerror(ret));
338
+ return ret;
339
+ }
340
+#endif
341
+
342
+ return 0;
343
+
344
+err_size:
345
+ printf("Can't increase blob size: %s\n", fdt_strerror(ret));
346
+ return ret;
347
+}
348
+
349
+static int fdt_fixup_setprop_u32(void *fdt, int node, const char *name, u32 data)
350
+{
351
+ int ret;
352
+
353
+set_prop:
354
+ ret = fdt_setprop_u32(fdt, node, name, data);
355
+ if (ret == -FDT_ERR_NOSPACE) {
356
+ ret = fdt_increase_size(fdt, 512);
357
+ if (!ret)
358
+ goto set_prop;
359
+ else
360
+ goto err_size;
361
+ } else if (ret < 0) {
362
+ printf("Can't add property: %s\n", fdt_strerror(ret));
363
+ return ret;
364
+ }
365
+
366
+ return 0;
367
+
368
+err_size:
369
+ printf("Can't increase blob size: %s\n", fdt_strerror(ret));
370
+ return ret;
371
+}
372
+
373
+static void fdt_fixup_display_timing(void *blob, int node,
374
+ const struct display_fixup_data *data)
375
+{
376
+ fdt_fixup_setprop_u32(blob, node, "clock-frequency", data->clock_frequency);
377
+ fdt_fixup_setprop_u32(blob, node, "hactive", data->hactive);
378
+ fdt_fixup_setprop_u32(blob, node, "hfront-porch", data->hfront_porch);
379
+ fdt_fixup_setprop_u32(blob, node, "hsync-len", data->hsync_len);
380
+ fdt_fixup_setprop_u32(blob, node, "hback-porch", data->hback_porch);
381
+ fdt_fixup_setprop_u32(blob, node, "vactive", data->vactive);
382
+ fdt_fixup_setprop_u32(blob, node, "vfront-porch", data->vfront_porch);
383
+ fdt_fixup_setprop_u32(blob, node, "vsync-len", data->vsync_len);
384
+ fdt_fixup_setprop_u32(blob, node, "vback-porch", data->vback_porch);
385
+ fdt_fixup_setprop_u32(blob, node, "hsync-active", data->hsync_active);
386
+ fdt_fixup_setprop_u32(blob, node, "vsync-active", data->vsync_active);
387
+ fdt_fixup_setprop_u32(blob, node, "de-active", data->de_active);
388
+ fdt_fixup_setprop_u32(blob, node, "pixelclk-active", data->pixelclk_active);
389
+}
390
+
391
+static void fdt_fixup_panel_node(void *blob, int node, const char *name,
392
+ const struct display_fixup_data *data)
393
+{
394
+ if (!strcmp(name, "dsi")) {
395
+ fdt_setprop_u32(blob, node, "dsi,flags", data->flags);
396
+ fdt_setprop_u32(blob, node, "dsi,format", data->format);
397
+ fdt_setprop_u32(blob, node, "dsi,lanes", data->lanes);
398
+ fdt_fixup_panel_init_sequence(blob, node,data);
399
+ }
400
+ fdt_fixup_setprop_u32(blob, node, "prepare-delay-ms", data->delay_prepare);
401
+ fdt_fixup_setprop_u32(blob, node, "enable-delay-ms", data->delay_enable);
402
+ fdt_fixup_setprop_u32(blob, node, "disable-delay-ms", data->delay_disable);
403
+ fdt_fixup_setprop_u32(blob, node, "unprepare-delay-ms", data->delay_unprepare);
404
+ fdt_fixup_setprop_u32(blob, node, "reset-delay-ms", data->delay_reset);
405
+ fdt_fixup_setprop_u32(blob, node, "init-delay-ms", data->delay_init);
406
+ fdt_fixup_setprop_u32(blob, node, "width-mm", data->size_width);
407
+ fdt_fixup_setprop_u32(blob, node, "height-mm", data->size_height);
408
+
409
+}
410
+static void fdt_fixup_nodka_lvds(void *blob, int node,
411
+ const struct display_fixup_data *data)
412
+{
413
+ if ( data->nodka_lvds != 0 )
414
+ fdt_fixup_setprop_u32(blob, node, "nodka-lvds", data->nodka_lvds);
415
+}
416
+
417
+
418
+static int fdt_fixup_display_sub_route(void *blob, const char *name,
419
+ enum fdt_status status,
420
+ const struct display_fixup_data *data)
421
+{
422
+ int route, phandle, connect, connector, panel, dt, timing, route_lvds;
423
+ char path[64];
424
+ char path_lvds[16] = "/panel";
425
+ int ret;
426
+ sprintf(path, "/display-subsystem/route/route-%s", name);
427
+
428
+
429
+ route = fdt_path_offset(blob, path);
430
+ printf("route : %d \n",route);
431
+ if (route < 0)
432
+ return route;
433
+
434
+ route_lvds = fdt_path_offset(blob, path_lvds);
435
+ if (route_lvds < 0)
436
+ {
437
+ printf("can not get route_lvds = %d\n",route_lvds);
438
+ return route_lvds;
439
+ }
440
+ /* fixup lvds gpio channel*/
441
+ fdt_fixup_nodka_lvds(blob, route_lvds, data);
442
+
443
+ /* fixup route status */
444
+ ret = fdt_fixup_node_status(blob, route, status);
445
+ if (ret < 0)
446
+ return ret;
447
+ phandle = fdt_getprop_u32_default_node(blob, route, 0, "connect", -1);
448
+ if (phandle < 0)
449
+ return phandle;
450
+ connect = fdt_node_offset_by_phandle(blob, phandle);
451
+ if (connect < 0)
452
+ return connect;
453
+ connector = find_connector_node(blob, connect);
454
+ if (connector < 0)
455
+ return connector;
456
+ /* fixup connector status */
457
+ ret = fdt_fixup_node_status(blob, connector, status);
458
+ if (ret < 0)
459
+ return ret;
460
+ if (status != FDT_STATUS_OKAY) {
461
+ return 0;
462
+ }
463
+ panel = get_panel_node(blob, connector);
464
+ if (panel < 0)
465
+ return panel;
466
+ /* fixup panel info */
467
+ fdt_fixup_panel_node(blob, panel, name, data);
468
+ dt = fdt_subnode_offset(blob, panel, "display-timings");
469
+ if (dt < 0) {
470
+ return dt;
471
+ }
472
+ timing = fdt_subnode_offset(blob, dt, "timing");
473
+ if (timing < 0) {
474
+ phandle = fdt_getprop_u32_default_node(blob, dt, 0, "native-mode", -1);
475
+ if (phandle < 0)
476
+ return phandle;
477
+
478
+ timing = fdt_node_offset_by_phandle(blob, phandle);
479
+ if (timing < 0)
480
+ return timing;
481
+ }
482
+
483
+ /* fixup panel display timing */
484
+ fdt_fixup_display_timing(blob, timing, data);
485
+ return 0;
486
+}
487
+
488
+static void fdt_fixup_display_route(void *blob, const struct display_fixup_data *data)
489
+{
490
+ if (data->type == PANEL_TYPE_DSI) {
491
+ fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_OKAY, data);
492
+ fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_DISABLED, data);
493
+ fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_DISABLED, data);
494
+ } else if (data->type == PANEL_TYPE_EDP) {
495
+ fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_DISABLED, data);
496
+ fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_OKAY, data);
497
+ fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_DISABLED, data);
498
+ } else if (data->type == PANEL_TYPE_LVDS) {
499
+ fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_OKAY, data);
500
+ fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_DISABLED, data);
501
+ fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_DISABLED, data);
502
+ }
503
+}
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
19513 #ifdef CONFIG_USING_KERNEL_DTB_V2
20514 static int dm_rm_kernel_dev(void)
21515 {
....@@ -301,6 +795,7 @@
301795 #endif
302796 ulong fdt_addr = 0;
303797 int ret = -ENODEV;
798
+ struct display_fixup_data fix_data;
304799
305800 printf("DM: v%d\n", IS_ENABLED(CONFIG_USING_KERNEL_DTB_V2) ? 2 : 1);
306801
....@@ -372,6 +867,8 @@
372867 phandles_fixup_cru((void *)gd->fdt_blob);
373868 phandles_fixup_gpio((void *)gd->fdt_blob, (void *)ufdt_blob);
374869 #endif
870
+ if (!get_lcdparam_info_from_custom_partition(&fix_data))
871
+ fdt_fixup_display_route((void *)fdt_addr, &fix_data);
375872
376873 gd->flags |= GD_FLG_KDTB_READY;
377874 gd->of_root_f = gd->of_root;
u-boot/drivers/video/drm/rockchip_panel.c
old mode 100644new mode 100755
....@@ -45,6 +45,7 @@
4545 bool power_invert;
4646 u32 bus_format;
4747 unsigned int bpc;
48
+ unsigned int lvds_index;
4849
4950 struct {
5051 unsigned int prepare;
....@@ -66,6 +67,13 @@
6667 struct udevice *backlight;
6768 struct gpio_desc enable_gpio;
6869 struct gpio_desc reset_gpio;
70
+ struct gpio_desc edp_bl_on;
71
+ struct gpio_desc edp_bl_en;
72
+
73
+ struct gpio_desc lvds_gpio0;
74
+ struct gpio_desc lvds_gpio1;
75
+ struct gpio_desc lvds_gpio2;
76
+ struct gpio_desc lvds_gpio3;
6977
7078 int cmd_type;
7179 struct gpio_desc spi_sdi_gpio;
....@@ -275,24 +283,58 @@
275283
276284 if (priv->prepared)
277285 return;
286
+
287
+ /*7511 LVDS IO Control start*/
288
+ printk("nodka_lvds_index = %d\n",plat->lvds_index);
289
+
290
+ ret = plat->lvds_index & 1;
291
+ if (dm_gpio_is_valid(&priv->lvds_gpio0))
292
+ dm_gpio_set_value(&priv->lvds_gpio0, ret);
293
+ ret = dm_gpio_get_value(&priv->lvds_gpio0);
294
+ printf("lvds_gpio0 : %d\n",ret);
295
+
296
+ ret = plat->lvds_index >> 1 & 1;
297
+ if (dm_gpio_is_valid(&priv->lvds_gpio1))
298
+ dm_gpio_set_value(&priv->lvds_gpio1, ret);
299
+ ret = dm_gpio_get_value(&priv->lvds_gpio1);
300
+ printf("lvds_gpio1 : %d\n",ret);
301
+
302
+ ret = plat->lvds_index >> 2 & 1;
303
+ if (dm_gpio_is_valid(&priv->lvds_gpio2))
304
+ dm_gpio_set_value(&priv->lvds_gpio2, ret);
305
+ ret = dm_gpio_get_value(&priv->lvds_gpio2);
306
+ printf("lvds_gpio2 : %d\n",ret);
307
+
308
+ ret = plat->lvds_index >> 3 & 1;
309
+ if (dm_gpio_is_valid(&priv->lvds_gpio3))
310
+ dm_gpio_set_value(&priv->lvds_gpio3, ret);
311
+ ret = dm_gpio_get_value(&priv->lvds_gpio3);
312
+ printf("lvds_gpio3 : %d\n",ret);
313
+ mdelay(100);
314
+/*7511 LVDS IO Control end*/
278315
279316 if (priv->power_supply)
280317 regulator_set_enable(priv->power_supply, !plat->power_invert);
281
-
318
+
319
+ if (dm_gpio_is_valid(&priv->edp_bl_on))
320
+ dm_gpio_set_value(&priv->edp_bl_on, 1);
321
+
322
+ if (dm_gpio_is_valid(&priv->edp_bl_en))
323
+ dm_gpio_set_value(&priv->edp_bl_en, 1);
324
+
282325 if (dm_gpio_is_valid(&priv->enable_gpio))
283326 dm_gpio_set_value(&priv->enable_gpio, 1);
284
-
327
+
285328 if (plat->delay.prepare)
286329 mdelay(plat->delay.prepare);
287
-
330
+
288331 if (dm_gpio_is_valid(&priv->reset_gpio))
289332 dm_gpio_set_value(&priv->reset_gpio, 1);
290
-
291
- if (plat->delay.reset)
292
- mdelay(plat->delay.reset);
293
-
333
+ mdelay(50);
294334 if (dm_gpio_is_valid(&priv->reset_gpio))
295335 dm_gpio_set_value(&priv->reset_gpio, 0);
336
+
337
+ mdelay(200);
296338
297339 if (plat->delay.init)
298340 mdelay(plat->delay.init);
....@@ -407,6 +449,7 @@
407449 plat->delay.disable = dev_read_u32_default(dev, "disable-delay-ms", 0);
408450 plat->delay.init = dev_read_u32_default(dev, "init-delay-ms", 0);
409451 plat->delay.reset = dev_read_u32_default(dev, "reset-delay-ms", 0);
452
+ plat->lvds_index = dev_read_u32_default(dev, "nodka-lvds", 0);
410453
411454 plat->bus_format = dev_read_u32_default(dev, "bus-format",
412455 MEDIA_BUS_FMT_RBG888_1X24);
....@@ -457,6 +500,20 @@
457500 int ret;
458501 const char *cmd_type;
459502
503
+ ret = gpio_request_by_name(dev, "edp-bl-gpios", 0,
504
+ &priv->edp_bl_on, GPIOD_IS_OUT);
505
+ if (ret && ret != -ENOENT) {
506
+ printf("%s: Cannot get enable GPIO: %d\n", __func__, ret);
507
+ return ret;
508
+ }
509
+
510
+ ret = gpio_request_by_name(dev, "edp-bl-en", 0,
511
+ &priv->edp_bl_en, GPIOD_IS_OUT);
512
+ if (ret && ret != -ENOENT) {
513
+ printf("%s: Cannot get enable GPIO: %d\n", __func__, ret);
514
+ return ret;
515
+ }
516
+
460517 ret = gpio_request_by_name(dev, "enable-gpios", 0,
461518 &priv->enable_gpio, GPIOD_IS_OUT);
462519 if (ret && ret != -ENOENT) {
....@@ -471,6 +528,34 @@
471528 return ret;
472529 }
473530
531
+ ret = gpio_request_by_name(dev, "lvds-gpio0", 0,
532
+ &priv->lvds_gpio0, GPIOD_IS_OUT);
533
+ if (ret && ret != -ENOENT) {
534
+ printf("%s: Cannot get lvds-gpio0: %d\n", __func__, ret);
535
+ return ret;
536
+ }
537
+
538
+ ret = gpio_request_by_name(dev, "lvds-gpio1", 0,
539
+ &priv->lvds_gpio1, GPIOD_IS_OUT);
540
+ if (ret && ret != -ENOENT) {
541
+ printf("%s: Cannot get lvds-gpio1: %d\n", __func__, ret);
542
+ return ret;
543
+ }
544
+
545
+ ret = gpio_request_by_name(dev, "lvds-gpio2", 0,
546
+ &priv->lvds_gpio2, GPIOD_IS_OUT);
547
+ if (ret && ret != -ENOENT) {
548
+ printf("%s: Cannot get lvds-gpio2: %d\n", __func__, ret);
549
+ return ret;
550
+ }
551
+
552
+ ret = gpio_request_by_name(dev, "lvds-gpio3", 0,
553
+ &priv->lvds_gpio3, GPIOD_IS_OUT);
554
+ if (ret && ret != -ENOENT) {
555
+ printf("%s: Cannot get lvds-gpio3: %d\n", __func__, ret);
556
+ return ret;
557
+ }
558
+
474559 ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
475560 "backlight", &priv->backlight);
476561 if (ret && ret != -ENOENT) {