Ejemplo n.º 1
0
static int dsim_panel_set_acl(struct dsim_device *dsim, int force)
{
	int ret = 0, level = ACL_STATUS_8P;
	struct panel_private *panel = &dsim->priv;

	if (panel == NULL) {
			dsim_err("%s : panel is NULL\n", __func__);
			goto exit;
	}

	if (dsim->priv.siop_enable || LEVEL_IS_HBM(dsim->priv.auto_brightness))  // auto acl or hbm is acl on
		goto acl_update;

	if (!dsim->priv.acl_enable)
		level = ACL_STATUS_0P;

acl_update:
	if(force || dsim->priv.current_acl != panel->acl_cutoff_tbl[level][1]) {
		if((ret = dsim_write_hl_data(dsim,  panel->acl_opr_tbl[level], 2)) < 0) {
			dsim_err("fail to write acl opr command.\n");
			goto exit;
		}
		if((ret = dsim_write_hl_data(dsim, panel->acl_cutoff_tbl[level], 2)) < 0) {
			dsim_err("fail to write acl command.\n");
			goto exit;
		}
		dsim->priv.current_acl = panel->acl_cutoff_tbl[level][1];
		dsim_info("acl: %d, auto_brightness: %d\n", dsim->priv.current_acl, dsim->priv.auto_brightness);
	}
exit:
	if (!ret)
		ret = -EPERM;
	return ret;
}
Ejemplo n.º 2
0
static int s6d7aa0x62_displayon(struct dsim_device *dsim)
{
	int ret = 0;

	dsim_info("MDD : %s was called\n", __func__);

	ret = dsim_write_hl_data(dsim, SEQ_DISPLAY_ON, ARRAY_SIZE(SEQ_DISPLAY_ON));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : DISPLAY_ON\n", __func__);
 		goto displayon_err;
	}

	msleep(20);

	ret = dsim_write_hl_data(dsim, SEQ_BRIGHTNESS_1, ARRAY_SIZE(SEQ_BRIGHTNESS_1));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_BRIGHTNESS_1\n", __func__);
		goto displayon_err;
	}

	ret = dsim_write_hl_data(dsim, SEQ_BRIGHTNESS_2, ARRAY_SIZE(SEQ_BRIGHTNESS_2));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_BRIGHTNESS_2\n", __func__);
		goto displayon_err;
	}

	ret = dsim_write_hl_data(dsim, SEQ_BRIGHTNESS_3, ARRAY_SIZE(SEQ_BRIGHTNESS_3));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_BRIGHTNESS_3\n", __func__);
		goto displayon_err;
	}
displayon_err:
	return ret;

}
Ejemplo n.º 3
0
static int s6d7aa0x62_exit(struct dsim_device *dsim)
{
	int ret = 0;
	dsim_info("MDD : %s was called\n", __func__);
	ret = dsim_write_hl_data(dsim, SEQ_DISPLAY_OFF, ARRAY_SIZE(SEQ_DISPLAY_OFF));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : DISPLAY_OFF\n", __func__);
		goto exit_err;
	}

	msleep(10);

	ret = dsim_write_hl_data(dsim, SEQ_SLEEP_IN, ARRAY_SIZE(SEQ_SLEEP_IN));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SLEEP_IN\n", __func__);
		goto exit_err;
	}

	msleep(150);

	ret = gpio_request_one(backlight_on, GPIOF_OUT_INIT_LOW, "BLIC_ON");
	gpio_free(backlight_on);
	usleep_range(10000, 11000);

exit_err:
	return ret;
}
static int s6e3ha0_wqhd_exit(struct dsim_device *dsim)
{
	int ret = 0;

	dsim_info("MDD : %s was called\n", __func__);

	ret = dsim_write_hl_data(dsim, SEQ_DISPLAY_OFF, ARRAY_SIZE(SEQ_DISPLAY_OFF));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : DISPLAY_OFF\n", __func__);
		goto exit_err;
	}

	msleep(10);

	ret = dsim_write_hl_data(dsim, SEQ_SLEEP_IN, ARRAY_SIZE(SEQ_SLEEP_IN));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SLEEP_IN\n", __func__);
		goto exit_err;
	}

	msleep(120);

