Ejemplo n.º 1
0
UINT32 mt65xx_disp_get_lcd_time(void)
{
#if 0
	UINT32 time0, time1, lcd_time;
	mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);

    LCD_CHECK_RET(LCD_WaitForNotBusy());

	time0 = gpt4_tick2time_us(gpt4_get_current_tick());
    LCD_CHECK_RET(LCD_StartTransfer(FALSE));

	if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode==CMD_MODE) {
		DSI_clk_HS_mode(1);
		DSI_CHECK_RET(DSI_EnableClk());
	}
	else if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) {
		DSI_clk_HS_mode(1);
		DPI_CHECK_RET(DPI_EnableClk());
		DSI_CHECK_RET(DSI_EnableClk());
	}
    LCD_CHECK_RET(LCD_WaitForNotBusy());

	time1 = gpt4_tick2time_us(gpt4_get_current_tick());

	lcd_time = time1 - time0;
	printf("lcd one %d \n", lcd_time);
	if(0 != lcd_time)	
		return (100000000/lcd_time);
	else
#endif
		return (6000);
}
Ejemplo n.º 2
0
DISP_STATUS DISP_UpdateScreen(UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{

    LCD_CHECK_RET(LCD_WaitForNotBusy());

    if ((lcm_drv->update) &&
	   ((lcm_params->type==LCM_TYPE_DBI) || ((lcm_params->type==LCM_TYPE_DSI) && (lcm_params->dsi.mode==CMD_MODE))))
		{
        lcm_drv->update(x, y, width, height);
    }	

    LCD_CHECK_RET(LCD_SetRoiWindow(x, y, width, height));
    LCD_CHECK_RET(LCD_FBSetStartCoord(x, y));

    LCD_CHECK_RET(LCD_StartTransfer(FALSE));

	if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode==CMD_MODE) {
		DSI_clk_HS_mode(1);
		DSI_CHECK_RET(DSI_EnableClk());
	}
	else if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) {
		DSI_clk_HS_mode(1);
		DPI_CHECK_RET(DPI_EnableClk());
		DSI_CHECK_RET(DSI_EnableClk());
	}
	
    return DISP_STATUS_OK;
}
Ejemplo n.º 3
0
static int get_power_setting_status(void)
{

	static unsigned int temp0,temp1,temp2,temp3;

// LuckAs change
	LCD_WaitForNotBusy();
//	jrd_lcd_waitfornotbusy();
// LuckAs end

         send_ctrl_cmd(0x09);
	read_data_cmd();  //dummy read
	temp0 =  read_data_cmd();	// 0x84
	temp1 =  read_data_cmd();	// 0x63
	temp2 =  read_data_cmd();	// 0x04
	temp3 =  read_data_cmd();	// 0x00

	if( (temp0 != A_NORMAL) || (temp1 != B_NORMAL) || (temp2 != C_NORMAL) || (temp3 != D_NORMAL))
	{
		printk("---------------------------lcm_init ---------------------------\n");
		lcm_init();
// LuckAs change
		lcm_update(0, 0, FRAME_WIDTH, FRAME_HEIGHT);
//		jrd_lcm_update(0, 0, FRAME_WIDTH, FRAME_HEIGHT);
// LuckAs end
	}

	return 0;

}
Ejemplo n.º 4
0
DISP_STATUS DISP_SetBacklight_mode(UINT32 mode)
{
	DISP_STATUS ret = DISP_STATUS_OK;

	disp_drv_init_context();

	LCD_WaitForNotBusy();
	if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
		DSI_CHECK_RET(DSI_WaitForNotBusy());

	if (!lcm_drv->set_backlight) {
		ret = DISP_STATUS_NOT_IMPLEMENTED;
		goto End;
	}

	if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		DSI_SetMode(CMD_MODE);

	lcm_drv->set_backlight_mode(mode);

	if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		DSI_SetMode(lcm_params->dsi.mode);

End:
	return ret;

}
int disphal_wait_not_busy(void)
{
    if (lcm_params->type==LCM_TYPE_DBI)
        LCD_WaitForNotBusy();
    else if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
        DSI_WaitForNotBusy();
    return 0;
}
Ejemplo n.º 6
0
int disphal_panel_enable(const LCM_DRIVER *lcm_drv, struct mutex* pLcmCmdMutex, BOOL enable)
{
    if (enable)
    {
        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {		
            DSI_SetMode(CMD_MODE);
        }
        mutex_lock(pLcmCmdMutex);
		//#ifdef MTK_DISP_CONFIG_SUPPORT
		if(get_fbconfig_start_lcm_config())
		{
		fbconfig_apply_new_lcm_setting();
		//do not call lcm_init if you have ever started LCM config until you reset lcm config ;
		}
		else
		//#endif
        lcm_drv->resume();

        mutex_unlock(pLcmCmdMutex);

        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {
            //DSI_clk_HS_mode(1);
            DSI_WaitForNotBusy();
            DSI_SetMode(lcm_params->dsi.mode);
        }
    }
    else
    {
        LCD_CHECK_RET(LCD_WaitForNotBusy());
        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
            DSI_CHECK_RET(DSI_WaitForNotBusy());

        if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {		
            DPI_CHECK_RET(DPI_DisableClk());
            //msleep(200);
            DSI_Reset();
            DSI_clk_HS_mode(0);
            DSI_SetMode(CMD_MODE);
        }

        mutex_lock(pLcmCmdMutex);
		//#ifdef MTK_DISP_CONFIG_SUPPORT
		if(get_fbconfig_start_lcm_config())
		{
		fbconfig_apply_new_lcm_setting();
		//do not call lcm_init if you have ever started LCM config until you reset lcm config ;
		}
		else
		//#endif
        lcm_drv->suspend();
        mutex_unlock(pLcmCmdMutex);
    }
    return 0;
}
Ejemplo n.º 7
0
UINT32 mt_disp_get_lcd_time(void)
{
	UINT32 time0, time1, lcd_time;

	mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
	
	if(lcm_params->type==LCM_TYPE_DPI)
		DPI_WaitVsync();
	else if(lcm_params->type==LCM_TYPE_DBI)
		LCD_WaitForNotBusy();
	else if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) {
		DSI_WaitVsync();
		DSI_WaitVsync();
	}
	time0 = gpt4_tick2time_us(gpt4_get_current_tick());

	if(lcm_params->type==LCM_TYPE_DPI)
		DPI_WaitVsync();
	else if(lcm_params->type==LCM_TYPE_DBI){
		mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
		LCD_WaitForNotBusy();
	}
	else{//DSI
		if(lcm_params->dsi.mode!=CMD_MODE)
			DSI_WaitVsync();
		else
			DSI_StartTransfer(TRUE);
//			DSI_WaitBtaTE();
	}

	time1 = gpt4_tick2time_us(gpt4_get_current_tick());

	lcd_time = time1 - time0;

	printf("Screen Update Costs %d us\n", lcd_time);

    mt_disp_adjusting_hardware_addr();
	if(0 != lcd_time)	
		return (100000000/lcd_time);
	else
		return (6000);
}
Ejemplo n.º 8
0
DISP_STATUS DISP_PanelEnable(BOOL enable)
{

    static BOOL s_enabled = FALSE;

    disp_drv_init_context();

    if (!lcm_drv->suspend || !lcm_drv->resume) {
        return DISP_STATUS_NOT_IMPLEMENTED;
    }

	if (enable && !s_enabled) {
		s_enabled = TRUE;

		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{		
			DSI_SetMode(CMD_MODE);
		}

		lcm_drv->resume();

		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{
			//DSI_clk_HS_mode(1);
			DSI_SetMode(lcm_params->dsi.mode);
			
			//DPI_CHECK_RET(DPI_EnableClk());
			//DSI_CHECK_RET(DSI_EnableClk());
		}
	}
	else if (!enable && s_enabled)
	{
		LCD_CHECK_RET(LCD_WaitForNotBusy());
		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
			DSI_CHECK_RET(DSI_WaitForNotBusy());
		s_enabled = FALSE;

		if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{		
			DPI_CHECK_RET(DPI_DisableClk());
			udelay(200*1000);
			DSI_Reset();
			DSI_clk_HS_mode(0);
			DSI_SetMode(CMD_MODE);
		}

		lcm_drv->suspend();
	}

    return DISP_STATUS_OK;
}
int disphal_panel_enable(const LCM_DRIVER *lcm_drv, struct mutex* pLcmCmdMutex, BOOL enable)
{
    if (enable)
    {
        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {		
            DSI_SetMode(CMD_MODE);
        }
        mutex_lock(pLcmCmdMutex);
        lcm_drv->resume();

        if(lcm_drv->check_status)
            lcm_drv->check_status();

        DSI_LP_Reset();
        mutex_unlock(pLcmCmdMutex);

        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {
            //DSI_clk_HS_mode(1);
            DSI_WaitForNotBusy();
            DSI_SetMode(lcm_params->dsi.mode);
        }
    }
    else
    {
        LCD_CHECK_RET(LCD_WaitForNotBusy());
        if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
            DSI_CHECK_RET(DSI_WaitForNotBusy());

        if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
        {		
            DPI_CHECK_RET(DPI_DisableClk());
            //msleep(200);
            //DSI_Reset();
            DSI_clk_HS_mode(0);
            DSI_SetMode(CMD_MODE);
        }

        mutex_lock(pLcmCmdMutex);
        lcm_drv->suspend();
        mutex_unlock(pLcmCmdMutex);
    }
    return 0;
}
Ejemplo n.º 10
0
DISP_STATUS DISP_SetBacklight(UINT32 level)
{
	DISP_STATUS ret = DISP_STATUS_OK;

	disp_drv_init_context();

	LCD_WaitForNotBusy();

	if (!lcm_drv->set_backlight) {
		ret = DISP_STATUS_NOT_IMPLEMENTED;
		goto End;
	}

	lcm_drv->set_backlight(level);

End:
	return ret;
}
Ejemplo n.º 11
0
DISP_STATUS DISP_SetPWM(UINT32 divider)
{
	DISP_STATUS ret = DISP_STATUS_OK;

	disp_drv_init_context();

	LCD_WaitForNotBusy();
	if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
		DSI_CHECK_RET(DSI_WaitForNotBusy());

	if (!lcm_drv->set_pwm) {
		ret = DISP_STATUS_NOT_IMPLEMENTED;
		goto End;
	}

	lcm_drv->set_pwm(divider);
End:
	return ret;
}
Ejemplo n.º 12
0
void mt_disp_wait_idle(void)
{
	if(lcm_params->type==LCM_TYPE_DPI)
	{
		DPI_WaitVsync();
	}
	else if(lcm_params->type==LCM_TYPE_DBI)
	{
		LCD_WaitForNotBusy();
	}
	else if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) 
	{
		DSI_WaitVsync();
		DSI_WaitVsync();
	}
	else if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode ==CMD_MODE) 
	{
		DSI_WaitForNotBusy();
	}
}
Ejemplo n.º 13
0
BOOL DISP_EsdRecover(void)
{
    BOOL result = FALSE;
    DISP_LOG("DISP_EsdRecover enter");

    if(lcm_drv->esd_recover == NULL)
    {
        return FALSE;
    }

    if (down_interruptible(&sem_update_screen)) {
        DISP_LOG("ERROR: Can't get sem_update_screen in DISP_EsdRecover()\n");
        return FALSE;
    }

    if(is_lcm_in_suspend_mode)
    {
        up(&sem_update_screen);
        return FALSE;
    }

    LCD_CHECK_RET(LCD_WaitForNotBusy());
    if(lcm_params->type==LCM_TYPE_DSI)
    {
        DSI_CHECK_RET(DSI_WaitForNotBusy());        
    }

     DISP_LOG("DISP_EsdRecover do LCM recover");

    // do necessary configuration reset for LCM re-init
    if(disp_drv->esd_reset)
        disp_drv->esd_reset();

    /// LCM recover
    result = lcm_drv->esd_recover();

    up(&sem_update_screen);

    return result;
}
Ejemplo n.º 14
0
BOOL DISP_EsdCheck(void)
{
    BOOL result = FALSE;

    disp_drv_init_context();

    if(lcm_drv->esd_check == NULL)
    {
        return FALSE;
    }
    
#if defined(CONFIG_ARCH_MT6575)
    if(get_chip_eco_ver()==CHIP_E1 && lcm_params->type==LCM_TYPE_DSI)
    {
        ///DSI read is inavailable for E1
        return FALSE;
    }
#endif

    if (down_interruptible(&sem_update_screen)) {
        DISP_LOG("ERROR: Can't get sem_update_screen in DISP_EsdCheck()\n");
        return FALSE;
    }

    if(is_lcm_in_suspend_mode)
    {
        up(&sem_update_screen);
        return FALSE;
    }

    LCD_CHECK_RET(LCD_WaitForNotBusy());
    if(lcm_params->type==LCM_TYPE_DSI)
        DSI_CHECK_RET(DSI_WaitForNotBusy());

     result = lcm_drv->esd_check();
    
    up(&sem_update_screen);

    return result;
}
Ejemplo n.º 15
0
DISP_STATUS DISP_UpdateScreen(UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{
	DISP_LOG("update screen, (%d,%d),(%d,%d)\n", x, y, width, height);
	if (down_interruptible(&sem_update_screen)) {
		DISP_LOG("ERROR: Can't get sem_update_screen in DISP_UpdateScreen()\n");
		return DISP_STATUS_ERROR;
	}
#if defined(MTK_LCD_HW_3D_SUPPORT)
	LCD_CHECK_RET(DISP_Set3DPWM( DISP_Is3DEnabled(), DISP_is3DLandscapeMode() ));
#endif
	// if LCM is powered down, LCD would never recieve the TE signal
	//
	if (is_lcm_in_suspend_mode || is_engine_in_suspend_mode) goto End;

	LCD_CHECK_RET(LCD_WaitForNotBusy());
	if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
		DSI_CHECK_RET(DSI_WaitForNotBusy());

	if (lcm_drv->update) {
		lcm_drv->update(x, y, width, height);
    }

    LCD_CHECK_RET(LCD_SetRoiWindow(x, y, width, height));

	LCD_CHECK_RET(LCD_FBSetStartCoord(x, y));

	if (-1 != direct_link_layer) {
		//MT6516IDP_EnableDirectLink();     // FIXME
	} else {
		disp_drv->update_screen();
	}

End:
	up(&sem_update_screen);

	return DISP_STATUS_OK;
}
Ejemplo n.º 16
0
static void process_dbg_opt(const char *opt)
{
    if (0 == strncmp(opt, "hdmion", 6))
    {
	hdmi_force_init();
    }
    else if (0 == strncmp(opt, "fps:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            dbg_opt.en_fps_log = 1;
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            dbg_opt.en_fps_log = 0;
        } else {
            goto Error;
        }
        reset_fps_logger();
    }
    else if (0 == strncmp(opt, "tl:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            dbg_opt.en_touch_latency_log = 1;
        } else if (0 == strncmp(opt + 3, "off", 3)) {
            dbg_opt.en_touch_latency_log = 0;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "black", 5))
    {
	mtkfb_clear_lcm();
    }
    else if (0 == strncmp(opt, "suspend", 4))
    {
        DISP_PanelEnable(FALSE);
        DISP_PowerEnable(FALSE);
    }
    else if (0 == strncmp(opt, "resume", 4))
    {
        DISP_PowerEnable(TRUE);
        DISP_PanelEnable(TRUE);
    }
    else if (0 == strncmp(opt, "lcm:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DISP_PanelEnable(TRUE);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DISP_PanelEnable(FALSE);
        }
		else if (0 == strncmp(opt + 4, "init", 4)) {
			if (NULL != lcm_drv && NULL != lcm_drv->init) {
        		lcm_drv->init();
    		}
        }else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "cabc:", 5))
    {
        if (0 == strncmp(opt + 5, "ui", 2)) {
			mtkfb_set_backlight_mode(1);
        }else if (0 == strncmp(opt + 5, "mov", 3)) {
			mtkfb_set_backlight_mode(3);
        }else if (0 == strncmp(opt + 5, "still", 5)) {
			mtkfb_set_backlight_mode(2);
        }else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "lcd:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DISP_PowerEnable(TRUE);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DISP_PowerEnable(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dbi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            LCD_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            LCD_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DPI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DPI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dsi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DSI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DSI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "te:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            LCD_TE_Enable(TRUE);
			DSI_TE_Enable(TRUE);
        } else if (0 == strncmp(opt + 3, "off", 3)) {
            LCD_TE_Enable(FALSE);
			DSI_TE_Enable(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "vsynclog:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            EnableVSyncLog = 1;
        } else if (0 == strncmp(opt + 9, "off", 3)) 
        {
            EnableVSyncLog = 0;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "layer", 5))
    {
        dump_lcd_layer_info();
    }
    else if (0 == strncmp(opt, "reg:", 4))
    {
        if (0 == strncmp(opt + 4, "lcd", 3)) {
            LCD_DumpRegisters();
        }else if (0 == strncmp(opt + 4, "dpi1", 4)) {
            DPI1_DumpRegisters();
        }else if (0 == strncmp(opt + 4, "dpi", 3)) {
            DPI_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "dsi", 3)) {
            DSI_DumpRegisters();
#if defined(MTK_TVOUT_SUPPORT)
        } else if (0 == strncmp(opt + 4, "tvc", 3)) {
            TVC_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "tve", 3)) {
            TVE_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "tvr", 3)) {
            TVR_DumpRegisters();
#endif		
        } else {
            goto Error;
        }
    }

