{
enum vmode_e vmode = get_current_vmode();
struct am_drm_lcd_s *lcd = encoder_to_lcd(encoder);
- int retry_cnt = 0;
if (!lcd)
return;
mutex_lock(&lcd->lcd_drv->power_mutex);
aml_lcd_notifier_call_chain(LCD_EVENT_PREPARE, NULL);
aml_lcd_notifier_call_chain(LCD_EVENT_ENABLE, NULL);
- while (lcd->lcd_drv->lcd_config->retry_enable) {
- if (retry_cnt++ > LCD_ENABLE_RETRY_MAX)
+
+ lcd->lcd_drv->lcd_config->retry_enable_cnt = 0;
+ while (lcd->lcd_drv->lcd_config->retry_enable_flag) {
+ if (lcd->lcd_drv->lcd_config->retry_enable_cnt++ >=
+ LCD_ENABLE_RETRY_MAX)
break;
- pr_info("am_drm_lcd: retry enable...%d\n", retry_cnt);
- aml_lcd_notifier_call_chain(LCD_EVENT_DISABLE, NULL);
+ pr_info("am_drm_lcd: retry enable...%d\n",
+ lcd->lcd_drv->lcd_config->retry_enable_cnt);
+ aml_lcd_notifier_call_chain(LCD_EVENT_IF_POWER_OFF, NULL);
msleep(1000);
- aml_lcd_notifier_call_chain(LCD_EVENT_ENABLE, NULL);
+ aml_lcd_notifier_call_chain(LCD_EVENT_IF_POWER_ON, NULL);
}
+ lcd->lcd_drv->lcd_config->retry_enable_cnt = 0;
+
mutex_unlock(&lcd->lcd_drv->power_mutex);
vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE, &vmode);
pr_info("am_drm_lcd: %s %d\n", __func__, __LINE__);
void lcd_if_enable_retry(struct lcd_config_s *pconf)
{
- int retry_cnt = 0;
-
- while (pconf->retry_enable) {
- if (retry_cnt++ > LCD_ENABLE_RETRY_MAX)
+ pconf->retry_enable_cnt = 0;
+ while (pconf->retry_enable_flag) {
+ if (pconf->retry_enable_cnt++ >= LCD_ENABLE_RETRY_MAX)
break;
- LCDPR("retry enable...%d\n", retry_cnt);
+ LCDPR("retry enable...%d\n", pconf->retry_enable_cnt);
aml_lcd_notifier_call_chain(LCD_EVENT_IF_POWER_OFF, NULL);
msleep(1000);
aml_lcd_notifier_call_chain(LCD_EVENT_IF_POWER_ON, NULL);
}
+ pconf->retry_enable_cnt = 0;
}
unsigned char payload[3] = {DT_GEN_RD_1, 1, 0x04};
char str[100];
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
+ struct dsi_config_s *dconf;
- if (lcd_drv->lcd_config->lcd_control.mipi_config->check_en == 0)
+ dconf = lcd_drv->lcd_config->lcd_control.mipi_config;
+ if (dconf->check_en == 0)
return 0;
- LCDPR("%s\n", __func__);
+ if (lcd_debug_print_flag)
+ LCDPR("%s\n", __func__);
rd_data = kmalloc_array(cnt, sizeof(unsigned char), GFP_KERNEL);
if (rd_data == NULL) {
payload[2] = reg;
ret = dsi_read_single(payload, rd_data, cnt);
- if (ret < 0) {
- lcd_drv->lcd_config->lcd_control.mipi_config->check_state = 0;
- lcd_vcbus_setb(L_VCOM_VS_ADDR, 0, 12, 1);
- kfree(rd_data);
- return -1;
- }
+ if (ret < 0)
+ goto mipi_dsi_check_state_err;
if (ret > cnt) {
LCDERR("%s: read back cnt is wrong\n", __func__);
- kfree(rd_data);
- return -1;
+ goto mipi_dsi_check_state_err;
}
- lcd_drv->lcd_config->lcd_control.mipi_config->check_state = 1;
- lcd_vcbus_setb(L_VCOM_VS_ADDR, 1, 12, 1);
len = sprintf(str, "read reg 0x%02x: ", reg);
for (i = 0; i < ret; i++) {
if (i == 0)
}
pr_info("%s\n", str);
+ dconf->check_state = 1;
+ lcd_vcbus_setb(L_VCOM_VS_ADDR, 1, 12, 1);
+ lcd_drv->lcd_config->retry_enable_flag = 0;
+ LCDPR("%s: %d\n", __func__, dconf->check_state);
kfree(rd_data);
return 0;
+
+mipi_dsi_check_state_err:
+ if (lcd_drv->lcd_config->retry_enable_cnt >= LCD_ENABLE_RETRY_MAX) {
+ dconf->check_state = 0;
+ lcd_vcbus_setb(L_VCOM_VS_ADDR, 0, 12, 1);
+ LCDPR("%s: %d\n", __func__, dconf->check_state);
+ }
+ lcd_drv->lcd_config->retry_enable_flag = 1;
+ kfree(rd_data);
+ return -1;
}
/* *************************************************************
}
#endif
- if (dconf->check_en) {
- if (dconf->check_state == 0)
- pconf->retry_enable = 1;
- else
- pconf->retry_enable = 0;
- }
-
if (op_mode_disp != op_mode_init) {
set_mipi_dsi_host(MIPI_DSI_VIRTUAL_CHAN_ID,
0, /* Chroma sub sample, only for
}
}
+ /* update check_state */
+ if (dconf->check_en)
+ dconf->check_state = lcd_vcbus_getb(L_VCOM_VS_ADDR, 12, 1);
+
/* Venc resolution format */
switch (dconf->phy_switch) {
case 1: /* standard */
/* phy config */
mipi_dsi_phy_config(&dsi_phy_config, dconf->bit_rate);
-
- /* update check_state */
- if (dconf->check_en)
- dconf->check_state = lcd_vcbus_getb(L_VCOM_VS_ADDR, 12, 1);
}
static void mipi_dsi_host_on(struct lcd_config_s *pconf)