exit_err:
	return ret;
}
static void dsim_panel_set_elvss(struct dsim_device *dsim)
{
	u8 *elvss = NULL;
	unsigned char SEQ_ELVSS[ELVSS_LEN_MAX] = {0, };
	struct panel_private *panel = &dsim->priv;
	bool bIsHbm = (LEVEL_IS_HBM(panel->auto_brightness) && (panel->bd->props.brightness == panel->bd->props.max_brightness));

	SEQ_ELVSS[0] = aid_dimming_dynamic.elvss_reg;
	elvss = get_elvss_from_index(dsim, dsim->priv.br_index, dsim->priv.caps_enable);
	if (elvss == NULL) {
		dsim_err("%s : failed to get elvss value\n", __func__);
		return;
	}
	memcpy(&SEQ_ELVSS[1], dsim->priv.elvss_set, aid_dimming_dynamic.elvss_len - 1);
	memcpy(SEQ_ELVSS, elvss, aid_dimming_dynamic.elvss_cmd_cnt);

	SEQ_ELVSS[aid_dimming_dynamic.elvss_len - 1] += dsim_panel_get_elvssoffset(dsim);
	if(bIsHbm)
		SEQ_ELVSS[2] = 0x0A;
	if(dynamic_lcd_type == LCD_TYPE_S6E3HA2_WQHD) {
		dsim_info("%s elvss ha2\n", __func__);
		if (dsim_write_hl_data(dsim, SEQ_ELVSS, aid_dimming_dynamic.elvss_len) < 0)
			dsim_err("%s : failed to write elvss \n", __func__);
	} else {
		dsim_info("%s elvss ha3/hf3\n", __func__);
		memcpy(dsim->priv.tset, &SEQ_ELVSS[1], aid_dimming_dynamic.elvss_len - 1);
		dsim_panel_set_tset(dsim, 1);
	}
}
static void dsim_panel_dynamic_aid_ctrl(struct dsim_device *dsim)
{
	u8 aid[S6E3HF3_AID_CMD_CNT] = { 0, };
	int index = 0;
	int current_pbr;
	struct panel_private *panel = &dsim->priv;
	struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->dim_info;

	if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) {
		memcpy(aid, S6E3HF3_SEQ_AOR, sizeof(S6E3HF3_SEQ_AOR));
	} else {
		memcpy(aid, S6E3HA3_SEQ_AOR, sizeof(S6E3HA3_SEQ_AOR));
	}

	if (dimming_info == NULL) {
		dsim_err("%s : dimming info is NULL\n", __func__);
		goto aid_ctrl_err;
	}
	current_pbr = panel->bd->props.brightness;
	index = dsim->priv.br_index + 1;

	if (index > MAX_BR_INFO)
		index = MAX_BR_INFO;

	if (panel->inter_aor_tbl == NULL)
		return;

	aid[9] = panel->inter_aor_tbl[current_pbr * 2];
	aid[10] = panel->inter_aor_tbl[current_pbr * 2 + 1];

	dsim_info("%s %d aid : %x : %x : %x\n", __func__, current_pbr, aid[0], aid[9], aid[10]);

	if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) {
		if (dsim_write_hl_data(dsim, aid, S6E3HF3_AID_CMD_CNT) < 0)
			dsim_err("%s : failed to write gamma \n", __func__);
	} else {
		if (dsim_write_hl_data(dsim, aid, S6E3HA3_AID_CMD_CNT) < 0)
			dsim_err("%s : failed to write gamma \n", __func__);
	}

