static void lcm_init(void)
{
int kk =0;
	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
  hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
    MDELAY(100);


    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(10);//10
    SET_RESET_PIN(1);
    MDELAY(50);//50
     kk = lcm_check_id();
	if(kk == 1)
	{
            push_table(lcm_initialization_setting_ykl, sizeof(lcm_initialization_setting_ykl) / sizeof(struct LCM_setting_table), 1);
	}
	else
	{
           push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
	}
}
static void lcm_suspend(void)
{
#ifdef BUILD_LK

	printf("[LK/LCM] lcm_suspend() enter\n");

	lcm_set_gpio_output(GPIO_LCM_RST_EN, 0);
	MDELAY(300);
    //AVDD power off
	lcm_set_gpio_output(GPIO_LCM_PWR_EN, 0);
	MDELAY(2);

	//VDD power off ->VGP3_PMU 1.8V
	upmu_set_rg_vgp3_vosel(0);
	upmu_set_rg_vgp3_en(0);	
	MDELAY(20);
	
#elif (defined BUILD_UBOOT)
#else

	printk("[LCM] lcm_suspend() enter\n");

    lcm_set_gpio_output(GPIO_LCM_RST_EN, 0);
	MDELAY(300);
    //AVDD power off
	lcm_set_gpio_output(GPIO_LCM_PWR_EN, 0);
	MDELAY(2);

	//VDD power off ->VGP3_PMU 1.8V
	hwPowerOn(MT6323_POWER_LDO_VGP3 , VOL_1800 ,"LCM");
	MDELAY(20);
	
#endif	 
}
static void lcm_init(void)
{
#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
 	hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif

#ifdef BUILD_LK
	printf("MYCAT ILI9608 lk lcm_init\n");
#else
      printk("MYCAT ILI9608  kernel lcm_init\n");
#endif
    SET_RESET_PIN(1);
    MDELAY(10);
    SET_RESET_PIN(0);
    MDELAY(50);
    SET_RESET_PIN(1);
    MDELAY(180);
		push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
    //init_lcm_registers();
}
static void lcm_init(void)
{
	unsigned int data_array[64];
	
	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
       hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif

    mt_set_gpio_mode(59,GPIO_MODE_00);
    mt_set_gpio_dir(59,GPIO_DIR_OUT);
    mt_set_gpio_out(59,GPIO_OUT_ONE);
 MDELAY(10);//Must > 10ms
	 mt_set_gpio_out(59,GPIO_OUT_ZERO);
 MDELAY(10);//Must > 10ms
	  mt_set_gpio_out(59,GPIO_OUT_ONE);
   MDELAY(120);//Must > 120m

    push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}
static void lcm_init(void)
{
	  int flag=0;
	  
	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
  hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
		  //MDELAY(100);

    

    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(1);
    SET_RESET_PIN(1);
    MDELAY(10);
  
    Lcd_Log("mycat otm8018b flag=%d  \n",flag);
    
	  push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}
static unsigned int lcm_compare_id(void)
{
	unsigned int id = 0;
	unsigned char buffer[2];
	unsigned int array[16];
		
#ifdef BUILD_LK
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
  hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM");
	hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM");
#endif
  MDELAY(100);

  SET_RESET_PIN(1);
  MDELAY(10);
  SET_RESET_PIN(0);
  MDELAY(50);
  SET_RESET_PIN(1);
  MDELAY(100);
  
	array[0] = 0x00043700;// read id return two byte,version and id
	dsi_set_cmdq(array, 1, 1);
	
	read_reg_v2(0x04, buffer, 4);
	id = buffer[1]; //we only need ID

	Lcd_Log("wqcat read HX8369A id=%x,%x\n", buffer[0],buffer[1]);
	return ((LCM_ID == id)&&(get_lcd_id()==1))?1:0;
}
static void lcm_init(void)
{
//	SET_RESET_PIN(0);
//	MDELAY(1);
			
#ifdef BUILD_LK	
	upmu_set_rg_vgp3_vosel(3);   //3 means 1.8V
	upmu_set_rg_vgp3_en(1);
#else
  if(TRUE != hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800,"lcdGP3"))
	{
		printk("%s, Fail to enable digital power\n", __func__);
	}
