static int mipi_dsi_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;

	mipi  = &mfd->panel_info.mipi;
	if (mipi_status == 0 || bl_level_prevset == mfd->bl_level) {
		PR_DISP_DEBUG("Skip the backlight setting > mipi_status : %d, bl_level_prevset : %d, bl_level : %d\n",
			mipi_status, bl_level_prevset, mfd->bl_level);
		goto end;
	}

	led_pwm1[1] = protou_shrink_pwm(mfd->bl_level);

	if (mfd->bl_level == 0 || board_mfg_mode() == 4 ||
	    (board_mfg_mode() == 5 && !(htc_battery_get_zcharge_mode() % 2))) {
		led_pwm1[1] = 0;
	}

	htc_mdp_sem_down(current, &mfd->dma->mutex);
	if (mipi->mode == DSI_VIDEO_MODE) {
		if (panel_type == PANEL_ID_PROTOU_LG) {
			/* This is added for LG panel which is needed to use BTA to clear the error happened in driverIC */
			MIPI_OUTP(MIPI_DSI_BASE + 0xA8, 0x10000000);
			mipi_dsi_cmd_bta_sw_trigger();

			/* Need to send blk disable cmd to turn off backlight, or it will change to dim brightness even sending 0 brightness */
			if (led_pwm1[1] == 0)
				mipi_dsi_cmds_tx(mfd, &protou_panel_tx_buf, lg_bkl_disable_cmds,
					ARRAY_SIZE(lg_bkl_disable_cmds));
			else if (bl_level_prevset == 0)
				mipi_dsi_cmds_tx(mfd, &protou_panel_tx_buf, lg_bkl_enable_cmds,
					ARRAY_SIZE(lg_bkl_enable_cmds));
		}
		mipi_dsi_cmds_tx(mfd, &protou_panel_tx_buf, backlight_cmds,
			ARRAY_SIZE(backlight_cmds));
	} else {
		mipi_dsi_op_mode_config(DSI_CMD_MODE);
		mipi_dsi_cmds_tx(mfd, &protou_panel_tx_buf, backlight_cmds,
			ARRAY_SIZE(backlight_cmds));
	}
	htc_mdp_sem_up(&mfd->dma->mutex);

	bl_level_prevset = mfd->bl_level;

	/* Record the last value which was not zero for resume use */
	if (mfd->bl_level >= BRI_SETTING_MIN)
		last_brightness = mfd->bl_level;

	PR_DISP_INFO("mipi_dsi_set_backlight > set brightness to %d(%d)\n", led_pwm1[1], mfd->bl_level);
end:
	return 0;
}
void __init k2_init_fb(void)
{
	platform_device_register(&msm_fb_device);

	if(panel_type != PANEL_ID_NONE) {
		if (board_mfg_mode() == 4 ||
			(board_mfg_mode() == 5 && !(htc_battery_get_zcharge_mode() & 0x1)))
			mdp_pdata.cont_splash_enabled = 0x0;
		platform_device_register(&mipi_dsi_k2_panel_device);
		msm_fb_register_device("mdp", &mdp_pdata);
		msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
	}
}
void __init deluxe_j_init_fb(void)
{

	platform_device_register(&msm_fb_device);

	if(panel_type != PANEL_ID_NONE) {
		if ((board_mfg_mode() == 4) ||
			(board_mfg_mode() == 5 && !(htc_battery_get_zcharge_mode() & 0x1)))
			 mdp_pdata.cont_splash_enabled = 0x0;
		msm_fb_register_device("mdp", &mdp_pdata);
		msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
		wa_xo = msm_xo_get(MSM_XO_TCXO_D0, "mipi");
	}
	msm_fb_register_device("dtv", &dtv_pdata);
#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
    platform_device_register(&wfd_panel_device);
    platform_device_register(&wfd_device);
#endif
}
static int mipi_dsi_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;

	mipi  = &mfd->panel_info.mipi;
	if (mipi_status == 0)
		goto end;

	if (mipi_sony_pdata && mipi_sony_pdata->shrink_pwm)
		led_pwm1[1] = mipi_sony_pdata->shrink_pwm(mfd->bl_level);
	else
		led_pwm1[1] = (unsigned char)(mfd->bl_level);

	if (mfd->bl_level == 0 || board_mfg_mode() == 4 ||
	    (board_mfg_mode() == 5 && !(htc_battery_get_zcharge_mode() % 2))) {
		led_pwm1[1] = 0;
	}

	htc_mdp_sem_down(current, &mfd->dma->mutex);
	if (mipi->mode == DSI_VIDEO_MODE) {
		mipi_dsi_cmd_mode_ctrl(1);	/* enable cmd mode */
		mipi_dsi_cmds_tx(mfd, &sony_tx_buf, sony_cmd_backlight_cmds,
			ARRAY_SIZE(sony_cmd_backlight_cmds));
		mipi_dsi_cmd_mode_ctrl(0);	/* disable cmd mode */
	} else {
		mipi_dsi_op_mode_config(DSI_CMD_MODE);
		mipi_dsi_cmds_tx(mfd, &sony_tx_buf, sony_cmd_backlight_cmds,
			ARRAY_SIZE(sony_cmd_backlight_cmds));
	}
	htc_mdp_sem_up(&mfd->dma->mutex);

	if (led_pwm1[1] != 0)
		bl_level_prevset = mfd->bl_level;

	PR_DISP_DEBUG("mipi_dsi_set_backlight > set brightness to %d\n", led_pwm1[1]);
end:
	return 0;
}