aid_ctrl_err:

	return;
}
static int dsim_panel_set_acl(struct dsim_device *dsim, int force)
{
	int ret = 0, level, enabled;
	struct panel_private *panel = &dsim->priv;

	if (panel == NULL) {
			dsim_err("%s : panel is NULL\n", __func__);
			goto exit;
	}

	level = ACL_OPR_15P;
	enabled = ACL_STATUS_ON;

	// siop = weak temperature
	if (panel->siop_enable)  // auto acl or hbm is acl on
		goto acl_update;

	level = dsim->priv.acl_enable;
	enabled = (dsim->priv.acl_enable != ACL_OPR_OFF);

acl_update:
	if(force || dsim->priv.current_acl != level) {
//		dsim_info("acl : opr_tbl %d %d %02x %02x %02x %02x %02x\n", level, (int) ACL_OPR_LEN, panel->acl_opr_tbl[level][0], panel->acl_opr_tbl[level][1], panel->acl_opr_tbl[level][2], panel->acl_opr_tbl[level][3], panel->acl_opr_tbl[level][4] );
		if((ret = dsim_write_hl_data(dsim,  panel->acl_opr_tbl[level], ACL_OPR_LEN)) < 0) {
			dsim_err("fail to write acl opr command.\n");
			goto exit;
		}
//		dsim_info("acl : cutoff_tbl %d %d  %02x %02x \n", enabled, (int) ACL_CMD_LEN, panel->acl_cutoff_tbl[enabled][0], panel->acl_cutoff_tbl[enabled][1] );
		if((ret = dsim_write_hl_data(dsim, panel->acl_cutoff_tbl[enabled], ACL_CMD_LEN)) < 0) {
			dsim_err("fail to write acl command.\n");
			goto exit;
		}
		dsim->priv.current_acl = level;
		dsim_info("acl : %x, opr: %x\n",
			panel->acl_cutoff_tbl[enabled][1], panel->acl_opr_tbl[level][ACL_OPR_LEN-1]);
		dsim_info("acl: %d(%x), auto_brightness: %d\n", dsim->priv.current_acl, panel->acl_opr_tbl[level][ACL_OPR_LEN-1],dsim->priv.auto_brightness);
	}
exit:
	if (!ret)
		ret = -EPERM;
	return ret;
}
Ejemplo n.º 8
0
static void dsim_panel_aid_ctrl_for_hmt(struct dsim_device *dsim)
{
	u8 *aid = NULL;
	aid = get_aid_from_index_for_hmt(dsim, dsim->priv.hmt_br_index);
	if (aid == NULL) {
		dsim_err("%s : faield to get aid value\n", __func__);
		return;
	}
	if (dsim_write_hl_data(dsim, aid, AID_CMD_CNT + 1) < 0)
		dsim_err("%s : failed to write hmt aid \n", __func__);
}
Ejemplo n.º 9
0
static void dsim_panel_gamma_ctrl_for_hmt(struct dsim_device *dsim)
{
	u8 *gamma = NULL;
	gamma = get_gamma_from_index_for_hmt(dsim, dsim->priv.hmt_br_index);
	if (gamma == NULL) {
		dsim_err("%s :faied to get gamma\n", __func__);
		return;
	}

	if (dsim_write_hl_data(dsim, gamma, GAMMA_CMD_CNT) < 0)
		dsim_err("%s : failed to write hmt gamma \n", __func__);
}
Ejemplo n.º 10
0
static int low_level_set_brightness_for_hmt(struct dsim_device *dsim ,int force)
{
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);

	dsim_panel_gamma_ctrl_for_hmt(dsim);

	dsim_panel_aid_ctrl_for_hmt(dsim);

	dsim_panel_set_elvss_for_hmt(dsim);

	dsim_panel_set_vint(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE_L, ARRAY_SIZE(SEQ_GAMMA_UPDATE_L)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);

	dsim_panel_set_acl(dsim, force);

	dsim_panel_set_tset(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_FC, ARRAY_SIZE(SEQ_TEST_KEY_OFF_FC)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)) < 0)
		dsim_err("%s : fail to write F0 on command\n", __func__);

	return 0;
}
static int s6e3ha0_wqhd_displayon(struct dsim_device *dsim)
{
	int ret = 0;

	dsim_info("MDD : %s was called\n", __func__);
	
	ret = dsim_write_hl_data(dsim, SEQ_DISPLAY_ON, ARRAY_SIZE(SEQ_DISPLAY_ON));
	if (ret < 0) {
 		dsim_err("%s : fail to write CMD : DISPLAY_ON\n", __func__);
 		goto displayon_err;
	}

displayon_err:
	return ret;
}
Ejemplo n.º 12
0
static int dsim_panel_set_vint(struct dsim_device *dsim, int force)
{
	int ret = 0;
	int nit = 0;
	int i, level = 0;
	int arraySize = ARRAY_SIZE(VINT_DIM_TABLE);
	struct panel_private* panel = &(dsim->priv);
	unsigned char SEQ_VINT[VINT_LEN] = {VINT_REG, 0x8B, 0x21};
	unsigned char *vint_tbl = (unsigned char *)VINT_TABLE;

#if defined(CONFIG_PANEL_S6E3HF2_DYNAMIC)		  // edge
	unsigned char panelline = panel->id[0] & 0xc0;
	if (panel->a3_vint_updated && panelline == S6E3HF2_A3_LINE_ID) {
		vint_tbl = panel->a3_vint;
	}
#endif

	level = arraySize - 1;

	if(UNDER_MINUS_20(panel->temperature))
		goto set_vint;
#ifdef CONFIG_LCD_HMT
	if(panel->hmt_on == HMT_ON)
		goto set_vint;
#endif
	nit = get_actual_br_value(dsim, panel->br_index);

	level = arraySize - 1;

	for (i = 0; i < arraySize; i++) {
		if (nit <= VINT_DIM_TABLE[i]) {
			level = i;
			goto set_vint;
		}
	}
set_vint:
	if(force || panel->current_vint != vint_tbl[level]) {
		SEQ_VINT[VINT_LEN - 1] = vint_tbl[level];
		if ((ret = dsim_write_hl_data(dsim, SEQ_VINT, ARRAY_SIZE(SEQ_VINT))) < 0) {
			dsim_err("fail to write vint command.\n");
			ret = -EPERM;
		}
		panel->current_vint = vint_tbl[level];
		dsim_info("vint: %02x\n", panel->current_vint);
	}
	return ret;
}
Ejemplo n.º 13
0
static int mdnie_lite_write_set(struct dsim_device *dsim, struct lcd_seq_info *seq, u32 num)
{
	int ret = 0, i;

	for (i = 0; i < num; i++) {
		if (seq[i].cmd) {
			ret = dsim_write_hl_data(dsim, seq[i].cmd, seq[i].len);
			if (ret != 0) {
				dsim_err("%s failed.\n", __func__);
				return ret;
			}
		}
		if (seq[i].sleep)
			usleep_range(seq[i].sleep * 1000 , seq[i].sleep * 1000);
	}
	return ret;
}
static void dsim_panel_aid_ctrl(struct dsim_device *dsim)
{
	u8 *aid = NULL;
	unsigned char SEQ_AID[AID_CMD_CNT_MAX] = { 0, };

	aid = get_aid_from_index(dsim, dsim->priv.br_index);
	if (aid == NULL) {
		dsim_err("%s : failed to get elvss value\n", __func__);
		return;
	}
	SEQ_AID[0] = aid[0];
	memcpy(&SEQ_AID[1], dsim->priv.aid, aid_dimming_dynamic.aid_cmd_cnt - 1);	// HA2/HF3 not read. but no danger
	memcpy(&SEQ_AID[aid_dimming_dynamic.aid_reg_offset], aid + 1, aid_dimming_dynamic.aid_cmd_cnt - aid_dimming_dynamic.aid_reg_offset + 1);

	if (dsim_write_hl_data(dsim, SEQ_AID, aid_dimming_dynamic.aid_cmd_cnt) < 0)
		dsim_err("%s : failed to write aid \n", __func__);

}
Ejemplo n.º 15
0
static void dsim_panel_set_elvss(struct dsim_device *dsim)
{
	u8 *elvss = NULL;
	unsigned char SEQ_ELVSS[ELVSS_LEN] = {ELVSS_REG, };

	elvss = get_elvss_from_index(dsim, dsim->priv.br_index, dsim->priv.caps_enable);
	if (elvss == NULL) {
		dsim_err("%s : failed to get elvss value\n", __func__);
		return;
	}
	memcpy(&SEQ_ELVSS[1], dsim->priv.elvss_set, ELVSS_LEN - 1);
	memcpy(SEQ_ELVSS, elvss, ELVSS_CMD_CNT);

	SEQ_ELVSS[ELVSS_LEN - 1] += dsim_panel_get_elvssoffset(dsim);

	if (dsim_write_hl_data(dsim, SEQ_ELVSS, ELVSS_LEN) < 0)
		dsim_err("%s : failed to write elvss \n", __func__);
}
Ejemplo n.º 16
0
static void dsim_panel_set_elvss_for_hmt(struct dsim_device *dsim)
{
	u8 *elvss = NULL;
	unsigned char SEQ_ELVSS[ELVSS_LEN] = {ELVSS_REG, };

	elvss = get_elvss_from_index_for_hmt(dsim, dsim->priv.hmt_br_index, dsim->priv.acl_enable);
	if (elvss == NULL) {
		dsim_err("%s : failed to get elvss value\n", __func__);
		return;
	}
	memcpy(&SEQ_ELVSS[1], dsim->priv.elvss_set, ELVSS_LEN - 1);
	memcpy(SEQ_ELVSS, elvss, ELVSS_CMD_CNT);

	if(UNDER_MINUS_20(dsim->priv.temperature))				// tset
		SEQ_ELVSS[ELVSS_LEN - 1] -= TSET_MINUS_OFFSET;

	if (dsim_write_hl_data(dsim, SEQ_ELVSS, ELVSS_LEN) < 0)
		dsim_err("%s : failed to write elvss \n", __func__);
}
Ejemplo n.º 17
0
static int dsim_panel_set_tset(struct dsim_device *dsim, int force)
{
	int ret = 0;
	int tset = 0;
	unsigned char SEQ_TSET[TSET_LEN] = {TSET_REG, };

	tset = (dsim->priv.temperature < 0) ? BIT(7) | abs(dsim->priv.temperature) : dsim->priv.temperature;

	if(force || dsim->priv.tset[TSET_LEN - 2] != tset) {
		memcpy(&SEQ_TSET[1], dsim->priv.tset, TSET_LEN - 1);
		dsim->priv.tset[TSET_LEN - 2] = SEQ_TSET[TSET_LEN - 1] = tset;
		if ((ret = dsim_write_hl_data(dsim, SEQ_TSET, ARRAY_SIZE(SEQ_TSET))) < 0) {
			dsim_err("fail to write tset command.\n");
			ret = -EPERM;
		}
		dsim_info("%s temperature: %d, tset: %d\n",
			__func__, dsim->priv.temperature, SEQ_TSET[TSET_LEN - 1]);
	}
	return ret;
}
Ejemplo n.º 18
0
static int dsim_panel_set_hbm(struct dsim_device *dsim, int force)
{
	int ret = 0, level = LEVEL_IS_HBM(dsim->priv.auto_brightness);
	struct panel_private *panel = &dsim->priv;

	if (panel == NULL) {
		dsim_err("%s : panel is NULL\n", __func__);
		goto exit;
	}

	if(force || dsim->priv.current_hbm != panel->hbm_tbl[level][1]) {
		dsim->priv.current_hbm = panel->hbm_tbl[level][1];
		if((ret = dsim_write_hl_data(dsim, panel->hbm_tbl[level], ARRAY_SIZE(SEQ_HBM_OFF))) < 0) {
			dsim_err("fail to write hbm command.\n");
			ret = -EPERM;
		}
		dsim_info("hbm: %d, auto_brightness: %d\n", dsim->priv.current_hbm, dsim->priv.auto_brightness);
	}
exit:
	return ret;
}
static int dsim_panel_set_vint(struct dsim_device *dsim, int force)
{
	int ret = 0;
	int nit = 0;
	int i, level = 0;
	int arraySize = ARRAY_SIZE(VINT_DIM_TABLE);
	struct panel_private* panel = &(dsim->priv);
	unsigned char SEQ_VINT[VINT_LEN] = {VINT_REG, 0x8B, 0x21};
	unsigned char *vint_tbl = aid_dimming_dynamic.vint_dim_offset;

	level = arraySize - 1;

	SEQ_VINT[1] = aid_dimming_dynamic.vint_reg2;

	if(UNDER_MINUS_20(panel->temperature))
		goto set_vint;
#ifdef CONFIG_LCD_HMT
	if(panel->hmt_on == HMT_ON)
		goto set_vint;
#endif
	nit = get_actual_br_value(dsim, panel->br_index);

	for (i = 0; i < arraySize; i++) {
		if (nit <= VINT_DIM_TABLE[i]) {
			level = i;
			goto set_vint;
		}
	}
set_vint:
	if(force || panel->current_vint != vint_tbl[level]) {
		SEQ_VINT[VINT_LEN - 1] = vint_tbl[level];
		if ((ret = dsim_write_hl_data(dsim, SEQ_VINT, ARRAY_SIZE(SEQ_VINT))) < 0) {
			dsim_err("fail to write vint command.\n");
			ret = -EPERM;
		}
		panel->current_vint = vint_tbl[level];
		dsim_info("vint: %02x\n", panel->current_vint);
	}
	return ret;
}
Ejemplo n.º 20
0
static void dsim_panel_set_elvss(struct dsim_device *dsim)
{
	u8 *elvss = NULL;
	unsigned char SEQ_ELVSS[ELVSS_LEN_MAX] = {0, };
	struct panel_private *panel = &dsim->priv;
	bool bIsHbm = (LEVEL_IS_HBM(panel->auto_brightness) && (panel->bd->props.brightness == panel->bd->props.max_brightness));

	SEQ_ELVSS[0] = ELVSS_REG;
	elvss = get_elvss_from_index(dsim, dsim->priv.br_index, dsim->priv.caps_enable);
	if (elvss == NULL) {
		dsim_err("%s : failed to get elvss value\n", __func__);
		return;
	}
	memcpy(&SEQ_ELVSS[1], dsim->priv.elvss_set, ELVSS_LEN - 1);
	memcpy(SEQ_ELVSS, elvss, ELVSS_CMD_CNT);

	SEQ_ELVSS[ELVSS_LEN - 1] += dsim_panel_get_elvssoffset(dsim);
	if(bIsHbm ||
		((panel->interpolation) && (panel->weakness_hbm_comp == HBM_COLORBLIND_ON)))
		SEQ_ELVSS[2] = 0x0A;
	if (dsim_write_hl_data(dsim, SEQ_ELVSS, ELVSS_LEN) < 0)
		dsim_err("%s : failed to write elvss \n", __func__);
}
static void dsim_panel_aid_interpolation(struct dsim_device *dsim)
{
	int current_pbr;
	struct panel_private *panel = &dsim->priv;
	u8 aid[S6E3HF3_AID_CMD_CNT] = { 0, };
	if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) {
		memcpy(aid, S6E3HF3_SEQ_AOR, sizeof(S6E3HF3_SEQ_AOR));
	}
	else{
		memcpy(aid, S6E3HA3_SEQ_AOR, sizeof(S6E3HA3_SEQ_AOR));
	}

	current_pbr = panel->bd->props.brightness;

	if (panel->inter_aor_tbl == NULL)
		return;
	aid[9] = panel->inter_aor_tbl[current_pbr * 2];
	aid[10] = panel->inter_aor_tbl[current_pbr * 2 + 1];

	dsim_info("%s %d = aid : %x : %x : %x\n", __func__, current_pbr, aid[0], aid[9], aid[10]);

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);

	if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) {
		if (dsim_write_hl_data(dsim, aid, S6E3HF3_AID_CMD_CNT) < 0)
			dsim_err("%s : failed to write gamma \n", __func__);
	} else {
		if (dsim_write_hl_data(dsim, aid, S6E3HA3_AID_CMD_CNT) < 0)
			dsim_err("%s : failed to write gamma \n", __func__);
	}
	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE_L, ARRAY_SIZE(SEQ_GAMMA_UPDATE_L)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);

	return;
}
Ejemplo n.º 22
0
static int low_level_set_brightness(struct dsim_device *dsim ,int force)
{

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);

	dsim_panel_gamma_ctrl(dsim);

	dsim_panel_aid_ctrl(dsim);

	dsim_panel_set_elvss(dsim);

	dsim_panel_set_vint(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE_L, ARRAY_SIZE(SEQ_GAMMA_UPDATE_L)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);

	dsim_panel_set_acl(dsim, force);

	dsim_panel_set_tset(dsim, force);