#endif

	MDELAY(5);		//need 1ms
	
	mt_set_gpio_mode(LCD_5V_LDO, GPIO_MODE_00);
	mt_set_gpio_dir(LCD_5V_LDO, GPIO_DIR_OUT);
	mt_set_gpio_out(LCD_5V_LDO, GPIO_OUT_ONE);
	
	
	MDELAY(10);      //need 1ms
	           	
	SET_RESET_PIN(1);
	MDELAY(10);  		//need 10ms    

//	init_lcm_registers();
	push_table(lcm_initialization_setting);
}
static unsigned int lcm_compare_id(void)
{
	int i;
#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
       hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
  MDELAY(100);
  	mt_set_gpio_mode(GPIO_LCD_PIN_ID, GPIO_MODE_00);
	 mt_set_gpio_dir(GPIO_LCD_PIN_ID, GPIO_DIR_IN);
	//mt_set_gpio_pull_enable(GPIO_LCD_PIN_ID, 1);
	//mt_set_gpio_pull_select(GPIO_LCD_PIN_ID, GPIO_PULL_UP);	
  	
 	i=mt_get_gpio_in(GPIO_LCD_PIN_ID);  
#ifdef BUILD_LK
	printf("MYCAT NT35512 lk  lcm_compare_id=%d\n",i);
#else
     printk("MYCAT NT35512 kernel  lcm_compare_id=%d\n",i);
#endif
	if(i == 1)
		return 1;
	else
    		return 1;
}
static unsigned int lcm_compare_id(void)
{
	#if defined(BUILD_LK)
		upmu_set_rg_vgp2_vosel(5);
		upmu_set_rg_vgp2_en(1);
		
		upmu_set_rg_vgp3_vosel(3);
		upmu_set_rg_vgp3_en(1);	
#else
		hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
		hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
 	unsigned int id = 0;
	unsigned char buffer[3];
	unsigned int array[16];
	
	SET_RESET_PIN(1);  //NOTE:should reset LCM firstly
	SET_RESET_PIN(0);
	MDELAY(6);
	SET_RESET_PIN(1);
	MDELAY(50);

	array[0] = 0x00033700;// read id return two byte,version and id
	dsi_set_cmdq(array, 1, 1);
	read_reg_v2(0x04, buffer, 3);
	id = ((buffer[1]<<8)&0xFF00)|(buffer[0]&0x00FF); //we only need ID

	Lcd_Log("wqcat %s, id1 = 0x%08x, id2 = 0x%08x\n", __func__, buffer[0], buffer[1]);

  return (id==LCM_ID&&get_lcd_id()==0)?1:0;
}
static void lcm_init(void)
{
#ifdef BUILD_LK
    upmu_set_rg_vgp2_vosel(5);
    upmu_set_rg_vgp2_en(1);
    MDELAY(50);
		
    upmu_set_rg_vgp3_vosel(3);
    upmu_set_rg_vgp3_en(1); 
#else
    hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM28");
    hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM18");
#endif
    MDELAY(100);

    config_gpio();
    SET_RESET_PIN(1);
    MDELAY(10);
    SET_RESET_PIN(0);
    MDELAY(20);
    SET_RESET_PIN(1);
    MDELAY(50);

    init_lcm_registers();
}
static unsigned int lcm_compare_id(void)
{
	int   array[4];
		char  buffer[5];
		unsigned int id=0;
	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
  hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
    MDELAY(100);	
		SET_RESET_PIN(0);
		MDELAY(200);
		SET_RESET_PIN(1);
		MDELAY(200);
		
	array[0] = 0x00083700;// read id return two byte,version and id
	dsi_set_cmdq(array, 1, 1);

	read_reg_v2(0xA1,buffer,4);
	
	id=(buffer[2]<<8)+buffer[3];

	return (LCM_ID == id)?1:0;
}
static void lcm_init(void)
{


#ifdef BUILD_LK
    upmu_set_rg_vgp2_vosel(5);
    upmu_set_rg_vgp2_en(1);
    MDELAY(50);
    
    upmu_set_rg_vgp3_vosel(3);
    upmu_set_rg_vgp3_en(1); 
     
#else
    hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM28");
    hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM18");
#endif
		  MDELAY(50);

    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(1);
    SET_RESET_PIN(1);
    MDELAY(10);
  

	 push_table(lcm_initialization_setting1, sizeof(lcm_initialization_setting1) / sizeof(struct LCM_setting_table), 1);
}
static void lcm_init(void)
{
#ifdef BUILD_LK

	printf("[LK/LCM] lcm_init() enter \n");

	lcm_set_gpio_output(GPIO_LCM_RST_EN, 0);
	MDELAY(20);

	lcm_set_gpio_output(GPIO_LCM_RST_EN, 1);
	MDELAY(50);

	//VDD power on ->VGP3_PMU 1.8V
	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(0x1);
    MDELAY(20);
	//AVDD power on
	lcm_set_gpio_output(GPIO_LCM_PWR_EN, 1);
	MDELAY(20);
	

#elif (defined BUILD_UBOOT)
#else

	printk("[Kernel/LCM] lcm_init() enter \n");	

#endif	 
}
static unsigned int lcm_compare_id(void)
{
        unsigned int array[4];
        unsigned char buffer[1];
        unsigned char id_high=0;
        unsigned char id_midd=0;
        unsigned char id_low=0;
        unsigned int id=0;
	Lcd_Log("lcm_compare_id\n");
#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);
	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);
	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
	hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
	MDELAY(50);

