static int set_acl_on_level(int bl_level)
{
    int cd;
    cd = get_candela_index(bl_level);

    if ((LCD_Get_Value() == 0x20) || bypass_LCD_Id() == 0x20 ||\
            (LCD_Get_Value() == 0x40)) {
        if (!lcd_acl_table_4_8[cd].lux)
            return 1;

        samsung_panel_acl_update_cmds[0].dlen =
            lcd_acl_table_4_8[cd].cmd->dlen;
        samsung_panel_acl_update_cmds[0].payload =
            lcd_acl_table_4_8[cd].cmd->payload;
    } else {
        if (!lcd_acl_table[cd].lux)
            return 1;

        samsung_panel_acl_update_cmds[0].dlen =
            lcd_acl_table[cd].cmd->dlen;
        samsung_panel_acl_update_cmds[0].payload =
            lcd_acl_table[cd].cmd->payload;
    }
    if (!lcd_acl_table_4_8[cd].lux)
        return 1;

    samsung_panel_acl_update_cmds[0].dlen =
        lcd_acl_table_4_8[cd].cmd->dlen;
    samsung_panel_acl_update_cmds[0].payload =
        lcd_acl_table_4_8[cd].cmd->payload;
    return 0;
}
static int set_elvss_level(int bl_level)
{
	unsigned char calc_elvss;
	int cd;
	int id3;
	int id2;
/*	int id2 = (mipi_pd.manufacture_id>>8) & 0xFF;*/

	cd = get_candela_index(bl_level);
/*	id3 = mipi_pd.manufacture_id & 0xFF;*/

#if defined(CONFIG_MACH_COMANCHE)
	calc_elvss = GET_DEFAULT_ELVSS_ID[cd];
#else
	if (id2 != 0xA4)
		calc_elvss = GET_DEFAULT_ELVSS_ID[cd];
	else
		calc_elvss = id3 + GET_ELVSS_ID[cd];
#endif

	pr_debug("%s: ID2=%x, ID3=%x, calc_elvss = %x\n", __func__, id2, id3,
		calc_elvss);
	if (calc_elvss > LCD_ELVSS_RESULT_LIMIT)
		calc_elvss = LCD_ELVSS_RESULT_LIMIT;
	elvss_cond_set[1] = calc_elvss;
	elvss_cond_set[2] = calc_elvss;
	elvss_cond_set[3] = calc_elvss;
	elvss_cond_set[4] = calc_elvss;

	return 0;
}
static int set_elvss_level(int bl_level)
{
    unsigned char calc_elvss;
    int cd;
    unsigned char elvss_pulse;
    cd = get_candela_index(bl_level);
    elvss_pulse = mipi_pd.lcd_elvss_data[0];

    if (elvss_pulse == 0)
        calc_elvss = GET_DEFAULT_ELVSS_ID[cd];
    else
        calc_elvss = elvss_pulse + GET_ELVSS_ID[cd];

    pr_debug("%s: elvss_pulse=%x,calc_elvss = %x\n", __func__, elvss_pulse,
             calc_elvss);
    if (calc_elvss > LCD_ELVSS_RESULT_LIMIT)
        calc_elvss = LCD_ELVSS_RESULT_LIMIT;

    if (elvss_cond_set[2] == calc_elvss)
        return 1;

    elvss_cond_set[2] = calc_elvss;

    return 0;
}
Пример #4
0
static int set_gamma_level(int bl_level, enum gamma_mode_list gamma_mode)
{
	int cd;
	int *lux_tbl = lux_tbl_acl;

	cd = get_candela_index(bl_level);
	if (mipi_pd.lcd_current_cd_idx == cd) {
		pr_debug("mipi_pd.lcd_current_cd_idx :%d cd:%d\n",
			mipi_pd.lcd_current_cd_idx, cd);
		return -1;
		}
	else
		mipi_pd.lcd_current_cd_idx = cd;

	if (gamma_mode == GAMMA_2_2) {
		samsung_panel_gamma_update_cmds[0].dlen = sizeof(gamma_2_2[cd]);
		samsung_panel_gamma_update_cmds[0].payload = gamma_2_2[cd];
	} else if (gamma_mode == GAMMA_1_9) {
		samsung_panel_gamma_update_cmds[0].dlen = sizeof(gamma_1_9[cd]);
		samsung_panel_gamma_update_cmds[0].payload = gamma_1_9[cd];
	} else {
		/*  SMART Dimming gamma_lux;  */
		char pBuffer[256];
		int i;
		int gamma_lux;

		gamma_lux = lux_tbl[cd];

		if (gamma_lux > SmartDimming_CANDELA_UPPER_LIMIT)
			gamma_lux = SmartDimming_CANDELA_UPPER_LIMIT;

		/* Set Minimum Lux for Dimm */

		for (i = SmartDimming_GammaUpdate_Pos;
		     i < sizeof(GAMMA_SmartDimming_COND_SET); i++)
			GAMMA_SmartDimming_COND_SET[i] = 0;
		mipi_pd.smart_s6e39a0x02.brightness_level = gamma_lux;
		generate_gamma(&mipi_pd.smart_s6e39a0x02,
			&(GAMMA_SmartDimming_COND_SET[2]), GAMMA_SET_MAX);
		samsung_panel_gamma_update_cmds[0].dlen =
		    sizeof(GAMMA_SmartDimming_COND_SET);
		samsung_panel_gamma_update_cmds[0].payload =
		    GAMMA_SmartDimming_COND_SET;
		pBuffer[0] = 0;
		for (i = 0; i < sizeof(GAMMA_SmartDimming_COND_SET); i++) {
			snprintf(pBuffer + strnlen(pBuffer, 256), 256, " %02x",
				 GAMMA_SmartDimming_COND_SET[i]);
		}
		pr_info("SD: %03d %s\n", gamma_lux, pBuffer);
		pr_debug("bl_level:%d,cd:%d:Candela:%d\n", bl_level, cd,
			gamma_lux);
	}

	return 0;
}
static int set_gamma_level(int bl_level, enum gamma_mode_list gamma_mode)
{
    int cd;
    int *lux_tbl = lux_tbl_acl;
    int aid_change = 0;

    cd = get_candela_index(bl_level);

    if (mipi_pd.lcd_current_cd_idx == cd) {
        pr_debug("mipi_pd.lcd_current_cd_idx :%d cd:%d bl_level:%d\n",
                 mipi_pd.lcd_current_cd_idx, cd, bl_level);
        return -EINVAL;
    } else
        mipi_pd.lcd_current_cd_idx = cd;

    if (gamma_mode == GAMMA_SMART) {

        /*  SMART Dimming gamma_lux;  */
        char pBuffer[256];
        int i;
        int gamma_lux;

        gamma_lux = lux_tbl[cd];

        if (gamma_lux > SmartDimming_CANDELA_UPPER_LIMIT)
            gamma_lux = SmartDimming_CANDELA_UPPER_LIMIT;

        for (i = SmartDimming_GammaUpdate_Pos;
                i < sizeof(GAMMA_SmartDimming_COND_SET); i++)
            GAMMA_SmartDimming_COND_SET[i] = 0;

        mipi_pd.smart_s6e8aa0x01.brightness_level = gamma_lux;
        generate_gamma(&mipi_pd.smart_s6e8aa0x01,
                       &(GAMMA_SmartDimming_COND_SET[2]), GAMMA_SET_MAX);

#ifdef AID_OPERATION_4_8_INCH
        aid_change = aid_operation(gamma_lux);
#endif

        samsung_panel_gamma_update_cmds[0].dlen =
            sizeof(GAMMA_SmartDimming_COND_SET);
        samsung_panel_gamma_update_cmds[0].payload =
            GAMMA_SmartDimming_COND_SET;
        pBuffer[0] = 0;
        for (i = 0; i < sizeof(GAMMA_SmartDimming_COND_SET); i++) {
            snprintf(pBuffer + strnlen(pBuffer, 256), 256, " %02x",
                     GAMMA_SmartDimming_COND_SET[i]);
        }
        pr_debug("SD: %03d %s\n", gamma_lux, pBuffer);
        pr_info("bl_level:%d,cd:%d:Candela:%d aid_change:%d\n",
                bl_level, cd, gamma_lux, aid_change);
    }
    return aid_change;
}
static int set_gamma_level(int bl_level, enum gamma_mode_list gamma_mode)
{
	int cd;
	int *lux_tbl = lux_tbl_acl;

	cd = get_candela_index(bl_level);

	if (mipi_pd.lcd_current_cd_idx == cd)
		return -1;
	else
	    mipi_pd.lcd_current_cd_idx = cd;

	pr_debug(" Gamma mode: %d\n", gamma_mode);

	if (gamma_mode == GAMMA_SMART) {

		/*  SMART Dimming gamma_lux;  */
		char pBuffer[256];
		int i;
		int gamma_lux;

		gamma_lux = lux_tbl[cd];

		if (gamma_lux > SmartDimming_CANDELA_UPPER_LIMIT)
			gamma_lux = SmartDimming_CANDELA_UPPER_LIMIT;
/*
		mipi_pd.smart_s6e63m0.brightness_level = gamma_lux;

		for (i = SmartDimming_GammaUpdate_Pos;
		     i < sizeof(GAMMA_SmartDimming_COND_SET); i++)
			GAMMA_SmartDimming_COND_SET[i] = 0;
		generate_gamma(&(mipi_pd.smart_s6e63m0),
						GAMMA_SmartDimming_COND_SET +
						SmartDimming_GammaUpdate_Pos,
								GEN_GAMMA_MAX);
*/
		samsung_panel_gamma_update_cmds[0].dlen =
		    sizeof(GAMMA_SmartDimming_COND_SET);
		samsung_panel_gamma_update_cmds[0].payload =
		    GAMMA_SmartDimming_COND_SET;
		pBuffer[0] = 0;
		for (i = 0; i < sizeof(GAMMA_SmartDimming_COND_SET); i++) {
			snprintf(pBuffer + strnlen(pBuffer, 256), 256, " %02x",
				 GAMMA_SmartDimming_COND_SET[i]);
		}
		pr_debug("SD: %03d %s\n", gamma_lux, pBuffer);
		pr_info("bl_level:%d,cd:%d:Candela:%d\n", bl_level, cd,
			gamma_lux);
		}

	return 0;
}
Пример #7
0
static int is_acl_para_change(int bl_level)
{
	int cd = get_candela_index(bl_level);
	int change = 0;

	if (!lcd_acl_table[cd].lux)
		return 0;

	change = memcmp(samsung_panel_acl_update_cmds[0].payload,
			lcd_acl_table[cd].cmd->payload,
			lcd_acl_table[cd].cmd->dlen);
	return change;
}
static int set_acl_on_level(int bl_level)
{
	int cd;
	cd = get_candela_index(bl_level);

	if (!lcd_acl_table[cd].lux)
		return 1;

	if (lcd_acl_table[cd].lux) {
		samsung_panel_acl_update_cmds[0].dlen =
		    lcd_acl_table[cd].cmd->dlen;
		samsung_panel_acl_update_cmds[0].payload =
		    lcd_acl_table[cd].cmd->payload;
	}
	return 0;
}
Пример #9
0
static int set_elvss_level(int bl_level)
{
	unsigned char calc_elvss;
	int cd;
	int id3;
	int id2 = (mipi_pd.manufacture_id>>8) & 0xFF;

	cd = get_candela_index(bl_level);
	id3 = mipi_pd.manufacture_id & 0xFF;

	if ((id2 == 0xA4) || (id2 == 0xB4) || (id2 == 0xA6) ||(id2 == 0xB6))
		calc_elvss = id3 + GET_ELVSS_ID[cd];
	else
		calc_elvss = GET_DEFAULT_ELVSS_ID[cd];

	pr_debug("%s: ID2=%x, ID3=%x, calc_elvss = %x\n", __func__, id2, id3,
		calc_elvss);

	/*
	*	COMANCHE DC-DC : STOD13CM
	*	AEGIS2 DC-DC : STOD13AS
	*	APEXQ DC-DC : STOD13AS
	*/
	if (calc_elvss > LCD_ELVSS_RESULT_LIMIT)
		calc_elvss = LCD_ELVSS_RESULT_LIMIT;

	if (elvss_cond_set[2] == calc_elvss)
		return 1;

	elvss_cond_set[1] = calc_elvss;
	elvss_cond_set[2] = calc_elvss;
	elvss_cond_set[3] = calc_elvss;
	elvss_cond_set[4] = calc_elvss;

	return 0;
}
static void mdss_dsi_panel_bl_ctrl(struct mdss_panel_data *pdata,
							u32 bl_level)
{
	struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;

#if  defined(CONFIG_BACKLIGHT_IC_KTD253)
	static int bl_level_old;
#endif

#if defined(CONFIG_FB_MSM8x26_MDSS_CHECK_LCD_CONNECTION)
	if (get_samsung_lcd_attached() == 0)
	{
		printk("%s: LCD not connected!\n",__func__);
#if defined(CONFIG_BACKLIGHT_IC_KTD2801)
		gpio_set_value(msd.bl_ap_pwm,0);
#else
		gpio_set_value(12, 0);
#endif
		return;
	}
#endif

	if (pdata == NULL) {
		pr_err("%s: Invalid input data\n", __func__);
		return;
	}

	if( msd.mfd->panel_power_on == false){
		pr_err("%s: panel power off no bl ctrl\n", __func__);
		return;
	}
#if defined(CONFIG_ESD_ERR_FG_RECOVERY)
	if (err_fg_working) {
		pr_info("[LCD] %s : esd is working!! return.. \n", __func__);
		return;
	}
#endif
	ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata,
				panel_data);
	switch (ctrl_pdata->bklt_ctrl) {
	case BL_WLED:
		led_trigger_event(bl_led_trigger, bl_level);
		break;
	case BL_PWM:
#if defined(CONFIG_BACKLIGHT_IC_KTD2801)
#ifdef EXPRESSWIRED
		ktd_backlight_set_brightness(bl_level);
#else
		pr_err("[MINO] %s --> bl_level[1] : %d\n",__func__, bl_level );
		bl_level=mdss_dsi_panel_pwm_scaling(bl_level);
		mdss_dsi_panel_bklt_pwm(bl_level);
		pr_err("[MINO] %s --> bl_level[2] : %d\n",__func__, bl_level );
#endif
#else
		mdss_dsi_panel_bklt_pwm(ctrl_pdata, bl_level);
#endif
		break;
	case BL_DCS_CMD:
			mdss_dsi_panel_bklt_dcs(ctrl_pdata, bl_level);
		break;
	case BL_GPIO_SWING:
#if defined(CONFIG_BACKLIGHT_IC_KTD253)
	if (bl_level_old == bl_level)
			return;

	pr_err("%s: bl_level = %d\n",__func__,bl_level);

	ktd253_set_brightness(get_candela_index(bl_level),ctrl_pdata);
	bl_level_old = bl_level;
#endif
		break;

	default:
		pr_err("%s: Unknown bl_ctrl configuration\n",
			__func__);
		break;
	}
}