#ifdef CONFIG_LCD_ALPM
	if (!(dsim->priv.current_alpm && dsim->priv.alpm))
#endif
		dsim_panel_set_hbm(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_FC, ARRAY_SIZE(SEQ_TEST_KEY_OFF_FC)) < 0)
			dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)) < 0)
		dsim_err("%s : fail to write F0 on command\n", __func__);

	return 0;
}
static int low_level_set_brightness(struct dsim_device *dsim ,int force)
{

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)) < 0)
		dsim_err("%s : fail to write F0 on command.\n", __func__);

	dsim_panel_gamma_ctrl(dsim);

#ifdef AID_INTERPOLATION
#ifdef CONFIG_LCD_BURNIN_CORRECTION
	if((dsim->priv.ldu_correction_state == 0) &&
		((dsim->priv.weakness_hbm_comp != HBM_COLORBLIND_ON) || (dsim->priv.interpolation != 1))) {
#else
	if((dsim->priv.weakness_hbm_comp != HBM_COLORBLIND_ON) || (dsim->priv.interpolation != 1)) {
#endif
		if (dynamic_lcd_type ==	LCD_TYPE_S6E3HA2_WQHD)
			dsim_panel_aid_ctrl(dsim);
		else
			dsim_panel_dynamic_aid_ctrl(dsim);
	}
	else
		dsim_panel_aid_ctrl(dsim);
#else
	dsim_panel_aid_ctrl(dsim);
#endif

	dsim_panel_set_elvss(dsim);

	dsim_panel_set_vint(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE_L, ARRAY_SIZE(SEQ_GAMMA_UPDATE_L)) < 0)
		dsim_err("%s : failed to write gamma \n", __func__);

	dsim_panel_set_acl(dsim, force);
	if(dynamic_lcd_type == LCD_TYPE_S6E3HA2_WQHD)
		dsim_panel_set_tset(dsim, force);