#ifdef BUILD_LK
	printf("MYCAT ILI9608 lk lcm_init\n");
#else
      printk("MYCAT ILI9608  kernel lcm_init\n");
#endif
    SET_RESET_PIN(1);
    MDELAY(30);
    SET_RESET_PIN(0);
    MDELAY(50);
    SET_RESET_PIN(1);
    MDELAY(120);

        array[0]=0x00063902;
        array[1]=0x0698ffff;
        array[2]=0x00000104;
        dsi_set_cmdq(array, 3, 1);
        MDELAY(10);

        array[0]=0x00023700;
        dsi_set_cmdq(array, 1, 1);
        //read_reg_v2(0x04, buffer, 3);//if read 0x04,should get 0x008000,that is both OK.
    
        read_reg_v2(0x00, buffer,1);
        id_high = buffer[0]; ///////////////////////0x98

        read_reg_v2(0x01, buffer,1);
        id_midd = buffer[0]; ///////////////////////0x06

        read_reg_v2(0x02, buffer,1);
        id_low = buffer[0]; ////////////////////////0x04

        id = (id_high << 16) | (id_midd << 8) | id_low;
        
        Lcd_Log("id=0x%x,get_lcd_id=%d \n",id,get_lcd_id());
//        return (LCM_ID == id)?1:0;
        //return (get_lcd_id()==1)?1:0;
	return (LCM_ID == id&&get_lcd_id()==0)?1:0;
        }