#if defined(MTK_TVOUT_SUPPORT)
    else if (0 == strncmp(opt, "tv:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            TVOUT_TvCablePlugIn();
        } else if (0 == strncmp(opt +3, "off", 3)) {
            TVOUT_TvCablePlugOut();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvforce:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2)) {
            TVOUT_TvCablePlugIn_Directly();
        } else if (0 == strncmp(opt +8, "off", 3)) {
            TVOUT_TvCablePlugOut_Directly();
        } else {
            goto Error;
        }
    }
	else if (0 == strncmp(opt, "tvsys:", 6))
    {
        if (0 == strncmp(opt + 6, "ntsc", 4)) {
            TVOUT_SetTvSystem(TVOUT_SYSTEM_NTSC);
        } else if (0 == strncmp(opt + 6, "pal", 3)) {
            TVOUT_SetTvSystem(TVOUT_SYSTEM_PAL);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvrot:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_SetOrientation(TVOUT_ROT_270);
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_SetOrientation(TVOUT_ROT_0);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcb:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            TVOUT_EnableColorBar(TRUE);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            TVOUT_EnableColorBar(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvvm:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            TVOUT_DisableVideoMode(false);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            TVOUT_DisableVideoMode(true);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvlog:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_EnableLog(true);
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_EnableLog(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvtime:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            TVOUT_EnableTimeProfiling(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            TVOUT_EnableTimeProfiling(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcap:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            capture_tv_buffer = true;
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            capture_tv_buffer = false;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcam:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_ForceClose();
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_RestoreOpen();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvuser:"******"on", 2)) {
            TVOUT_TurnOn(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            TVOUT_TurnOn(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcoffset:", 10))
    {
        char *p = (char *)opt + 10;
        unsigned long offset = simple_strtoul(p, &p, 10);
        TVC_SetCheckLineOffset(offset);
    }
#endif
    else if (0 == strncmp(opt, "regw:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned long addr = simple_strtoul(p, &p, 16);
        unsigned long val  = simple_strtoul(p + 1, &p, 16);

        if (addr) {
            OUTREG32(addr, val);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "regr:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);

        if (addr) {
            DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "Read register 0x%08x: 0x%08x\n", addr, INREG32(addr));
        } else {
            goto Error;
        }
    }
	else if(0 == strncmp(opt, "bkl:", 4))
	{
		char *p = (char *)opt + 4;
		unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "process_dbg_opt(), set backlight level = %d\n", level);
		DISP_SetBacklight(level);
	}
	else if(0 == strncmp(opt, "dither:", 7))
	{
		unsigned lrs, lgs, lbs, dbr, dbg, dbb;
		char *p = (char *)opt + 7;
		lrs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		lgs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		lbs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbr = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbg = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbb = (unsigned int) simple_strtoul(p, &p, 16);

		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "process_dbg_opt(), %d %d %d %d %d %d\n", lrs, lgs, lbs, dbr, dbg, dbb);
#if 0 //defined(CONFIG_ARCH_MT6573)
		LCD_WaitForNotBusy();
		LCD_ConfigDither(lrs, lgs, lbs, dbr, dbg, dbb);
		LCD_StartTransfer(true);
#endif
	}
    else if (0 == strncmp(opt, "mtkfblog:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2)) {
            mtkfb_log_enable(true);
        } else if (0 == strncmp(opt + 9, "off", 3)) {
            mtkfb_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "displog:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2)) {
            disp_log_enable(true);
        } else if (0 == strncmp(opt + 8, "off", 3)) {
            disp_log_enable(false);
        } else {
            goto Error;
        }
    }

    else if (0 == strncmp(opt, "lcdlog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            dbi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            dbi_log_enable(false);
        } else {
            goto Error;
        }
    }

	else if (0 == strncmp(opt, "dsilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            DSI_Enable_Log(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            DSI_Enable_Log(false);
        } else {
            goto Error;
        }
    }

	else if (0 == strncmp(opt, "glitchlog:", 10))
    {
        if (0 == strncmp(opt + 10, "on", 2)) {
            Glitch_Enable_Log(true);
        } else if (0 == strncmp(opt + 10, "off", 3)) {
            Glitch_Enable_Log(false);
        } else {
            goto Error;
        }
    }
	
	else if(0 == strncmp(opt, "glitch_times:", 13))
	{
		char *p = (char *)opt + 13;
		unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);
		Glitch_times(level);
	}
	else if (0 == strncmp(opt, "mtkfb_vsynclog:", 15))
    {
        if (0 == strncmp(opt + 15, "on", 2)) {
            mtkfb_vsync_log_enable(true);
        } else if (0 == strncmp(opt + 15, "off", 3)) {
            mtkfb_vsync_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            //dpi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            //dpi_log_enable(false);
        } else {
            goto Error;
        }
    }

    else if (0 == strncmp(opt, "log:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
			mtkfb_log_enable(true);
			disp_log_enable(true);

			dbi_log_enable(true);

            //dpi_log_enable(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_log_enable(false);
			disp_log_enable(false);

			dbi_log_enable(false);

			//dpi_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "update", 6))
    {
		DISP_UpdateScreen(0, 0, DISP_GetScreenWidth(), DISP_GetScreenHeight());
    }
    else if (0 == strncmp(opt, "pan_disp", 8))
    {
		mtkfb_pan_disp_test();
    }
    else if (0 == strncmp(opt, "sem_cnt", 7))
    {
		mtkfb_show_sem_cnt();
		LCD_GetVsyncCnt();
    }
    else if (0 == strncmp(opt, "hang:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            mtkfb_hang_test(true);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            mtkfb_hang_test(false);
        } else{
            goto Error;
        }
	}
 #if defined(MTK_M4U_SUPPORT)
    else if (0 == strncmp(opt, "m4u:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            mtkfb_m4u_switch(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_m4u_switch(false);
        } else if (0 == strncmp(opt + 4, "dump", 4)) {
            mtkfb_m4u_dump();
        } else{
            goto Error;
        }
	}
#endif
    else if (0 == strncmp(opt, "cpfbonly:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            mtkfb_capture_fb_only(true);
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            mtkfb_capture_fb_only(false);
        }
    }
    else if (0 == strncmp(opt, "esd:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2))
        {
            esd_recovery_pause(FALSE);
        }
        else if (0 == strncmp(opt + 4, "off", 3))
        {
            esd_recovery_pause(TRUE);
        }
    }
    else if (0 == strncmp(opt, "HQA:", 4))
    {
        if (0 == strncmp(opt + 4, "NormalToFactory", 15))
        {
            mtkfb_switch_normal_to_factory();
        }
        else if (0 == strncmp(opt + 4, "FactoryToNormal", 15))
        {
            mtkfb_switch_factory_to_normal();
        }
    }
    else if (0 == strncmp(opt, "mmp", 3))
    {
        init_mtkfb_mmp_events();
    }
    else if (0 == strncmp(opt, "dump_layer:", 11))
    {
        if (0 == strncmp(opt + 11, "on", 2))
        {
            char *p = (char *)opt + 14;
            gCaptureLayerDownX = simple_strtoul(p, &p, 10);
            gCaptureLayerDownY = simple_strtoul(p+1, &p, 10);
            gCaptureLayerEnable = 1;
        }
        else if (0 == strncmp(opt + 11, "off", 3))
        {
            gCaptureLayerEnable = 0;
        }
    }
    else if (0 == strncmp(opt, "dump_ovl:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            char *p = (char *)opt + 12;
            gCaptureOvlDownX = simple_strtoul(p, &p, 10);
            gCaptureOvlDownY = simple_strtoul(p+1, &p, 10);
            gCaptureOvlThreadEnable = 1;
			wake_up_process(captureovl_task);
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            gCaptureOvlThreadEnable = 0;
        }
    }
    else if (0 == strncmp(opt, "dump_fb:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2))
        {
            char *p = (char *)opt + 11;
            gCaptureFBDownX = simple_strtoul(p, &p, 10);
            gCaptureFBDownY = simple_strtoul(p+1, &p, 10);
            gCaptureFBPeriod = simple_strtoul(p+1, &p, 10);
            gCaptureFBEnable = 1;
			wake_up_interruptible(&gCaptureFBWQ);
        }
        else if (0 == strncmp(opt + 8, "off", 3))
        {
            gCaptureFBEnable = 0;
        }   
    }
    else
	{
		goto Error;
	}

    return;

Error:
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "ERROR", "parse command error!\n\n%s", STR_HELP);
}
Ejemplo n.º 17
0
DISP_STATUS DISP_PanelEnable(BOOL enable)
{
	static BOOL s_enabled = TRUE;
	DISP_STATUS ret = DISP_STATUS_OK;

	DISP_LOG("panel is %s\n", enable?"enabled":"disabled");

	if (down_interruptible(&sem_update_screen)) {
		DISP_LOG("ERROR: Can't get sem_update_screen in DISP_PanelEnable()\n");
		return DISP_STATUS_ERROR;
	}

	disp_drv_init_context();

	is_lcm_in_suspend_mode = enable ? FALSE : TRUE;

	if (!lcm_drv->suspend || !lcm_drv->resume) {
		ret = DISP_STATUS_NOT_IMPLEMENTED;
		goto End;
	}

	if (enable && !s_enabled) {
		s_enabled = TRUE;

		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{		
			DSI_SetMode(CMD_MODE);
		}

		lcm_drv->resume();

		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{
			//DSI_clk_HS_mode(1);
			DSI_SetMode(lcm_params->dsi.mode);
			
			//DPI_CHECK_RET(DPI_EnableClk());
			//DSI_CHECK_RET(DSI_EnableClk());

			msleep(200);
		}
	}
	else if (!enable && s_enabled)
	{
		LCD_CHECK_RET(LCD_WaitForNotBusy());
		if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode == CMD_MODE)
			DSI_CHECK_RET(DSI_WaitForNotBusy());
		s_enabled = FALSE;

		if (lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode != CMD_MODE)
		{		
			DPI_CHECK_RET(DPI_DisableClk());
			//msleep(200);
			DSI_Reset();
			DSI_clk_HS_mode(0);
			DSI_SetMode(CMD_MODE);
		}

		lcm_drv->suspend();
	}

End:
	up(&sem_update_screen);

	return ret;
}
Ejemplo n.º 18
0
DPI_STATUS DPI_Capture_Framebuffer(unsigned int pvbuf, unsigned int bpp)
{
#if 0
    unsigned int i = 0;
    unsigned char *fbv;
    unsigned int fbsize = 0;
    unsigned int dpi_fb_bpp = 0;
    unsigned int w,h;
	BOOL dpi_needPowerOff = FALSE;
	if(!s_isDpiPowerOn){
		DPI_PowerOn();
		dpi_needPowerOff = TRUE;
		LCD_WaitForNotBusy();
	    LCD_WaitDPIIndication(FALSE);
		LCD_FBReset();
    	LCD_StartTransfer(TRUE);
		LCD_WaitDPIIndication(TRUE);
	}

    if(pvbuf == 0 || bpp == 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_ERROR, "DPI", "DPI_Capture_Framebuffer, ERROR, parameters wrong: pvbuf=0x%08x, bpp=%d\n", pvbuf, bpp);
        return DPI_STATUS_OK;
    }

    if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB565)
    {
        dpi_fb_bpp = 16;
    }
    else if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB888)
    {
        dpi_fb_bpp = 24;
    }
    else
    {
        DISP_LOG_PRINT(ANDROID_LOG_ERROR, "DPI", "DPI_Capture_Framebuffer, ERROR, dpi_fb_bpp is wrong: %d\n", dpi_fb_bpp);
        return DPI_STATUS_OK;
    }

    w = DISP_GetScreenWidth();
    h = DISP_GetScreenHeight();
    fbsize = w*h*dpi_fb_bpp/8;
	if(dpi_needPowerOff)
    	fbv = (unsigned char*)ioremap_cached((unsigned int)DPI_REG->FB[0].ADDR, fbsize);
	else
    	fbv = (unsigned char*)ioremap_cached((unsigned int)DPI_REG->FB[DPI_GetCurrentFB()].ADDR, fbsize);
 
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "current fb count is %d\n", DPI_GetCurrentFB());

    if(bpp == 32 && dpi_fb_bpp == 24)
    {			
    	if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned int*)(pvbuf+ (pix_count - i) * 4) = 0xff000000|fbv[i*3]|(fbv[i*3+1]<<8)|(fbv[i*3+2]<<16);
    		}
		}
		else{
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned int*)(pvbuf+i*4) = 0xff000000|fbv[i*3]|(fbv[i*3+1]<<8)|(fbv[i*3+2]<<16);
    		}
		}
    }
    else if(bpp == 32 && dpi_fb_bpp == 16)
    {
        unsigned int t;
		unsigned short* fbvt = (unsigned short*)fbv;
    	
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
			
    		for(i = 0;i < w*h; i++)
    		{
				t = fbvt[i];
            	*(unsigned int*)(pvbuf+ (pix_count - i) * 4) = 0xff000000|((t&0x001F)<<3)|((t&0x07E0)<<5)|((t&0xF800)<<8);
    		}
		}
		else{
        	for(i = 0;i < w*h; i++)
    		{
	    		t = fbvt[i];
            	*(unsigned int*)(pvbuf+i*4) = 0xff000000|((t&0x001F)<<3)|((t&0x07E0)<<5)|((t&0xF800)<<8);
    		}
		}
    }
    else if(bpp == 16 && dpi_fb_bpp == 16)
    {
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
			unsigned short* fbvt = (unsigned short*)fbv;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned short*)(pvbuf+ (pix_count - i) * 2) = fbvt[i];
    		}
		}
		else
    		memcpy((void*)pvbuf, (void*)fbv, fbsize);
    }
    else if(bpp == 16 && dpi_fb_bpp == 24)
    {
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned short*)(pvbuf+ (pix_count - i) * 2) = ((fbv[i*3+0]&0xF8)>>3)|
	            	                        				((fbv[i*3+1]&0xFC)<<3)|
														    ((fbv[i*3+2]&0xF8)<<8);
    		}
		}
		else{
    		for(i = 0;i < w*h; i++)
Ejemplo n.º 19
0
void mt65xx_disp_wait_idle(void)
{
    LCD_CHECK_RET(LCD_WaitForNotBusy());
}
Ejemplo n.º 20
0
/* Will only be used in ioctl(MTK_HDMI_AUDIO_VIDEO_ENABLE) */
static HDMI_STATUS hdmi_drv_init(void)
{
    int lcm_width, lcm_height;
    int tmpBufferSize;
		M4U_PORT_STRUCT portStruct;

    HDMI_FUNC();

    RETIF(p->output_mode == HDMI_OUTPUT_MODE_DPI_BYPASS, 0);

    p->hdmi_width = 1280;
    p->hdmi_height = 720;

    lcm_width = DISP_GetScreenWidth();
    lcm_height = DISP_GetScreenHeight();

    //printk("[hdmi]%s, hdmi_width=%d, hdmi_height=%d\n", __func__, p->hdmi_width, p->hdmi_height);
    HDMI_LOG("lcm_width=%d, lcm_height=%d\n", lcm_width, lcm_height);

    tmpBufferSize = lcm_width * lcm_height *4 * 4;

    temp_va = (unsigned int) vmalloc(tmpBufferSize);
    if (((void*) temp_va) == NULL)
    {
        HDMI_LOG("vmalloc %dbytes fail\n", tmpBufferSize);
        return -1;
    }

    // WDMA1
    if (m4u_alloc_mva(M4U_CLNTMOD_WDMA, 
						temp_va, 
						tmpBufferSize,
						0,
						0,
						&temp_mva_w))
    {
        HDMI_LOG("m4u_alloc_mva for temp_mva_w fail\n");
        return -1;
    }
		m4u_dma_cache_maint(M4U_CLNTMOD_WDMA, 
						temp_va, 
						tmpBufferSize,
						DMA_BIDIRECTIONAL);

	portStruct.ePortID = M4U_PORT_WDMA1;			 //hardware port ID, defined in M4U_PORT_ID_ENUM
	portStruct.Virtuality = 1;							 
	portStruct.Security = 0;
	portStruct.domain = 0;						//domain : 0 1 2 3
	portStruct.Distance = 1;
	portStruct.Direction = 0; 	
	m4u_config_port(&portStruct);

    HDMI_LOG("temp_va=0x%08x, temp_mva_w=0x%08x\n", temp_va, temp_mva_w);

    p->lcm_width = lcm_width;
    p->lcm_height = lcm_height;
    p->output_video_resolution = hdmi_params->init_config.vformat;
    p->output_audio_format = hdmi_params->init_config.aformat;

//#ifdef NEW_HDMI_ARCH
//    hdmi_display_path_overlay_config(true);
//#endif
	DISP_Config_Overlay_to_Memory(temp_mva_w, 1);

    //hdmi_dpi_config_clock(); // configure dpi clock

    //hdmi_dpi_power_switch(false);   // but dpi power is still off
    //hdmi_drv->suspend();

#if 0
    LCD_WaitForNotBusy();
    LCD_SetOutputMode(3); // LCD write to memory and LCM
#endif

    return HDMI_STATUS_OK;
}