#ifdef CONFIG_LCD_ALPM
	if (!(dsim->priv.current_alpm && dsim->priv.alpm))
#endif
		dsim_panel_set_hbm(dsim, force);

	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_FC, ARRAY_SIZE(SEQ_TEST_KEY_OFF_FC)) < 0)
			dsim_err("%s : fail to write F0 on command.\n", __func__);
	if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)) < 0)
		dsim_err("%s : fail to write F0 on command\n", __func__);

	return 0;
}

static int get_acutal_br_index(struct dsim_device *dsim, int br)
{
	int i;
	int min;
	int gap;
	int index = 0;
	struct panel_private *panel = &dsim->priv;
	struct SmtDimInfo *dimming_info = panel->dim_info;

	if (dimming_info == NULL) {
		dsim_err("%s : dimming_info is NULL\n", __func__);
		return 0;
	}

	min = MAX_BRIGHTNESS;

	for (i = 0; i < MAX_BR_INFO; i++) {
		if (br > dimming_info[i].br)
			gap = br - dimming_info[i].br;
		else
			gap = dimming_info[i].br - br;

		if (gap == 0) {
			index = i;
			break;
		}

		if (gap < min) {
			min = gap;
			index = i;
		}
	}
	return index;
}
static int s6e3ha0_wqhd_init(struct dsim_device *dsim)
{
	int ret = 0;

	dsim_info("MDD : %s was called\n", __func__);

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0));
	if (ret < 0) {	
		dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_SINGLE_DSI_1, ARRAY_SIZE(SEQ_SINGLE_DSI_1));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_SINGLE_DSI_1\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_SINGLE_DSI_2, ARRAY_SIZE(SEQ_SINGLE_DSI_2));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_SINGLE_DSI_2\n", __func__);
		goto init_err;
	}
	msleep(5);

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_SLEEP_OUT, ARRAY_SIZE(SEQ_SLEEP_OUT));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__);
		goto init_err;
	}

	msleep(20);

	/* Common Setting */
	ret = dsim_write_hl_data(dsim, SEQ_TOUCH_HSYNC, ARRAY_SIZE(SEQ_TOUCH_HSYNC));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TOUCH_HSYNC\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_TOUCH_VSYNC, ARRAY_SIZE(SEQ_TOUCH_VSYNC));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TOUCH_VSYNC\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_PENTILE_SETTING, ARRAY_SIZE(SEQ_PENTILE_SETTING));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_PENTILE_SETTING\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_TE_ON, ARRAY_SIZE(SEQ_TE_ON));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TE_ON\n", __func__);
		goto init_err;
	}

	msleep(120);

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_FC, ARRAY_SIZE(SEQ_TEST_KEY_OFF_FC));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_OFF_FC\n", __func__);
		goto init_err;
	}