static void lcm_suspend(void)
{
	push_table(lcm_deep_sleep_mode_in_setting, sizeof(lcm_deep_sleep_mode_in_setting) / sizeof(struct LCM_setting_table), 1);

	SET_RESET_PIN(1);
	MDELAY(10);
	SET_RESET_PIN(0);
	MDELAY(20);
	upmu_set_rg_vgp2_en(0);
	upmu_set_rg_vgp3_en(0); 
}
static unsigned int lcm_compare_id(void)
{
#if defined(BUILD_LK)
		upmu_set_rg_vgp2_vosel(5);
		upmu_set_rg_vgp2_en(1);
		
		upmu_set_rg_vgp3_vosel(3);
		upmu_set_rg_vgp3_en(1);	
#else
		hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
		hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
    int array[4];
    char buffer[1];
    char id_high=0;
    char id_midd=0;
    char id_low=0;
    int id=0;

    //Do reset here
    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(25);       
    SET_RESET_PIN(1);
    MDELAY(50);      
   
    array[0]=0x00063902;
    array[1]=0x0698ffff;
    array[2]=0x00000104;
    dsi_set_cmdq(array, 3, 1);
    MDELAY(10);

    array[0]=0x00023700;
    dsi_set_cmdq(array, 1, 1);
    //read_reg_v2(0x04, buffer, 3);//if read 0x04,should get 0x008000,that is both OK.

    read_reg_v2(0x00, buffer,1);
    id_high = buffer[0]; ///////////////////////0x98

    read_reg_v2(0x01, buffer,1);
    id_midd = buffer[0]; ///////////////////////0x06

    read_reg_v2(0x02, buffer,1);
    id_low = buffer[0]; ////////////////////////0x04

    id = (id_high << 16) | (id_midd << 8) | id_low;
    
    Lcd_Log("wqcat %s, 0x00=0x%x,0x01=0x%x,0x02=0x%x,id=0x%x\n", __func__, id_high,id_midd,id_low,id);
    return (LCM_ID == id&&get_lcd_id()==1)?1:0;
    //return (get_lcd_id()==1)?1:0;

}
static unsigned int lcm_compare_id()
{
//	return 1;
#if 0	
    unsigned int id = 0, id2 = 0;
    unsigned char buffer[2];
    unsigned int data_array[16];

#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
       hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
    MDELAY(100);


    SET_RESET_PIN(1);
    MDELAY(20);
    SET_RESET_PIN(0);
    MDELAY(50);
    SET_RESET_PIN(1);
    MDELAY(100);

    //*************Enable CMD2 Page1  *******************//
    data_array[0]=0x00043902;
    data_array[1]=0x6983ffb9;//52AA55F0;
    //data_array[2]=0x00000108;
    dsi_set_cmdq(data_array, 3, 1);
    MDELAY(10);

    data_array[0] = 0x00023700;// read id return two byte,version and id
    dsi_set_cmdq(data_array, 1, 1);
    MDELAY(10);

    read_reg_v2(0xF4, buffer, 2);
    id = buffer[0]; //we only need ID

    Lcd_Log("\n %s HX8369A 0x%x , 0x%x , 0x%x \n",__func__,buffer[0],buffer[1],id);

    return (id == LCM_ID)?1:0;
#else
    Lcd_Log("mycat xxxxxx get_lcd_id=0x%x\n",get_lcd_id());
    return (get_lcd_id()==1)?1:0;
#endif
}
static unsigned int lcm_compare_id(void)
{
   unsigned int id = 0, id2 = 0;
    unsigned char buffer[3];
    unsigned int data_array[16];

#ifdef BUILD_LK
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
  hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM");
	hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM");
#endif
    MDELAY(100);

    SET_RESET_PIN(1);  //NOTE:should reset LCM firstly
    MDELAY(10);
    SET_RESET_PIN(0);
    MDELAY(50);
    SET_RESET_PIN(1);
    MDELAY(180);	
    

  /*  data_array[0]=0x00043902;
    data_array[1]=0x1698FFFF;
    dsi_set_cmdq(data_array, 2, 1);
    MDELAY(20); */
    
    data_array[0] = 0x00043700;// read id return two byte,version and id
    dsi_set_cmdq(data_array, 1, 1);
    MDELAY(20); 
    
    read_reg_v2(0xD3, buffer, 4);
    id = buffer[2]; //we only need ID
    id2= buffer[1] << 8 | buffer[2]; //we test buffer 1
    
 
    Lcd_Log("MYCAT ILI9806 A40318 %s, id=0x%x,id2=0x%x\n", __func__, id,id2);
 
 
    return (LCM_ID == id2)?1:0;
	//return 1;

	   // return (get_lcd_id()==1)?1:0;

}
static unsigned int lcm_compare_id(void)
{
 
    int   array[4];
   char  buffer[5];
   char  id_high=0;
   char  id_low=0;
   int   id=0;

#ifdef BUILD_LK
    upmu_set_rg_vgp2_vosel(5);
    upmu_set_rg_vgp2_en(1);
    MDELAY(50);
    
    upmu_set_rg_vgp3_vosel(3);
    upmu_set_rg_vgp3_en(1); 
     
#else
    hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM28");
    hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM18");
#endif
    MDELAY(100);

   
   SET_RESET_PIN(1);  //NOTE:should reset LCM firstly
   SET_RESET_PIN(0);
   MDELAY(10);
   SET_RESET_PIN(1);
   MDELAY(10);
 
   array[0] = 0x00053700;// read id return two byte,version and id
   dsi_set_cmdq(array, 1, 1);
   read_reg_v2(0xA1,buffer, 5);
 
   id_high = buffer[2];            //should be 0x80
   Lcd_Log("%s, id_high = 0x%08x\n", __func__, id_high);
   id_low  = buffer[3];            //should be 0x18
   Lcd_Log("%s, id_low = 0x%08x\n", __func__, id_low);
   id      = (id_high<<8)|id_low;  //should be 0x8018
 
	 Lcd_Log("%s, id = 0x%08x\n", __func__, id); 
 
   return (LCM_ID == id&&get_lcd_id()==0)?1:0;
  // return (LCM_ID == id)?1:0;
   
   //return 1;
}
static void lcm_init(void)
{

		upmu_set_rg_vgp2_vosel(5);
		upmu_set_rg_vgp2_en(1);
		
		upmu_set_rg_vgp3_vosel(3);
		upmu_set_rg_vgp3_en(1);	

    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(50);
    SET_RESET_PIN(1);
    MDELAY(120);

	push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}
