lcd: add lcd tv driver when the panel disable in uboot [1/1]
authorshaochan.liu <shaochan.liu@amlogic.com>
Tue, 21 May 2019 07:59:46 +0000 (15:59 +0800)
committerNick Xie <nick@khadas.com>
Mon, 5 Aug 2019 07:04:42 +0000 (15:04 +0800)
PD#SWPL-5937

Problem:
need screen initialization moved from uboot to kernel

Solution:
1, add lcd tv driver when the panel disable in uboot

Verify:
t962x2-x301

Change-Id: Ia7837db5f6581543b2a093357a264ee63dbd33a9
Signed-off-by: shaochan.liu <shaochan.liu@amlogic.com>
drivers/amlogic/media/vout/lcd/lcd_tv/lcd_tv.c
drivers/amlogic/media/vout/lcd/lcd_vout.c

index f309f02..6eea5c1 100644 (file)
@@ -44,6 +44,7 @@
 
 static unsigned int lcd_output_vmode;
 static char lcd_output_name[30];
+static int lcd_init_on_flag;
 
 /* ************************************************** *
  * lcd mode function
@@ -331,7 +332,19 @@ static int lcd_set_current_vmode(enum vmode_e mode)
        if (VMODE_LCD == (mode & VMODE_MODE_BIT_MASK)) {
                if (mode & VMODE_INIT_BIT_MASK) {
                        lcd_clk_gate_switch(1);
-               } else {
+               } else if (lcd_init_on_flag == 0) {
+                       lcd_init_on_flag = 1;
+                       if ((lcd_drv->lcd_key_valid == 0)
+                       && !(lcd_drv->lcd_status & LCD_STATUS_ENCL_ON)) {
+                               aml_lcd_notifier_call_chain
+                                       (LCD_EVENT_POWER_ON, NULL);
+                               lcd_if_enable_retry(lcd_drv->lcd_config);
+                       } else if (lcd_drv->driver_change != NULL) {
+                               mutex_lock(&lcd_vout_mutex);
+                               ret = lcd_drv->driver_change();
+                               mutex_unlock(&lcd_vout_mutex);
+                       }
+               } else if (lcd_init_on_flag == 1) {
                        mutex_lock(&lcd_vout_mutex);
                        ret = lcd_drv->driver_change();
                        mutex_unlock(&lcd_vout_mutex);
index 214f1f2..6e2ab92 100644 (file)
@@ -1032,6 +1032,13 @@ static void lcd_config_probe_delayed(struct work_struct *work)
                lcd_driver = NULL;
                LCDERR("probe exit\n");
        }
+
+       if ((lcd_driver->lcd_status & LCD_STATUS_VMODE_ACTIVE)
+       && !(lcd_driver->lcd_status & LCD_STATUS_ENCL_ON)) {
+               LCDPR("%s: lcd_enable in kernel\n", __func__);
+               aml_lcd_notifier_call_chain(LCD_EVENT_POWER_ON, NULL);
+               lcd_if_enable_retry(lcd_driver->lcd_config);
+       }
 }
 
 static void lcd_config_default(void)