#ifndef CONFIG_PANEL_AID_DIMMING
	/* Brightness Setting */
	ret = dsim_write_hl_data(dsim, SEQ_GAMMA_CONDITION_SET, ARRAY_SIZE(SEQ_GAMMA_CONDITION_SET));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_GAMMA_CONDITION_SET\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_AOR_CONTROL, ARRAY_SIZE(SEQ_AOR_CONTROL));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_AOR_CONTROL\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_GAMMA_UPDATE\n", __func__);
		goto init_err;
	}

	/* elvss */
	ret = dsim_write_hl_data(dsim, SEQ_TSET_GLOBAL, ARRAY_SIZE(SEQ_TSET_GLOBAL));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TSET_GLOBAL\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_TSET, ARRAY_SIZE(SEQ_TSET));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TSET\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_ELVSS_SET, ARRAY_SIZE(SEQ_ELVSS_SET));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_ELVSS_SET\n", __func__);
		goto init_err;
	}
	/* ACL Setting */
	ret = dsim_write_hl_data(dsim, SEQ_ACL_OFF, ARRAY_SIZE(SEQ_ACL_OFF));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_ACL_OFF\n", __func__);
		goto init_err;
	}
	ret = dsim_write_hl_data(dsim, SEQ_ACL_OFF_OPR, ARRAY_SIZE(SEQ_ACL_OFF_OPR));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_ACL_OFF_OPR\n", __func__);
		goto init_err;
	}