static void lcm_suspend(void)
{
//	unsigned int data_array[16];
	
#ifndef BUILD_LK
  if(LK_INIT)	
  {
  	LK_INIT=0;
	  if(TRUE != hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800,"lcdGP3"))                   //add referance count
		{
			printk("%s, Fail to enable digital power\n", __func__);
		}
	}
#endif

/*	data_array[0]=0x00280500; // Display Off
	dsi_set_cmdq(data_array, 1, 1);
	
	MDELAY(20);		//need 20ms
	
	data_array[0] = 0x00100500; // Sleep In
	dsi_set_cmdq(data_array, 1, 1);

	MDELAY(100);			//need 4 frame time*/
	MDELAY(1);
	SET_RESET_PIN(0);
	MDELAY(1);
	
	mt_set_gpio_mode(LCD_5V_LDO, GPIO_MODE_00);
	mt_set_gpio_dir(LCD_5V_LDO, GPIO_DIR_OUT);
	mt_set_gpio_out(LCD_5V_LDO, GPIO_OUT_ZERO);
	
	MDELAY(110);    //need 100ms
	
#ifdef BUILD_LK
	upmu_set_rg_vgp3_en(0);
#else
	if(TRUE != hwPowerDown(MT6323_POWER_LDO_VGP3,"lcdGP3"))
	{
		printk("%s, Fail to disable digital power\n", __func__);
	}
#endif
//	MDELAY(20);
}
static void lcm_suspend(void)
{
	push_table(lcm_deep_sleep_mode_in_setting, sizeof(lcm_deep_sleep_mode_in_setting) / sizeof(struct LCM_setting_table), 1);

 SET_RESET_PIN(0);
   MDELAY(1);
   SET_RESET_PIN(1);

	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_en(0);
	upmu_set_rg_vgp3_en(0);	
#else

	       hwPowerDown(MT6323_POWER_LDO_VGP2,"Lance_LCM");
		hwPowerDown(MT6323_POWER_LDO_VGP3, "Lance_LCM");
		#endif
		 MDELAY(50);//Must > 10ms

}
static void lcm_resume(void)
{
#if 1
    push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1);
#else

#ifndef BUILD_LK 
	lcm_init(); 
#else 
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
 	MDELAY(100);
#endif 

#endif
}
static void lcm_resume(void)
{
#ifdef BUILD_LK

	printf("[LK/LCM] lcm_resume() enter \n");


	lcm_set_gpio_output(GPIO_LCM_RST_EN, 0);
	MDELAY(20);

	lcm_set_gpio_output(GPIO_LCM_RST_EN, 1);
	MDELAY(20);

	//VGP3_PMU 1.8V
	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(0x1);
	MDELAY(20);

	lcm_set_gpio_output(GPIO_LCM_PWR_EN, 1);
	MDELAY(20);
	
	
#elif (defined BUILD_UBOOT)
#else

	printk("[Kernel/LCM] lcm_resume() enter \n");


	lcm_set_gpio_output(GPIO_LCM_RST_EN, 0);
	MDELAY(20);

	lcm_set_gpio_output(GPIO_LCM_RST_EN, 1);
	MDELAY(20);

	hwPowerOn(MT6323_POWER_LDO_VGP3 , VOL_1800 ,"LCM");
	MDELAY(20);

	lcm_set_gpio_output(GPIO_LCM_PWR_EN, 1);
	MDELAY(20);		
	
#endif	 
}
static unsigned int lcm_compare_id(void)
{
	unsigned int id=0;
	unsigned char buffer[2];
	unsigned int array[16];  

#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
       hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif

	SET_RESET_PIN(1);
	MDELAY(5);
	SET_RESET_PIN(0);
	MDELAY(10);
	SET_RESET_PIN(1);
	MDELAY(150);//Must over 6 ms,SPEC request
	array[0]=0x00043902;
	array[1]=0x8983FFB9;// page enable
	dsi_set_cmdq(&array, 2, 1);
	MDELAY(10);

	array[0] = 0x00023700;// return byte number
	dsi_set_cmdq(&array, 1, 1);
	MDELAY(10);

	read_reg_v2(0xF4, buffer, 2);
	id = buffer[0]; 
	
#ifndef BUILD_LK
	printk("%s, id = 0x%02x, buf[1]=0x%02x\n", __func__, id,buffer[1]);
#endif
	return (LCM_ID_HX8389B == id)?1:0;
}
static unsigned int lcm_compare_id(void)
{
	unsigned int id = 0,id1=0,id2 = 0;
	unsigned char buffer[2]; 
	unsigned int data_array[16];
#if defined(BUILD_LK)
    upmu_set_rg_vgp2_vosel(5);
    upmu_set_rg_vgp2_en(1);

    upmu_set_rg_vgp3_vosel(3);
    upmu_set_rg_vgp3_en(1);
#else
    hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
    hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
    MDELAY(100);

	SET_RESET_PIN(1);  //NOTE:should reset LCM firstly 
	MDELAY(10); 
	SET_RESET_PIN(0);
	MDELAY(10); 
	SET_RESET_PIN(1); 
	MDELAY(10);        
	//*************Enable CMD2 Page1  *******************//
	
	data_array[0]=0x00063902;
	data_array[1]=0x52AA55F0;
	data_array[2]=0x00000108;
	dsi_set_cmdq(data_array, 3, 1); 
	MDELAY(10); 
	data_array[0] = 0x00023700;// read id return two byte,version and id
	dsi_set_cmdq(data_array, 1, 1); 
	MDELAY(10); 
	read_reg_v2(0xC5, buffer, 2); 
	id1 = buffer[0]; //we only need ID
	id2= buffer[1]; //we test buffer 1
	id = (id1<<8) | id2;
	return (0x5517 == id)?1:0;

}
static void lcm_init(void)
{
		unsigned int data_array[64];

#if defined(BUILD_LK)
		upmu_set_rg_vgp2_vosel(5);
		upmu_set_rg_vgp2_en(1);
		
		upmu_set_rg_vgp3_vosel(3);
		upmu_set_rg_vgp3_en(1);	
#else
		hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
		hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif

    SET_RESET_PIN(1);
    SET_RESET_PIN(0);
    MDELAY(10);//Must > 10ms
    SET_RESET_PIN(1);
    MDELAY(100);//Must > 120ms

	push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}
