Exemple #1
0
void mdnie_late_resume(struct early_suspend *h)
{
 	u32 i, conversion;
 	struct mdnie_info *mdnie = container_of(h, struct mdnie_info, early_suspend);
#if defined(CONFIG_FB_MDNIE_PWM)
 	struct lcd_platform_data *pd = NULL;
 
 	dev_info(mdnie->dev, "+%s\n", __func__);
 	pd = mdnie->lcd_pd;
 
 	if (mdnie->enable)
 		mdnie_pwm_control(mdnie, 0);
 
 	if (!pd)
 		dev_info(&mdnie->bd->dev, "platform data is NULL.\n");
 
 	if (!pd->power_on)
 		dev_info(&mdnie->bd->dev, "power_on is NULL.\n");
 	else
 		pd->power_on(NULL, 1);
 
 	if (mdnie->enable) {
 		dev_info(&mdnie->bd->dev, "brightness=%d\n", mdnie->bd->props.brightness);
 		update_brightness(mdnie);
 	}
 
 	mdnie->bd_enable = TRUE;
 	dev_info(mdnie->dev, "-%s\n", __func__);
#endif

      printk("[mdnie] %s \n", __func__);

      mdnie_status = MDNIE_RESUME;

 	for (i = 0; i < 5; i++) {
 		if (negative[i].enable){
 			dev_info(mdnie->dev, "pid=%d, %s, %s\n", negative[i].pid, negative[i].comm, negative[i].time);
                   mdnie->negative = NEGATIVE_ON;
 	}
 	}


      //if(NEGATIVE_ON == mdnie->negative)
         mdelay(110);

      set_cabc_value(mdnie, 0);
      set_mdnie_value(mdnie, 0);

      //if(NEGATIVE_ON == mdnie->negative)
        mdelay(30);
 
#if LCD_LOW_TEMP_CONVERSION
        if(lcd_panel_id == LCD_PANEL_DTC){
           if( -50 < get_temp_from_ps_battery()){
         conversion = 0x02;
            }else{
         conversion = 0x01;
            }
        }else{
            if( -50 < get_temp_from_ps_battery()){
                conversion = 0x02;
            }else{
                conversion = 0x01;
            }
         }
      vc_display_bus_write(0,0xB4,&conversion,1);
#endif

 	return ;
}
/*
 *
 *   Function Name: DSI_PowerControl
 *
 *   Description:	  Display Module Control
 *
 */
Int32 DSI_PowerControl(
	DISPDRV_HANDLE_T drvH,
	DISPLAY_POWER_STATE_T state)
{
	Int32  res = 0;
	DispDrv_PANEL_t *pPanel = (DispDrv_PANEL_t *)drvH;
	DISPDRV_INFO_T *info = pPanel->disp_info;

	switch (state) {
	case CTRL_PWR_ON:
		switch (pPanel->pwrState) {
		case STATE_PWR_OFF:
			res = regulator_enable(disp_reg);
			if (res < 0) {
				DSI_ERR("Couldn't enable regulator, res=%ld\n",
					res);
				res = -1;
				break;
			}
			usleep_range(1000, 1010);
#ifdef CONFIG_LCD_LOW_TEMP_CONVERSION
		if( -50 > get_temp_from_ps_battery())
			DSI_ExecCmndList(pPanel, info->init_lowtemp_seq);	
		else
#endif		
			DSI_ExecCmndList(pPanel, info->init_seq);
			
			DSI_WinSet(drvH, TRUE, &pPanel->win_dim);
			pPanel->pwrState = STATE_SCREEN_OFF;
			DSI_INFO("INIT-SEQ\n");
			break;
		default:
			DSI_ERR("POWER ON req While Not In POWER DOWN State\n");
			break;
		}
		break;

	case CTRL_PWR_OFF:
		if (pPanel->pwrState !=	STATE_PWR_OFF) {
			if (info->vmode && info->vid_cmnds)
				DSI_panel_shut_down(pPanel);
			else
				DSI_ExecCmndList(pPanel, info->scrn_off_seq);
			DSI_ExecCmndList(pPanel, info->slp_in_seq);

			res = regulator_disable(disp_reg);
			if (res < 0) {
				DSI_ERR("Couldn't disable regulator, res=%ld\n",
					res);
				res = -1;
				break;
			}
			hw_reset(drvH, TRUE);
			memset(&pPanel->win_cur, 0, sizeof(DISPDRV_WIN_t));
			pPanel->pwrState = STATE_PWR_OFF;
			DSI_INFO("PWR DOWN\n");
		}
		break;

	case CTRL_SLEEP_IN:
		switch (pPanel->pwrState) {
		case STATE_SCREEN_ON:
			if (info->vmode && info->vid_cmnds)
				DSI_panel_shut_down(pPanel);
			else
				DSI_ExecCmndList(pPanel, info->scrn_off_seq);
			/* Turn OFF and sleep in */
		case STATE_SCREEN_OFF:
			DSI_ExecCmndList(pPanel, info->slp_in_seq);
			pPanel->pwrState = STATE_SLEEP;
			break;
		default:
			DSI_ERR("SLEEP Req, But Not In DISP ON|OFF State\n");
			break;
		}
		break;

	case CTRL_SLEEP_OUT:
		switch (pPanel->pwrState) {
		case STATE_SLEEP:
			DSI_ExecCmndList(pPanel, info->slp_out_seq);
			pPanel->pwrState = STATE_SCREEN_OFF;
			DSI_INFO("SLEEP-OUT\n");
			break;
		default:
			DSI_ERR("SLEEP-OUT Req While Not In SLEEP State\n");
			break;
		}
		break;

	case CTRL_SCREEN_ON:
		switch (pPanel->pwrState) {
		case STATE_SCREEN_OFF:
			if (info->vmode && info->vid_cmnds)
				DSI_panel_turn_on(pPanel);
			else
				DSI_ExecCmndList(pPanel, info->scrn_on_seq);

			pPanel->pwrState = STATE_SCREEN_ON;
			DSI_INFO("SCREEN ON\n");
			break;
		default:
			DSI_ERR("SCRN ON Req While Not In SCRN OFF State\n");
			break;
		}
		break;
	case CTRL_SCREEN_OFF:
		switch (pPanel->pwrState) {
		case STATE_SCREEN_ON:
			if (info->vmode && info->vid_cmnds)
				DSI_panel_shut_down(pPanel);
			else
				DSI_ExecCmndList(pPanel, info->scrn_off_seq);

			pPanel->pwrState = STATE_SCREEN_OFF;
			DSI_INFO("SCREEN OFF\n");
			break;
		default:
			DSI_ERR("SCRN OFF Req While Not In SCRN ON State\n");
			break;
		}
		break;
	default:
		DSI_ERR("Invalid Power State[%d] Requested\n", state);
		res = -1;
		break;
	}
	return res;
}