#endif

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_OFF_F0\n", __func__);
		goto init_err;
	}
init_err:
	return ret;
}
Ejemplo n.º 25
0
static int s6d7aa0x62_init(struct dsim_device *dsim)
{
	int ret;

	dsim_info("MDD : %s was called\n", __func__);

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F1, ARRAY_SIZE(SEQ_TEST_KEY_ON_F1));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F1\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC));
	if (ret < 0) {
		dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_OTP_RELOAD, ARRAY_SIZE(SEQ_OTP_RELOAD));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_OTP_RELOAD\n", __func__);
		goto init_exit;
	}

#if 0
	ret = dsim_read_hl_data(dsim, S6D7AA0X62_ID_REG, S6D7AA0X62_ID_LEN, dsim->priv.id);
	if (ret != S6D7AA0X62_ID_LEN) {
		dsim_err("%s : can't find connected panel. check panel connection\n",__func__);
	}


	dsim_info("READ ID : ");
	for(i = 0; i < S6D7AA0X62_ID_LEN; i++)
		dsim_info("%02x, ", dsim->priv.id[i]);
	dsim_info("\n");
#else
	s6d7aa0x62_read_init_info(dsim);
#endif
	ret = dsim_write_hl_data(dsim, SEQ_INIT_1, ARRAY_SIZE(SEQ_INIT_1));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_1\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_2, ARRAY_SIZE(SEQ_INIT_2));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_2\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_3, ARRAY_SIZE(SEQ_INIT_3));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_3\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_4, ARRAY_SIZE(SEQ_INIT_4));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_4\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_5, ARRAY_SIZE(SEQ_INIT_5));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_5\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_6, ARRAY_SIZE(SEQ_INIT_6));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_6\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_7, ARRAY_SIZE(SEQ_INIT_7));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_7\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_8, ARRAY_SIZE(SEQ_INIT_8));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_8\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_9, ARRAY_SIZE(SEQ_INIT_9));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_9\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_10, ARRAY_SIZE(SEQ_INIT_10));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_10\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_11, ARRAY_SIZE(SEQ_INIT_11));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_11\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_12, ARRAY_SIZE(SEQ_INIT_12));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_12\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_13, ARRAY_SIZE(SEQ_INIT_13));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_13\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_14, ARRAY_SIZE(SEQ_INIT_14));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_14\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_15, ARRAY_SIZE(SEQ_INIT_15));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_15\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_16, ARRAY_SIZE(SEQ_INIT_16));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_16\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_INIT_17, ARRAY_SIZE(SEQ_INIT_17));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_INIT_17\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_GAMMA_1, ARRAY_SIZE(SEQ_GAMMA_1));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_GAMMA_1\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_GAMMA_2, ARRAY_SIZE(SEQ_GAMMA_2));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_GAMMA_2\n", __func__);
		goto init_exit;
	}

	ret = dsim_write_hl_data(dsim, SEQ_SLEEP_OUT, ARRAY_SIZE(SEQ_SLEEP_OUT));
	if (ret < 0) {
		dsim_err(":%s fail to write CMD : SEQ_SLEEP_OUT\n", __func__);
		goto init_exit;
	}

	msleep(120);