static void lcm_suspend(void)
{
	push_table(lcm_deep_sleep_mode_in_setting, sizeof(lcm_deep_sleep_mode_in_setting) / sizeof(struct LCM_setting_table), 1);

       MDELAY(20);//Must > 10ms

    mt_set_gpio_mode(59,GPIO_MODE_00);
    mt_set_gpio_dir(59,GPIO_DIR_OUT);
    mt_set_gpio_out(59,GPIO_OUT_ZERO);
    MDELAY(20);//Must > 10ms
	  mt_set_gpio_out(59,GPIO_OUT_ONE);
      MDELAY(20);//Must > 10ms
	    mt_set_gpio_out(59,GPIO_OUT_ZERO);
		#if defined(BUILD_LK)
	upmu_set_rg_vgp2_en(0);
	upmu_set_rg_vgp3_en(0);	
#else

	       hwPowerDown(MT6323_POWER_LDO_VGP2,"Lance_LCM");
		hwPowerDown(MT6323_POWER_LDO_VGP3, "Lance_LCM");
		#endif
		 MDELAY(50);//Must > 10ms
}
static void lcm_init(void)
{
	#if defined(BUILD_LK)
	upmu_set_rg_vgp2_vosel(5);
	upmu_set_rg_vgp2_en(1);

	upmu_set_rg_vgp3_vosel(3);
	upmu_set_rg_vgp3_en(1);	
#else
	hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
       hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif

	SET_RESET_PIN(1);
	MDELAY(5);
	SET_RESET_PIN(0);
	MDELAY(10);
	SET_RESET_PIN(1);
	MDELAY(150);//Must over 6 ms,SPEC request
	lcm_init_setting();
	
	/////push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}
static void lcm_init(void)
{
	#if defined(BUILD_LK)
		upmu_set_rg_vgp2_vosel(5);
		upmu_set_rg_vgp2_en(1);
		
		upmu_set_rg_vgp3_vosel(3);
		upmu_set_rg_vgp3_en(1);	
#else
		hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM");
		hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM");
#endif
  SET_RESET_PIN(1);
  SET_RESET_PIN(0);
  MDELAY(50);//Must > 5ms
  SET_RESET_PIN(1);
  MDELAY(120);//Must > 50ms

	Lcd_Log("wqcat RM68171_zhuoershi_Z40252N00I4OMA_BOE_DSI_2_WVGA_VDO lcm init\n");
	
	//init_lcm_registers();
	push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1);
}