static int tovis_qvga_disp_on(struct platform_device *pdev)
{
	/* fixed lcd tearing during playing video by bongkyu.kim */
	pm_qos_update_requirement(PM_QOS_SYSTEM_BUS_FREQ, "ebi2_lcd",
		65000);
	
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (!display_on) {
		mdelay(10);
		gpio_set_value(102, 0);
		mdelay(1);
		gpio_set_value(102, 1);
		mdelay(5);
		display_on = TRUE;

		do_tovis_init();	
/*
		// (d) -> (a)
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		mdelay(5);
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		EBI2_WRITE16C(DISP_CMD_PORT, 0xff); // CSX Falling Edge
		mdelay(10);
*/
	}
	return 0;
}
static int ilitek_qvga_disp_on(struct platform_device *pdev)
{
	struct msm_panel_ilitek_pdata *pdata = tovis_qvga_panel_pdata;

	printk("%s: display on...", __func__);
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if(pdata->initialized && system_state == SYSTEM_BOOTING) {
		/* Do not hw initialize */
	} else {
		msm_fb_ebi2_power_save(1);

		if(pdata->gpio) {
			mdelay(10);
		gpio_set_value(pdata->gpio, 1);
		mdelay(1);
		gpio_set_value(pdata->gpio, 0);
			mdelay(10);
		gpio_set_value(pdata->gpio, 1);
		mdelay(120);
		}
		if(pdata->maker_id == PANEL_ID_LGDISPLAY)
			do_lgd_init(pdev);
		else
			do_ilitek_init(pdev);
	}

	pm_qos_update_request(tovis_pm_qos_req, 65000);
	display_on = TRUE;

	return 0;
}
static int ilitek_qvga_disp_off(struct platform_device *pdev)
{

/* LGE_CHANGE_S: E0 [email protected] [2011-11-22] : BL control error fix */
#if 1
	struct msm_panel_ilitek_pdata *pdata = tovis_qvga_panel_pdata;
#endif
/* LGE_CHANGE_E: E0 [email protected] [2011-11-22] : BL control error fix */


	printk("%s: display off...\n", __func__);
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

#ifndef CONFIG_ARCH_MSM7X27A
	pm_qos_update_request(tovis_pm_qos_req, PM_QOS_DEFAULT_VALUE);
#endif

	EBI2_WRITE16C(DISP_CMD_PORT, 0x28);
	msleep(50);
	EBI2_WRITE16C(DISP_CMD_PORT, 0x10); // SPLIN
	msleep(120);

/* LGE_CHANGE_S: E0 [email protected] [2011-11-22] : BL control error fix */
#if 1 
	if(pdata->gpio)
		gpio_set_value(pdata->gpio, 0);
#endif	
/* LGE_CHANGE_E: E0 [email protected] [2011-11-22] : BL control error fix */

	msm_fb_ebi2_power_save(0);
	display_on = FALSE;

	return 0;
}
static int ilitek_qvga_disp_off(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (display_on) {
		EBI2_WRITE16C(DISP_CMD_PORT, 0x28); 
		mdelay(50);
		msm_fb_ebi2_power_save(0);
		display_on = FALSE;
	}

	return 0;
}
static int ilitek_qvga_disp_off(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (display_on) {
		// perform lcd deep sleep instead of power off
		EBI2_WRITE16C(DISP_CMD_PORT, 0x28); 
		mdelay(50);
		EBI2_WRITE16C(DISP_CMD_PORT, 0x10); // SPLIN
		mdelay(120);
		/* TEST */ msm_fb_ebi2_power_save(0);
		display_on = FALSE;
	}

	return 0;
}
static int tovis_qvga_disp_off(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (display_on) {
		// (b) -> (a)
		EBI2_WRITE16C(DISP_CMD_PORT, 0x28); // Display Off
		mdelay(20);
		EBI2_WRITE16C(DISP_CMD_PORT, 0x10); // AMP Off
		mdelay(120);

		msm_fb_ebi2_power_save(0);
		display_on = FALSE;
	}

	return 0;
}
static int tovis_qvga_disp_on(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (!display_on) {
		msm_fb_ebi2_power_save(1);
		mdelay(10);
		
		gpio_set_value(102, 0);
		mdelay(1);
		gpio_set_value(102, 1);
		mdelay(5);
		display_on = TRUE;

		do_tovis_init();	
	}
	return 0;
}
static int ilitek_qvga_disp_on(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if (!display_on) {
		/* TEST */ msm_fb_ebi2_power_save(1);
		mdelay(10);
		gpio_set_value(102, 1);
		mdelay(1);
		gpio_set_value(102, 0);
		mdelay(40);
		gpio_set_value(102, 1);
		mdelay(10); //mdelay(120);
		display_on = TRUE;

		do_ilitek_init();		
	}
	return 0;
}
static int tovis_qvga_disp_off(struct platform_device *pdev)
{
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);
	
	pm_qos_update_requirement(PM_QOS_SYSTEM_BUS_FREQ, "ebi2_lcd",
		PM_QOS_DEFAULT_VALUE);
	if (display_on) {
		// (b) -> (a)
		EBI2_WRITE16C(DISP_CMD_PORT, 0x28);  // ScreenOff
		mdelay(20);
		EBI2_WRITE16C(DISP_CMD_PORT, 0x10);  // AMP Off
		mdelay(120);

		// (a) -> (d)
		EBI2_WRITE16C(DISP_CMD_PORT, 0xb1); 
		EBI2_WRITE16D(DISP_DATA_PORT,0x01); 

		display_on = FALSE;
	}

	return 0;
}
static int ilitek_qvga_disp_off(struct platform_device *pdev)
{
	struct msm_panel_ilitek_pdata *pdata = tovis_qvga_panel_pdata;

	printk("%s: display off...", __func__);
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	pm_qos_update_request(tovis_pm_qos_req, PM_QOS_DEFAULT_VALUE);

		EBI2_WRITE16C(DISP_CMD_PORT, 0x28);
		mdelay(50);
		EBI2_WRITE16C(DISP_CMD_PORT, 0x10); // SPLIN
		mdelay(120);

	if(pdata->gpio)
		gpio_set_value(pdata->gpio, 0);

		msm_fb_ebi2_power_save(0);
		display_on = FALSE;

	return 0;
}
static int ilitek_qvga_disp_on(struct platform_device *pdev)
{
	struct msm_panel_ilitek_pdata *pdata = tovis_qvga_panel_pdata;

	printk("%s: display on... \n", __func__);
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

#ifdef LCD_INIT_SKIP_FOR_BOOT_TIME
   if((pdata->initialized && system_state == SYSTEM_BOOTING) || lcd_init_skip_cnt < 1) {
      lcd_init_skip_cnt =1;
      printk("%s: display on...Skip!!!!!!  \n", __func__);
#else
	if(pdata->initialized && system_state == SYSTEM_BOOTING) {
		/* Do not hw initialize */      
#endif
	} else {

		/* LGE_CHANGE_S: E0 [email protected] [2012-02-01] 
		: For the Wakeup Issue */
		//mcs8000_ts_on();//dajiniv
		/* LGE_CHANGE_E: E0 [email protected] [2012-02-01] 
		: For the Wakeup Issue */
	
		msm_fb_ebi2_power_save(1);

		if(pdata->gpio) {
			//mdelay(10);	// prevent stop to listen to music with BT
			gpio_set_value(pdata->gpio, 1);
			mdelay(1);
			gpio_set_value(pdata->gpio, 0);
			mdelay(10);
			gpio_set_value(pdata->gpio, 1);
			msleep(1);
		}

		/* use pdata->maker_id to detect panel */
		panel_lgdisplay_init();
	}

	pm_qos_update_request(tovis_pm_qos_req, 65000);
	display_on = TRUE;


#if 0 /*2012-09-26 junghoon-kim([email protected]) V3 not use [START]*/
/* LGE_CHANGE_S: E0 [email protected] [2011-11-22] : BL control error fix */
	if(!Is_Backlight_Set)
	{
		msleep(50);
      #ifdef CONFIG_BACKLIGHT_RT9396
		rt9396_force_set();    //backlight current level force setting here
		#else
      bu61800_force_set();    //backlight current level force setting here
      #endif
	}
   /* LGE_CHANGE_E: E0 [email protected] [2011-11-22] : BL control error fix */
#endif/*2012-09-26 junghoon-kim([email protected]) V3 not use [END]*/

	  
	return 0;
}

ssize_t tovis_qvga_show_onoff(struct device *dev, struct device_attribute *attr, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n", display_on);
}

ssize_t tovis_qvga_store_onoff(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	int onoff;
	struct msm_fb_panel_data *pdata = dev_get_platdata(dev);
	struct platform_device *pd = to_platform_device(dev);

	sscanf(buf, "%d", &onoff);

	if (onoff) {
		pdata->on(pd);
	} else {
		pdata->off(pd);
	}

	return count;
}
static int ilitek_qvga_disp_on(struct platform_device *pdev)
{
	int	readport;
	struct msm_panel_ilitek_pdata *pdata = tovis_qvga_panel_pdata;

	printk("%s: display on...", __func__);
	if (!disp_initialized)
		tovis_qvga_disp_init(pdev);

	if(pdata->initialized && system_state == SYSTEM_BOOTING) {
		/* Do not hw initialize */
	} else {

		/* LGE_CHANGE_S: E0 [email protected] [2012-02-01] 
		: For the Wakeup Issue */
		mcs8000_ts_on();
		/* LGE_CHANGE_E: E0 [email protected] [2012-02-01] 
		: For the Wakeup Issue */
	
		msm_fb_ebi2_power_save(1);

		gpio_tlmm_config(GPIO_CFG(GPIO_LCD_TID, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		readport = gpio_get_value(GPIO_LCD_TID);
			
#if 1
		if(readport==0 ) 
		{			
			if(IsFirstDisplayOn==0)
			{
					if(pdata->gpio) {
						//mdelay(10);	// prevent stop to listen to music with BT
						gpio_set_value(pdata->gpio, 1);
						mdelay(1);
						gpio_set_value(pdata->gpio, 0);
						mdelay(20);
						gpio_set_value(pdata->gpio, 1);
						msleep(50);
					}
					printk("AUO Init Started\n");
					do_AUO_init(pdev);
			}									
		}
		else 
		{
if(IsFirstDisplayOn==0)
{
		if(pdata->gpio) {
			//mdelay(10);	// prevent stop to listen to music with BT
			gpio_set_value(pdata->gpio, 1);
			mdelay(1);
			gpio_set_value(pdata->gpio, 0);
			mdelay(10);
			gpio_set_value(pdata->gpio, 1);
			msleep(120);
		}
					printk("Tovis Init Started\n");
		if(pdata->maker_id == PANEL_ID_LGDISPLAY)
			do_lgd_init(pdev);
		else
			do_ilitek_init(pdev);
	}
		}
		#endif
		
	}

	pm_qos_update_request(tovis_pm_qos_req, 65000);
	display_on = TRUE;

/* LGE_CHANGE_S: E0 [email protected] [2011-11-22] : BL control error fix */
#if 1
	if(!Is_Backlight_Set)
	{
		msleep(50);
		bu61800_force_set();    //backlight current level force setting here
	}
#endif
/* LGE_CHANGE_E: E0 [email protected] [2011-11-22] : BL control error fix */
	if(IsFirstDisplayOn > 0) 
	 IsFirstDisplayOn-- ;
	  
	return 0;
}