init_exit:
	return ret;
}
int dsim_panel_set_brightness(struct dsim_device *dsim, int force)
{
	int ret = 0;
#ifndef CONFIG_PANEL_AID_DIMMING
	dsim_info("%s:this panel does not support dimming \n", __func__);
#else
	struct dim_data *dimming;
	struct panel_private *panel = &dsim->priv;
	int p_br = panel->bd->props.brightness;
	int acutal_br = 0;
	int real_br = 0;
	int auto_offset = 0;
	int prev_index = panel->br_index;
	bool bIsHbm = (LEVEL_IS_HBM(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness));
	bool bIsHbmArea = (LEVEL_IS_HBM_AREA(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness));

#ifdef CONFIG_LCD_HMT
	if(panel->hmt_on == HMT_ON) {
		pr_info("%s hmt is enabled, plz set hmt brightness \n", __func__);
		goto set_br_exit;
	}
#endif

	dimming = (struct dim_data *)panel->dim_data;
	if ((dimming == NULL) || (panel->br_tbl == NULL)) {
		dsim_info("%s : this panel does not support dimming\n", __func__);
		return ret;
	}
	panel->acl_enable = ACL_OPR_15P;

	if(bIsHbmArea) {
		auto_offset = 13 - panel->auto_brightness;
		panel->br_index = MAX_BR_INFO - auto_offset;
		acutal_br = real_br = get_actual_br_value(dsim, panel->br_index);
		panel->interpolation = 1;
		panel->acl_enable = ACL_OPR_8P;
		goto set_brightness;
	} else {
		panel->interpolation = 0;
	}

	if (panel->weakness_hbm_comp == HBM_COLORBLIND_ON)
		acutal_br = panel->hbm_inter_br_tbl[p_br];
	else
		acutal_br = panel->br_tbl[p_br];
	panel->br_index = get_acutal_br_index(dsim, acutal_br);
	real_br = get_actual_br_value(dsim, panel->br_index);
	panel->caps_enable = CAPS_IS_ON(real_br);

	if(bIsHbm) {
		panel->br_index = panel->hbm_index;
		panel->caps_enable = 1;				// hbm is caps on
		panel->acl_enable = ACL_OPR_8P;
	}

	if (real_br > MAX_BRIGHTNESS) {
		panel->interpolation = 1;
	} else {
		panel->interpolation = 0;
	}
	if((!bIsHbm) && (p_br == 255)) {
		if (panel->weakness_hbm_comp == HBM_GALLERY_ON) {
			panel->acl_enable = ACL_OPR_OFF;
		} else {
			panel->acl_enable = ACL_OPR_8P;
		}
	}


	if (panel->state != PANEL_STATE_RESUMED) {
		dsim_info("%s : panel is not active state..\n", __func__);
		goto set_br_exit;
	}

#ifdef AID_INTERPOLATION
    if (!force && panel->br_index == prev_index) {
		if (dynamic_lcd_type ==	LCD_TYPE_S6E3HA2_WQHD)
			goto set_br_exit;
#ifdef CONFIG_LCD_BURNIN_CORRECTION
		if((panel->ldu_correction_state == 0) &&
			((panel->weakness_hbm_comp != HBM_COLORBLIND_ON) || (panel->interpolation != 1))) {
#else
		if((panel->weakness_hbm_comp != HBM_COLORBLIND_ON) || (panel->interpolation != 1)) {
#endif
			mutex_lock(&panel->lock);
			dsim_panel_aid_interpolation(dsim);

	        ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0));
	        if (ret < 0) {
		        dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__);
		        goto set_br_exit;
	        }
			dsim_panel_set_acl(dsim, 1);
	        ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0));
	        if (ret < 0) {
		        dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__);
		        goto set_br_exit;
	        }
			mutex_unlock(&panel->lock);
		}
		goto set_br_exit;
	}
#else
	if (!force && panel->br_index == prev_index)
		goto set_br_exit;
#endif

	if ((acutal_br == 0) || (real_br == 0))
		goto set_br_exit;

set_brightness:

	dsim_info("%s : platform : %d, : mapping : %d, real : %d, index : %d,  interpolation : %d\n",
		__func__, p_br, acutal_br, real_br, panel->br_index+1,  panel->interpolation);
	mutex_lock(&panel->lock);

	ret = low_level_set_brightness(dsim, force);
	if (ret) {
		dsim_err("%s failed to set brightness : %d\n", __func__, acutal_br);
	}
	mutex_unlock(&panel->lock);

set_br_exit:
#endif
	return ret;
}

#ifdef CONFIG_LCD_HMT
#ifdef CONFIG_PANEL_AID_DIMMING
static unsigned char *get_gamma_from_index_for_hmt(struct dsim_device *dsim, int index)
{
	struct panel_private *panel = &dsim->priv;
	struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info;

	if (dimming_info == NULL) {
		dsim_err("%s : dimming info is NULL\n", __func__);
		goto get_gamma_err;
	}

	if (index > HMT_MAX_BR_INFO - 1)
		index = HMT_MAX_BR_INFO - 1;

	return (unsigned char *)dimming_info[index].gamma;

get_gamma_err:
	return NULL;
}

static unsigned char *get_aid_from_index_for_hmt(struct dsim_device *dsim, int index)
{
	struct panel_private *panel = &dsim->priv;
	struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info;

	if (dimming_info == NULL) {
		dsim_err("%s : dimming info is NULL\n", __func__);
		goto get_aid_err;
	}

	if (index > HMT_MAX_BR_INFO - 1)
		index = HMT_MAX_BR_INFO - 1;

	return (u8 *)dimming_info[index].aid;

get_aid_err:
	return NULL;
}

static unsigned char *get_elvss_from_index_for_hmt(struct dsim_device *dsim, int index, int caps)
{
	struct panel_private *panel = &dsim->priv;
	struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info;

	if (dimming_info == NULL) {
		dsim_err("%s : dimming info is NULL\n", __func__);
		goto get_elvess_err;
	}

	if(caps)
		return (unsigned char *)dimming_info[index].elvCaps;
	else
		return (unsigned char *)dimming_info[index].elv;

get_elvess_err:
	return NULL;
}


static void dsim_panel_gamma_ctrl_for_hmt(struct dsim_device *dsim)
{
	u8 *gamma = NULL;
	gamma = get_gamma_from_index_for_hmt(dsim, dsim->priv.hmt_br_index);
	if (gamma == NULL) {
		dsim_err("%s :faied to get gamma\n", __func__);
		return;
	}

	if (dsim_write_hl_data(dsim, gamma, GAMMA_CMD_CNT) < 0)
		dsim_err("%s : failed to write hmt gamma \n", __func__);
}