hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
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) {