From 2822376c8702898f830ad256f8da76fdbd70c1e0 Mon Sep 17 00:00:00 2001 From: "shaochan.liu" Date: Wed, 11 Sep 2019 14:03:03 +0800 Subject: [PATCH] lcd: add lcd_init_level to control lcd display [2/2] PD#TV-9856 Problem: need change display driver for cool boot to enter kernel stage freeze mode Solution: add lcd_panel_ctrl to control lcd display Verify: t962x2-x301 Change-Id: I8b58ab0a0f87c49791af7dddf7b05db37f7ad716 Signed-off-by: shaochan.liu --- drivers/amlogic/media/vout/backlight/aml_bl.c | 8 ++++++ drivers/amlogic/media/vout/lcd/lcd_common.h | 3 ++- drivers/amlogic/media/vout/lcd/lcd_tcon.c | 4 +++ drivers/amlogic/media/vout/lcd/lcd_vout.c | 36 ++++++++++++++++++------- include/linux/amlogic/media/vout/lcd/lcd_vout.h | 3 ++- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/drivers/amlogic/media/vout/backlight/aml_bl.c b/drivers/amlogic/media/vout/backlight/aml_bl.c index bec1f99..7a0fa62 100644 --- a/drivers/amlogic/media/vout/backlight/aml_bl.c +++ b/drivers/amlogic/media/vout/backlight/aml_bl.c @@ -37,6 +37,7 @@ #ifdef CONFIG_AMLOGIC_LCD #include #include +#include #endif #ifdef CONFIG_AMLOGIC_BL_EXTERN #include @@ -3429,8 +3430,15 @@ static const struct of_device_id bl_dt_match_table[] = { static void aml_bl_init_status_update(void) { + struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver(); + struct lcd_config_s *pconf; unsigned int state; + pconf = lcd_drv->lcd_config; + + if (pconf->lcd_boot_ctrl->lcd_init_level) + return; + state = bl_vcbus_read(ENCL_VIDEO_EN); if (state == 0) /* default disable lcd & backlight */ return; diff --git a/drivers/amlogic/media/vout/lcd/lcd_common.h b/drivers/amlogic/media/vout/lcd/lcd_common.h index 1f1d392..c5cd9cd 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_common.h +++ b/drivers/amlogic/media/vout/lcd/lcd_common.h @@ -40,7 +40,8 @@ /* 20190225: optimize unifykey read flow to avoid crash */ /* 20190308: add more panel clk_ss_level step for tl1 */ /* 20190520: add vbyone hw filter user define support */ -#define LCD_DRV_VERSION "20190520" +/* 20190911: add lcd_init_level for tl1 */ +#define LCD_DRV_VERSION "20190911" #define VPP_OUT_SATURATE (1 << 0) diff --git a/drivers/amlogic/media/vout/lcd/lcd_tcon.c b/drivers/amlogic/media/vout/lcd/lcd_tcon.c index 6a3956c..57d8fc6 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_tcon.c +++ b/drivers/amlogic/media/vout/lcd/lcd_tcon.c @@ -555,6 +555,7 @@ int lcd_tcon_core_reg_get(unsigned char *buf, unsigned int size) int lcd_tcon_od_set(int flag) { + struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver(); unsigned int reg, bit, temp; int ret; @@ -575,6 +576,9 @@ int lcd_tcon_od_set(int flag) } } + if (!(lcd_drv->lcd_status & LCD_STATUS_IF_ON)) + return -1; + reg = lcd_tcon_data->reg_core_od; bit = lcd_tcon_data->bit_od_en; if (lcd_tcon_data->core_reg_width == 8) diff --git a/drivers/amlogic/media/vout/lcd/lcd_vout.c b/drivers/amlogic/media/vout/lcd/lcd_vout.c index 9a1c5dc..7ced7f6 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_vout.c +++ b/drivers/amlogic/media/vout/lcd/lcd_vout.c @@ -195,6 +195,7 @@ static struct lcd_boot_ctrl_s lcd_boot_ctrl_config = { .lcd_type = LCD_TYPE_MAX, .lcd_bits = 0, .advanced_flag = 0, + .lcd_init_level = 0, .debug_print_flag = 0, .debug_test_pattern = 0, .debug_para_source = 0, @@ -370,6 +371,12 @@ static void lcd_power_encl_on(void) { mutex_lock(&lcd_vout_mutex); + if (lcd_driver->lcd_status & LCD_STATUS_ENCL_ON) { + LCDPR("%s: on already\n", __func__); + mutex_unlock(&lcd_vout_mutex); + return; + } + lcd_driver->driver_init_pre(); lcd_driver->lcd_status |= LCD_STATUS_ENCL_ON; @@ -396,6 +403,11 @@ static void lcd_power_encl_off(void) { mutex_lock(&lcd_vout_mutex); + if (!(lcd_driver->lcd_status & LCD_STATUS_ENCL_ON)) { + LCDPR("%s: off already\n", __func__); + mutex_unlock(&lcd_vout_mutex); + return; + } lcd_driver->lcd_status &= ~LCD_STATUS_ENCL_ON; lcd_driver->driver_disable_post(); @@ -410,21 +422,21 @@ static void lcd_power_encl_off(void) static void lcd_power_if_on(void) { mutex_lock(&lcd_vout_mutex); - - lcd_driver->power_ctrl(1); - lcd_driver->lcd_status |= LCD_STATUS_IF_ON; + if (!(lcd_driver->lcd_status & LCD_STATUS_IF_ON)) { + lcd_driver->power_ctrl(1); + lcd_driver->lcd_status |= LCD_STATUS_IF_ON; + } lcd_driver->lcd_config->change_flag = 0; - mutex_unlock(&lcd_vout_mutex); } static void lcd_power_if_off(void) { mutex_lock(&lcd_vout_mutex); - - lcd_driver->lcd_status &= ~LCD_STATUS_IF_ON; - lcd_driver->power_ctrl(0); - + if (lcd_driver->lcd_status & LCD_STATUS_IF_ON) { + lcd_driver->lcd_status &= ~LCD_STATUS_IF_ON; + lcd_driver->power_ctrl(0); + } mutex_unlock(&lcd_vout_mutex); } @@ -1216,7 +1228,10 @@ static void lcd_config_default(void) pconf->lcd_basic.v_active = lcd_vcbus_read(ENCL_VIDEO_VAVON_ELINE) - lcd_vcbus_read(ENCL_VIDEO_VAVON_BLINE) + 1; if (lcd_vcbus_read(ENCL_VIDEO_EN)) { - lcd_driver->lcd_status = LCD_STATUS_ON; + if (lcd_boot_ctrl_config.lcd_init_level) + lcd_driver->lcd_status = LCD_STATUS_ENCL_ON; + else + lcd_driver->lcd_status = LCD_STATUS_ON; lcd_resume_flag = 1; } else { lcd_driver->lcd_status = 0; @@ -1687,7 +1702,8 @@ static int __init lcd_boot_ctrl_setup(char *str) lcd_boot_ctrl_config.lcd_type = 0xf & lcd_ctrl; lcd_boot_ctrl_config.lcd_bits = 0xf & (lcd_ctrl >> 4); lcd_boot_ctrl_config.advanced_flag = 0xff & (lcd_ctrl >> 8); - lcd_boot_ctrl_config.debug_print_flag = 0xf & (lcd_ctrl >> 16); + lcd_boot_ctrl_config.lcd_init_level = 0x1 & (lcd_ctrl >> 19); + lcd_boot_ctrl_config.debug_print_flag = 0xf & (lcd_ctrl >> 20); lcd_boot_ctrl_config.debug_test_pattern = 0xf & (lcd_ctrl >> 24); lcd_boot_ctrl_config.debug_para_source = 0x3 & (lcd_ctrl >> 28); lcd_boot_ctrl_config.debug_lcd_mode = 0x3 & (lcd_ctrl >> 30); diff --git a/include/linux/amlogic/media/vout/lcd/lcd_vout.h b/include/linux/amlogic/media/vout/lcd/lcd_vout.h index bc7a64b..5a978f52 100644 --- a/include/linux/amlogic/media/vout/lcd/lcd_vout.h +++ b/include/linux/amlogic/media/vout/lcd/lcd_vout.h @@ -436,7 +436,8 @@ struct lcd_boot_ctrl_s { unsigned char lcd_type; //bit[3:0] unsigned char lcd_bits; //bit[7:4] bits:6 or 8 unsigned char advanced_flag; //bit[15:8] - unsigned char debug_print_flag; //bit[19:16] + unsigned char lcd_init_level; //bit[19] + unsigned char debug_print_flag; //bit[23:20] unsigned char debug_test_pattern; //bit[27:24] unsigned char debug_para_source;//bit[29:28] //0:normal, 1:dts, 2:unifykey, 3:TBD -- 2.7.4