summaryrefslogtreecommitdiff
authorShaochan liu <shaochan.liu@amlogic.com>2019-11-26 08:46:18 (GMT)
committer Shaochan Liu <shaochan.liu@amlogic.com>2019-12-17 05:44:15 (GMT)
commite05f7196232f27743782749328948043861dc139 (patch)
tree082fff9b1e4d86911dfa70eee827ab32e266b12d
parent771d61e42fedf21b63ed2e5787542a4dbf9b51ad (diff)
downloaduboot-e05f7196232f27743782749328948043861dc139.zip
uboot-e05f7196232f27743782749328948043861dc139.tar.gz
uboot-e05f7196232f27743782749328948043861dc139.tar.bz2
lcd: add get init_on data to bin file [1/1]
PD#SWPL-17630 Problem: need get init_on data to bin file Solution: add get model_tcon_p_gamma and model_tcon_pmu bin file function Verify: x301_t962x2 This modification was test in tl1 only, other board not tested. Change-Id: I6ec4c2af59a8309a80f6732834680d0c61a69024 Signed-off-by: Shaochan liu <shaochan.liu@amlogic.com>
Diffstat
-rw-r--r--common/ini/model.c138
-rw-r--r--drivers/display/lcd/lcd_extern/lcd_extern.c14
2 files changed, 132 insertions, 20 deletions
diff --git a/common/ini/model.c b/common/ini/model.c
index 583fc18..dbaa593 100644
--- a/common/ini/model.c
+++ b/common/ini/model.c
@@ -51,6 +51,8 @@ static int g_lcd_pwr_on_seq_cnt, g_lcd_pwr_off_seq_cnt;
static int gLcdTconDataCnt;
static int gLcdExtInitOnCnt, gLcdExtInitOffCnt;
+static int handle_tcon_ext_pmu_data(int index, unsigned char *buf);
+
static int transBufferData(const char *data_str, unsigned int data_buf[]) {
int item_ind = 0;
char *token = NULL;
@@ -167,7 +169,7 @@ static int handle_tcon_path(void)
{
const char *ini_value = NULL;
- ini_value = IniGetString("lcd_Path", "TCON_BIN_PATH", "null");
+ ini_value = IniGetString("tcon_Path", "TCON_BIN_PATH", "null");
if (strcmp(ini_value, "null") != 0)
setenv("model_tcon", ini_value);
else if (model_debug_flag & DEBUG_TCON)
@@ -191,6 +193,18 @@ static int handle_tcon_path(void)
else if (model_debug_flag & DEBUG_TCON)
ALOGE("%s, demura lut load file error!\n", __func__);
+ ini_value = IniGetString("tcon_Path", "TCON_EXT_C0_BIN_PATH", "null");
+ if (strcmp(ini_value, "null") != 0)
+ setenv("model_tcon_ext_c0", ini_value);
+ else if (model_debug_flag & DEBUG_TCON)
+ ALOGE("%s, tcon_ext_c0 bin load file error!\n", __func__);
+
+ ini_value = IniGetString("tcon_Path", "TCON_EXT_C1_BIN_PATH", "null");
+ if (strcmp(ini_value, "null") != 0)
+ setenv("model_tcon_ext_c1", ini_value);
+ else if (model_debug_flag & DEBUG_TCON)
+ ALOGE("%s, tcon_ext_c1 bin load file error!\n", __func__);
+
return 0;
}
@@ -600,21 +614,67 @@ static int handle_lcd_ext_cmd_data(struct lcd_ext_attr_s *p_attr)
int i = 0, tmp_cnt = 0, tmp_off = 0;
const char *ini_value = NULL;
unsigned int tmp_buf[2048];
-
-
+ unsigned char *c0_data_buf;
+ unsigned int c0_data_size = 0;
+ unsigned char *c1_data_buf;
+ unsigned int c1_data_size = 0;
+ int j = 0;
+ int ret = 0;
+
+ /* orignal data in ini */
ini_value = IniGetString("lcd_ext_Attr", "init_on", "null");
if (model_debug_flag & DEBUG_LCD_EXTERN)
ALOGD("%s, init_on is (%s)\n", __func__, ini_value);
tmp_cnt = transBufferData(ini_value, tmp_buf);
+
+ c0_data_buf = (unsigned char *)malloc(LCD_EXTERN_INIT_ON_MAX);
+ if (c0_data_buf == NULL) {
+ ALOGE("%s, malloc buffer memory error!!!\n", __func__);
+ return -1;
+ }
+
+ c1_data_buf = (unsigned char *)malloc(LCD_EXTERN_INIT_ON_MAX);
+ if (c1_data_buf == NULL) {
+ free(c0_data_buf);
+ c0_data_buf = NULL;
+ ALOGE("%s, malloc buffer memory error!!!\n", __func__);
+ return -1;
+ }
+
+ /* data check and copy */
if (tmp_cnt > LCD_EXTERN_INIT_ON_MAX) {
- printf("error: %s: invalid init_on data\n", __func__);
+ ALOGE("%s: invalid init_on data\n", __func__);
p_attr->cmd_data[0] = LCD_EXTERN_INIT_END;
p_attr->cmd_data[1] = 0;
gLcdExtInitOnCnt = 2;
} else {
- for (i = 0; i < tmp_cnt; i++)
- p_attr->cmd_data[i] = tmp_buf[i];
- gLcdExtInitOnCnt = tmp_cnt;
+ for (i = 0; i < tmp_cnt; i++) {
+ p_attr->cmd_data[j] = tmp_buf[i];
+ if (p_attr->cmd_data[j] == 0xc0) {
+ ret = handle_tcon_ext_pmu_data(0, c0_data_buf);
+ if (!ret) {
+ c0_data_size = c0_data_buf[0] + 1;
+ memcpy(&p_attr->cmd_data[j + 2],
+ &c0_data_buf[1], c0_data_size);
+ p_attr->cmd_data[j + 1] = c0_data_size;
+ j += c0_data_size + 1;
+ i += tmp_buf[i + 1] + 1;
+ }
+ }
+ if (p_attr->cmd_data[j] == 0xc1) {
+ ret = handle_tcon_ext_pmu_data(1, c1_data_buf);
+ if (!ret) {
+ c1_data_size = c1_data_buf[0] + 1;
+ memcpy(&p_attr->cmd_data[j + 2],
+ &c1_data_buf[1], c1_data_size);
+ p_attr->cmd_data[j + 1] = c1_data_size;
+ j += c1_data_size + 1;
+ i += tmp_buf[i + 1] + 1;
+ }
+ }
+ j++;
+ }
+ gLcdExtInitOnCnt = j;
}
tmp_off = gLcdExtInitOnCnt;
@@ -622,8 +682,8 @@ static int handle_lcd_ext_cmd_data(struct lcd_ext_attr_s *p_attr)
if (model_debug_flag & DEBUG_LCD_EXTERN)
ALOGD("%s, init_off is (%s)\n", __func__, ini_value);
tmp_cnt = transBufferData(ini_value, tmp_buf);
- if (tmp_cnt > LCD_EXTERN_INIT_ON_MAX) {
- printf("error: %s: invalid init_off data\n", __func__);
+ if (tmp_cnt > LCD_EXTERN_INIT_OFF_MAX) {
+ ALOGE("%s: invalid init_off data\n", __func__);
p_attr->cmd_data[tmp_off+0] = LCD_EXTERN_INIT_END;
p_attr->cmd_data[tmp_off+1] = 0;
gLcdExtInitOnCnt = 2;
@@ -633,14 +693,22 @@ static int handle_lcd_ext_cmd_data(struct lcd_ext_attr_s *p_attr)
gLcdExtInitOffCnt = tmp_cnt;
}
-#if 0
- for (i = 0; i < gLcdExtInitOnCnt; i++)
- ALOGD("%s, init_on_data[%d] = 0x%02x\n", __func__, i, p_attr->cmd_data[i]);
+ if (model_debug_flag & DEBUG_LCD_EXTERN) {
+ ALOGD("%s, init_on_data:\n", __func__);
+ for (i = 0; i < gLcdExtInitOnCnt; i++) {
+ printf(" [%d] = 0x%02x\n", i, p_attr->cmd_data[i]);
+ }
- for (i = 0; i < gLcdExtInitOffCnt; i++)
- ALOGD("%s, init_off_data[%d] = 0x%02x\n", __func__, i, p_attr->cmd_data[tmp_off+i]);
-#endif
+ ALOGD("%s, init_off_data:\n", __func__);
+ for (i = 0; i < gLcdExtInitOffCnt; i++) {
+ ALOGD(" [%d] = 0x%02x\n", i, p_attr->cmd_data[tmp_off+i]);
+ }
+ }
+ free(c0_data_buf);
+ c0_data_buf = NULL;
+ free(c1_data_buf);
+ c1_data_buf = NULL;
return 0;
}
@@ -1273,6 +1341,46 @@ static int handle_tcon_bin(void)
return 0;
}
+static int handle_tcon_ext_pmu_data(int index, unsigned char *buf)
+{
+ char *file_name, str[30];
+ unsigned int data_size = 0;
+
+ if (index == 0)
+ sprintf(str, "model_tcon_ext_c0");
+ else
+ sprintf(str, "model_tcon_ext_c1");
+ file_name = getenv(str);
+ if (file_name == NULL) {
+ if (model_debug_flag & DEBUG_NORMAL)
+ ALOGD("%s: no %s path\n", __func__, str);
+ return -1;
+ }
+
+ if (!iniIsFileExist(file_name)) {
+ ALOGE("%s: %s: \"%s\" not exist.\n", __func__, str, file_name);
+ return -1;
+ }
+ if (model_debug_flag & DEBUG_NORMAL)
+ ALOGD("%s: %s: %s\n", __func__, str, file_name);
+
+ data_size = read_bin_file(file_name, LCD_EXTERN_INIT_ON_MAX);
+ if (data_size == 0) {
+ ALOGE("%s, %s data_size %d error!\n", __func__, str, data_size);
+ return -1;
+ }
+ buf[0] = data_size;
+ buf[1] = 0x00;
+ GetBinData(&buf[2], data_size);
+
+ if (model_debug_flag & DEBUG_NORMAL)
+ ALOGD("%s %s finish\n", __func__, str);
+
+ BinFileUninit();
+
+ return 0;
+}
+
#define TCON_VAC_SET_PARAM_NUM 3
#define TCON_VAC_LUT_PARAM_NUM 256
int handle_tcon_vac(unsigned char *vac_data, unsigned int vac_mem_size)
diff --git a/drivers/display/lcd/lcd_extern/lcd_extern.c b/drivers/display/lcd/lcd_extern/lcd_extern.c
index d418ebb..921dc0c 100644
--- a/drivers/display/lcd/lcd_extern/lcd_extern.c
+++ b/drivers/display/lcd/lcd_extern/lcd_extern.c
@@ -1018,7 +1018,8 @@ static int aml_lcd_extern_init_table_dynamic_size_load_unifykey(
len += 1;
ret = aml_lcd_unifykey_len_check(key_len, len);
if (ret) {
- EXTERR("%s: get %s failed\n", extconf->name, propname);
+ EXTERR("%s: get %s type failed\n",
+ extconf->name, propname);
table[i] = LCD_EXT_CMD_TYPE_END;
table[i+1] = 0;
return -1;
@@ -1028,7 +1029,8 @@ static int aml_lcd_extern_init_table_dynamic_size_load_unifykey(
len += 1;
ret = aml_lcd_unifykey_len_check(key_len, len);
if (ret) {
- EXTERR("%s: get %s failed\n", extconf->name, propname);
+ EXTERR("%s: get %s cmd_size failed\n",
+ extconf->name, propname);
table[i] = LCD_EXT_CMD_TYPE_END;
table[i+1] = 0;
return -1;
@@ -1051,7 +1053,7 @@ static int aml_lcd_extern_init_table_dynamic_size_load_unifykey(
len += cmd_size;
ret = aml_lcd_unifykey_len_check(key_len, len);
if (ret) {
- EXTERR("%s: get %s failed\n", extconf->name, propname);
+ EXTERR("%s: get %s data failed\n", extconf->name, propname);
table[i] = LCD_EXT_CMD_TYPE_END;
table[i+1] = 0;
return -1;
@@ -1073,7 +1075,8 @@ init_table_dynamic_i2c_spi_ukey_next:
len += 1;
ret = aml_lcd_unifykey_len_check(key_len, len);
if (ret) {
- EXTERR("%s: get %s failed\n", extconf->name, propname);
+ EXTERR("%s: get type %s failed\n",
+ extconf->name, propname);
table[i] = LCD_EXT_CMD_TYPE_END;
table[i+1] = 0;
return -1;
@@ -1083,7 +1086,8 @@ init_table_dynamic_i2c_spi_ukey_next:
len += 1;
ret = aml_lcd_unifykey_len_check(key_len, len);
if (ret) {
- EXTERR("%s: get %s failed\n", extconf->name, propname);
+ EXTERR("%s: get type %s failed\n",
+ extconf->name, propname);
table[i] = LCD_EXT_CMD_TYPE_END;
table[i+1] = 0;
return -1;