Exemple #1
0
void trinity_load_colors(unsigned int val)
{
	int i=0;
	if (val == 1)
	{
		color_mods[0] = 0;
		color_mods[1] = 0;
		color_mods[2] = 5;
		color_mods[3] = -18;
		color_mods[4] = -16;
		color_mods[5] = -10;
		color_mods[6] = 0;
		color_mods[7] = 0;
		color_mods[8] = 3;
		color_mods[9] = 0;
		color_mods[10] = 0;
		color_mods[11] = 3;
		color_mods[12] = 0;
		color_mods[13] = 0;
		color_mods[14] = 3;
		color_mods[15] = 0;
		color_mods[16] = 0;
		color_mods[17] = 3;
		color_mods[18] = 0;
		color_mods[19] = 0;
		color_mods[20] = 3;
	}
	else
	{
		for (i = 0; i < 21; i++)
			color_mods[i] = 0;
	}
	smart_dimming_init(gpsmart);
}
void panel_load_colors(void)
{
    int old;
    smart_dimming_init(gpsmart);
    old = get_lcd_current_cd_index();
    reset_gamma_level();
    mipi_samsung_bump_backlight((old + 2) * 10);
}
Exemple #3
0
static void execute_panel_init(struct msm_fb_data_type *mfd)
{
	struct SMART_DIM *psmart = &(msd.mpd->smart_s6e88a[msd.mpd->lcd_no]);
	char *mtp_buffer = (char *)&(msd.mpd->smart_s6e88a[msd.mpd->lcd_no].MTP_ORIGN);

	/* LSI HBM */
	char *mtp_buffer2 = (char *)&(msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b5_reg);
	char *mtp_buffer3 = (char *)&(msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b6_reg);
	int i;

	mipi_samsung_disp_send_cmd(mfd, PANEL_MTP_ENABLE, false);

	/* read LDi ID */
	msd.mpd->manufacture_id = mipi_samsung_manufacture_id(mfd);
	// msd.mpd->cmd_set_change(PANEL_ON, msd.mpd->manufacture_id);

	/* smart dimming & AID*/
	psmart->plux_table = msd.mpd->lux_table;
	psmart->lux_table_max = msd.mpd->lux_table_max_cnt;
	psmart->ldi_revision = msd.mpd->manufacture_id;

	read_mtp(MTP_START_ADDR, 0, GAMMA_SET_MAX, mtp_buffer, mfd);

	/* LSI HBM */
	read_mtp(0xb5, 13-1, 16, mtp_buffer2, mfd); // read b5h 13~28th
	read_mtp(0xb6, 3-1, 12, mtp_buffer3, mfd); // read b6h 3~14th
	msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b5_reg_19 = mtp_buffer2[6]; // save b5h 19th

	i = 0;
#ifdef CONFIG_HBM_PSRE_DEBUG
	printk("[HBM] b5_reg : ");
	for(i=0; i<16; i++)
		printk("%x ",msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b5_reg[i]);
	pr_info("\n");
	printk("[HBM] b6_reg : ");
	for(i=0; i<12; i++)
		printk("%x ",msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b6_reg[i]);
	pr_info("\n");
	printk("[HBM] b5_19th_reg : ");
	printk("%x ",msd.mpd->smart_s6e88a[msd.mpd->lcd_no].hbm_reg.b5_reg_19);
#endif

	smart_dimming_init(&(msd.mpd->smart_s6e88a[msd.mpd->lcd_no]));

	pr_info("%s - [%d]\n", __func__, msd.mpd->lcd_no);
}
static void execute_panel_init(struct msm_fb_data_type *mfd)
{
	int i;
	struct SMART_DIM *psmart = &(msd.mpd->smart_se6e8fa);
	char *mtp_buffer = (char *)&(msd.mpd->smart_se6e8fa.MTP_ORIGN);
	char *mtp_buffer1 = (char *)&(msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1);
	/* LSI */
	char *mtp_buffer2 = (char *)&(msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_2);
	char *mtp_buffer3 = (char *)&(msd.mpd->smart_se6e8fa.hbm_reg.b6_reg_lsi);
	char temp[4];
	char C8_reg[3];
	/* MAGNA */
	char *mtp_buffer4 = (char *)&(msd.mpd->smart_se6e8fa.hbm_reg.b1_reg);
	char *mtp_buffer5 = (char *)&(msd.mpd->smart_se6e8fa.hbm_reg.b6_reg_magna);

	mipi_samsung_disp_send_cmd(mfd, PANEL_MTP_ENABLE, false);

	/* read LDi ID */
	msd.mpd->manufacture_id = mipi_samsung_manufacture_id(mfd);
	msd.mpd->cmd_set_change(PANEL_ON, msd.mpd->manufacture_id);

	/* smart dimming & AID*/
	psmart->plux_table = msd.mpd->lux_table;
	psmart->lux_table_max = msd.mpd->lux_table_max_cnt;
	psmart->ldi_revision = msd.mpd->manufacture_id;

	read_mtp(MTP_START_ADDR, 0, GAMMA_SET_MAX, mtp_buffer, mfd);

	if (get_ldi_chip() == LDI_LSI) {
		pr_info("#### LSI panel!!\n");
		if (msd.mpd->ldi_rev == 'H') {
			read_mtp(0xCB, 0, ARRAY_SIZE(C8_reg), C8_reg, mfd); // hover_flicker..
			msd.mpd->hover_flicker_change(C8_reg[2]);
		}
		read_mtp(MTP_START_ADDR, 34-1, 7, mtp_buffer1, mfd); // read C8h 34~40th
		if (msd.mpd->ldi_rev == 'I')
			read_mtp(MTP_START_ADDR, 73-1, 15, mtp_buffer2, mfd); // read C8h 73~87th
		else
			read_mtp(0xb6, 17-1, 1, mtp_buffer3, mfd); // recover original's ELVSS offset b6's 17th
	} else if (get_ldi_chip() == LDI_MAGNA) {
		pr_info("#### MAGNA panel!!\n");
		read_mtp(0xB1, 10-1, 6, mtp_buffer4, mfd); // read B1h 10~18th
		read_mtp(0xB6, 4-1, 23, mtp_buffer5, mfd); // read B6h 4~26th
	}

	i = 0;
#ifdef CONFIG_HBM_PSRE_DEBUG
	pr_info("%s c8[34~40](%x)(%x)(%x)(%x)(%x)(%x)(%x)", __func__,
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[0],
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[1], 
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[2],
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[3], 
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[4],
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[5],
		msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[6]);
	pr_info("\n");

	printk("c8_reg_1 : ");
	for(i=0; i<7; i++)
		printk("%x ",msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_1[i]);
	pr_info("\n");

	if (msd.mpd->ldi_rev == 'I') {
		printk("c8_reg_2 : ");
		for(i=0; i<15; i++)
			printk("%x ",msd.mpd->smart_se6e8fa.hbm_reg.c8_reg_2[i]);
		pr_info("\n");
	} else
		printk("b6_reg : %x \n",msd.mpd->smart_se6e8fa.hbm_reg.b6_reg[0]);

#endif

#if defined(CONFIG_MDNIE_LITE_TUNING)
	read_mtp(LDI_COORDINATE_REG, 0,  ARRAY_SIZE(temp), temp, mfd);
	msd.mpd->coordinate[0] =  temp[0] << 8 | temp[1];	/* X */
	msd.mpd->coordinate[1] = temp[2] << 8 | temp[3];	/* Y */
	coordinate_tunning(msd.mpd->coordinate[0], msd.mpd->coordinate[1]);
#endif

	/* TO set default temperature value 25 degree*/
	msd.mpd->temperature_value = 25;

	mipi_samsung_disp_send_cmd(mfd, PANEL_MTP_DISABLE, false);
	smart_dimming_init(&(msd.mpd->smart_se6e8fa));

}
static int mipi_samsung_disp_on(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;
	struct mipi_panel_info *mipi;
#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_HD_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_WVGA_PT)
	static int boot_on;
#endif

	mfd = platform_get_drvdata(pdev);
	if (unlikely(!mfd))
		return -ENODEV;
	if (unlikely(mfd->key != MFD_KEY))
		return -EINVAL;

	mipi = &mfd->panel_info.mipi;

#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_CMD_QHD_PT)
	mipi_samsung_disp_send_cmd(mfd, MTP_READ_ENABLE, false);
#endif

#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_WVGA_PT)
	if (boot_on == 0)
		mipi_samsung_disp_send_cmd(mfd, MTP_READ_ENABLE, false);
#endif

#ifdef USE_READ_ID
#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_WVGA_PT)
	if (boot_on == 0)
		msd.mpd->manufacture_id = mipi_samsung_manufacture_id(mfd);
#elif defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_CMD_QHD_PT)
	msd.mpd->manufacture_id = mipi_samsung_manufacture_id(mfd);
#elif defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_HD_PT)
	if (!samsung_has_cmc624())
		msd.mpd->manufacture_id = mipi_samsung_manufacture_id(mfd);
	else
		msd.mpd->manufacture_id = LCD_Get_Value();
#endif
#endif

#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_CMD_QHD_PT)
	if (!msd.dstat.is_elvss_loaded) {
		read_reg(ELVSS_REGISTER, ELVSS_DATA_SIZE,
			msd.mpd->lcd_elvss_data,
				 FALSE, mfd);  /* read ELVSS data */
		msd.dstat.is_elvss_loaded = true;
	}


	if (!msd.dstat.is_smart_dim_loaded) {
		/* Load MTP Data */
		int i;
		read_reg(MTP_REGISTER, MTP_DATA_SIZE,
				(u8 *)&(msd.mpd->smart_s6e39a0x02.MTP),
						FALSE, mfd);
		for (i = 0; i < MTP_DATA_SIZE; i++) {
			pr_info("%s MTP DATA[%d] : %02x\n", __func__, i,
			((char *)&(msd.mpd->smart_s6e39a0x02.MTP))[i]);
		}

		smart_dimming_init(&(msd.mpd->smart_s6e39a0x02));
#ifdef READ_MTP_ONCE
		msd.dstat.is_smart_dim_loaded = true;
#else
		msd.dstat.is_smart_dim_loaded = false;
#endif
		msd.dstat.gamma_mode = GAMMA_SMART;
	}
#endif
#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_HD_PT)
	if (!msd.dstat.is_elvss_loaded) {
		if (!samsung_has_cmc624())
			msd.mpd->lcd_elvss_data[0] = elvss_value;
		else
			msd.mpd->lcd_elvss_data[0] = LCD_ID3();

		msd.dstat.is_elvss_loaded = true;
	}

	if (!msd.dstat.is_smart_dim_loaded) {
		/*Load MTP Data*/
		char pBuffer[256] = {0,};
		int i;
		struct SMART_DIM *psmart;
		char *mtp_data;
		int mtp_cnt;

		psmart = &(msd.mpd->smart_s6e8aa0x01);
		mtp_data = (char *)&(msd.mpd->smart_s6e8aa0x01.MTP);

		if (samsung_has_cmc624()) {
			memcpy(mtp_data, mtp_read_data, GAMMA_SET_MAX);
			pr_info("%s This board support CMC", __func__);
		} else {
			mtp_cnt = find_mtp(mfd, mtp_data);
			pr_info("%s MTP is determined : %d", __func__, mtp_cnt);
		}


		for (i = 0; i < MTP_DATA_SIZE; i++)
			snprintf(pBuffer + strnlen(pBuffer, 256), 256, " %02x",
				mtp_data[i]);
		pr_info("MTP: %s", pBuffer);

		psmart->plux_table = msd.mpd->lux_table;
		psmart->lux_table_max = msd.mpd->lux_table_max_cnt;

		if (samsung_has_cmc624())
			psmart->ldi_revision = LCD_Get_Value();
		else
			psmart->ldi_revision = bypass_LCD_Id();

		smart_dimming_init(psmart);

		msd.dstat.is_smart_dim_loaded = true;
		msd.dstat.gamma_mode = GAMMA_SMART;
	}

	if (msd.mpd->gamma_initial && boot_on == 0) {
		msd.mpd->smart_s6e8aa0x01.brightness_level = 180;
		generate_gamma(&msd.mpd->smart_s6e8aa0x01,
			&(msd.mpd->gamma_initial[2]), GAMMA_SET_MAX);

		if (recovery_boot_mode == 0)
			boot_on = 1;
	} else {
		get_min_lux_table(&(msd.mpd->gamma_initial[2]),
					GAMMA_SET_MAX);
		reset_gamma_level();
	}
#endif

#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT)
	if (!msd.dstat.is_smart_dim_loaded) {
		/* Load MTP Data */
		int i, mtp_cnt, err_cnt;
		char *mtp_data = (char *)&(msd.mpd->smart_s6e63m0.MTP);

		for (err_cnt = 0; err_cnt < 10; err_cnt++) {
			mtp_cnt = find_mtp(mfd, mtp_data);

			if (mtp_cnt != 0)
				break;
		}

		pr_info("%s MTP is determined:%d err_cnt:%d",
					__func__, mtp_cnt, err_cnt);

		for (i = 0; i < MTP_DATA_SIZE_S6E63M0; i++) {
			pr_info("%s MTP DATA[%d] : %02x\n", __func__, i,
				mtp_data[i]);
		}

		smart_dimming_init(&(msd.mpd->smart_s6e63m0));

		msd.dstat.is_smart_dim_loaded = true;
		msd.dstat.gamma_mode = GAMMA_SMART;
	}

	if (msd.mpd->gamma_initial && boot_on == 0) {
		msd.mpd->smart_s6e63m0.brightness_level = 140;
		generate_gamma(&msd.mpd->smart_s6e63m0,
			&(msd.mpd->gamma_initial[2]), GAMMA_SET_MAX);

		if (recovery_boot_mode == 0)
			boot_on = 1;

	} else {
		msd.mpd->smart_s6e63m0.brightness_level = 30;
		generate_gamma(&msd.mpd->smart_s6e63m0,
			&(msd.mpd->gamma_initial[2]), GAMMA_SET_MAX);
		reset_gamma_level();
	}
#endif

#if defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_WVGA_PT)
	if (!msd.dstat.is_smart_dim_loaded) {
		/* Load MTP Data */
		int i, mtp_cnt, err_cnt;
		char *mtp_data = (char *)&(msd.mpd->smart_ea8868.MTP);

		if (bypass_lcd_id == 0x4a) {
			for (err_cnt = 0; err_cnt < 10; err_cnt++) {
				mtp_cnt = find_mtp(mfd, mtp_data);

				if (mtp_cnt != 0)
					break;
			}

			pr_info("%s MTP is determined:%d err_cnt:%d",
						__func__, mtp_cnt, err_cnt);

			for (i = 0; i < MTP_DATA_SIZE_EA8868; i++) {
				pr_info("%s MTP DATA[%d] : %02x\n",
						__func__, i, mtp_data[i]);
			}
		} else {
			pr_info("%s MTP is not used LDI_ID: 0x%x",
						__func__, bypass_lcd_id);
			memset(mtp_data, 0x0, MTP_DATA_SIZE_EA8868);
		}

		smart_dimming_init(&(msd.mpd->smart_ea8868));

		msd.dstat.is_smart_dim_loaded = true;
		msd.dstat.gamma_mode = GAMMA_SMART;
	}

	if (msd.mpd->gamma_initial && boot_on == 0) {
		msd.mpd->smart_ea8868.brightness_level = 180;
		generate_gamma(&msd.mpd->smart_ea8868,
			&(msd.mpd->gamma_initial[1]), GAMMA_SET_MAX);

		if (recovery_boot_mode == 0)
			boot_on = 1;
	} else {
		msd.mpd->smart_ea8868.brightness_level = get_gamma_lux();
		generate_gamma(&msd.mpd->smart_ea8868,
			&(msd.mpd->gamma_initial[1]), GAMMA_SET_MAX);
		reset_gamma_level();
	}
#endif

	if (unlikely(first_on)) {
		first_on = false;
		return 0;
	}

	mipi_samsung_disp_send_cmd(mfd, PANEL_READY_TO_ON, false);
	if (mipi->mode == DSI_VIDEO_MODE)
		mipi_samsung_disp_send_cmd(mfd, PANEL_ON, false);

#if !defined(CONFIG_HAS_EARLYSUSPEND)
	mipi_samsung_disp_send_cmd(mfd, PANEL_LATE_ON, false);
#endif
#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
#if defined(CONFIG_MACH_JAGUAR)
	if  (system_rev >= 16)
		set_esd_enable();
	if (msd.esd_refresh == true)
		mipi_samsung_disp_send_cmd(mfd, PANEL_LATE_ON, false);
#else
	set_esd_enable();
#endif
#endif

#ifdef READ_REGISTER_ESD
	queue_delayed_work(msd.mpd->esd_workqueue,
				&(msd.mpd->esd_work), ESD_INTERVAL * HZ);
	wake_lock(&(msd.mpd->esd_wake_lock));
#endif

	return 0;
}