Ejemplo n.º 1
0
DAL_STATUS DAL_Printf(const char *fmt, ...)
{
    va_list args;
    uint i;
    char printbuffer[1024] = "";

    if (NULL == mfc_handle)
        return DAL_STATUS_NOT_READY;

    if (NULL == fmt)
        return DAL_STATUS_INVALID_ARGUMENT;

    DAL_LOCK();

    va_start (args, fmt);
    i = vsprintf(printbuffer, fmt, args);
    va_end (args);

    MFC_CHECK_RET(MFC_Print(mfc_handle, printbuffer));

    if (!dal_shown) {
        LCD_CHECK_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE));
        dal_shown = TRUE;
    }

    flush_cache_all();

    DISP_CHECK_RET(DISP_UpdateScreen(0, 0,
                                     DAL_WIDTH,
                                     DAL_HEIGHT));

    DAL_UNLOCK();

    return DAL_STATUS_OK;
}
Ejemplo n.º 2
0
void mt_disp_update(UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{
    if(fb_isdirty)
    {
        fb_isdirty = 0;
		disp_regupdate_interrupt_clean();
        LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER - 1, (UINT32)fb_addr + fb_offset_logo * fb_size));
        printk("[wwy] hardware address = %x, fb_offset_logo = %d\n",(UINT32)fb_addr + fb_offset_logo * fb_size,fb_offset_logo);
        DISP_CHECK_RET(DISP_UpdateScreen(x, y, width, height));
        //wait reg update to set fb_offset_logo
        DISP_WaitRegUpdate();
        fb_offset_logo = fb_offset_logo ? 0 : 3;
    }
    else
    {
    DISP_CHECK_RET(DISP_UpdateScreen(x, y, width, height));
    }
}
Ejemplo n.º 3
0
void mt_disp_update(UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{
    if(fb_isdirty)
    {
        fb_isdirty = 0;
        MASKREG32(DISP_REG_CONFIG_MUTEX_INTEN, 0x1, 0x1); //Enable DISP MUTEX0
        MASKREG32(DISP_REG_CONFIG_MUTEX_INTSTA, 0x1, 0x0);
        LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER - 1, (UINT32)fb_addr + fb_offset_logo * fb_size));
        printf("[wwy] hardware address = %x, fb_offset_logo = %d\n",(UINT32)fb_addr + fb_offset_logo * fb_size,fb_offset_logo);
        DISP_CHECK_RET(DISP_UpdateScreen(x, y, width, height));
        //wait reg update to set fb_offset_logo
        DISP_WaitRegUpdate();
        fb_offset_logo = fb_offset_logo ? 0 : 3;

    }
    else
    {
        DISP_CHECK_RET(DISP_UpdateScreen(x, y, width, height));
    }
}
DAL_STATUS DAL_Clean(void)
{
	DAL_STATUS ret = DAL_STATUS_OK;

	static int dal_clean_cnt;
	MFC_CONTEXT *ctxt = (MFC_CONTEXT *) mfc_handle;
	DISP_DRV_MSG("[MTKFB_DAL] DAL_Clean\n");
	if (NULL == mfc_handle)
		return DAL_STATUS_NOT_READY;

/* if (LCD_STATE_POWER_OFF == LCD_GetState()) */
/* return DAL_STATUS_LCD_IN_SUSPEND; */

	DAL_LOCK();

	DAL_CHECK_MFC_RET(MFC_ResetCursor(mfc_handle));

	ctxt->screen_color = 0;
	DAL_SetScreenColor(DAL_COLOR_RED);

	/* TODO: if dal_shown=false, and 3D enabled, mtkfb may disable UI layer, please modify 3D driver */
	if (isAEEEnabled == 1) {
		/* DAL disable, switch UI layer to default layer 3 */
		DISP_DRV_MSG("[DDP]* isAEEEnabled from 1 to 0, %d\n", dal_clean_cnt++);
		isAEEEnabled = 0;
		DAL_Dynamic_Change_FB_Layer(isAEEEnabled);	/* restore UI layer to DEFAULT_UI_LAYER */
	}

	dal_shown = FALSE;
#ifdef DAL_LOWMEMORY_ASSERT
	if (dal_lowMemory_shown) {	/* only need show lowmemory assert */
		UINT32 LOWMEMORY_FG_COLOR =
		    MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_FG_COLOR, DAL_LOWMEMORY_FG_COLOR);
		UINT32 LOWMEMORY_BG_COLOR =
		    MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_BG_COLOR, DAL_LOWMEMORY_BG_COLOR);

		DAL_CHECK_MFC_RET(MFC_LowMemory_Printf
				  (mfc_handle, low_memory_msg, LOWMEMORY_FG_COLOR,
				   LOWMEMORY_BG_COLOR));
		Show_LowMemory();
	}
	dal_enable_when_resume_lowmemory = FALSE;
	dal_disable_when_resume_lowmemory = FALSE;
#endif
	dal_disable_when_resume = FALSE;
	DAL_UpdateScreen(FALSE, FALSE, 0, 0);
	DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT));

	DAL_UNLOCK();
	return ret;
}
Ejemplo n.º 5
0
DAL_STATUS DAL_Printf(const char *fmt, ...)
{
	va_list args;
	uint i;
    DAL_STATUS ret = DAL_STATUS_OK;

    if (NULL == mfc_handle) 
        return DAL_STATUS_NOT_READY;

    if (NULL == fmt)
        return DAL_STATUS_INVALID_ARGUMENT;

    DAL_LOCK();

	va_start (args, fmt);
	i = vsprintf(dal_print_buffer, fmt, args);
        BUG_ON(i>=ARRAY_SIZE(dal_print_buffer));
	va_end (args);

    DAL_CHECK_MFC_RET(MFC_Print(mfc_handle, dal_print_buffer));

    flush_cache_all();

    if (LCD_STATE_POWER_OFF == LCD_GetState()) {
        ret = DAL_STATUS_LCD_IN_SUSPEND;
        dal_enable_when_resume = TRUE;
        goto End;
    }

    if (!dal_shown) {
		DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER,0,0));
		DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0));
   		DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER,
                                       DAL_WIDTH,
                                       DAL_HEIGHT));
        DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE));
        dal_shown = TRUE;
    }

    DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, 
                                         DAL_WIDTH,
                                         DAL_HEIGHT));
End:
    DAL_UNLOCK();

    return ret;
}
Ejemplo n.º 6
0
DAL_STATUS DAL_Printf(const char *fmt, ...)
{
    va_list args;
    uint i;
    DAL_STATUS ret = DAL_STATUS_OK;
    printk("%s", __func__);
    //printk("[MTKFB_DAL] DAL_Printf mfc_handle=0x%08X, fmt=0x%08X\n", mfc_handle, fmt);
    if (NULL == mfc_handle)
        return DAL_STATUS_NOT_READY;

    if (NULL == fmt)
        return DAL_STATUS_INVALID_ARGUMENT;

    DAL_LOCK();
    if(isAEEEnabled==0)
    {
        printk("[DDP] isAEEEnabled from 0 to 1, ASSERT_LAYER=%d, dal_fb_pa %x\n",
               ASSERT_LAYER, dal_fb_pa);

        isAEEEnabled = 1;
        DAL_Dynamic_Change_FB_Layer(isAEEEnabled); // default_ui_ layer coniig to changed_ui_layer

        DAL_CHECK_MFC_RET(MFC_Open_Ex(&mfc_handle, dal_fb_addr,
                                      DAL_WIDTH, DAL_HEIGHT,DAL_PITCH, DAL_BPP,
                                      DAL_FG_COLOR, DAL_BG_COLOR));
    }
    va_start (args, fmt);
    i = vsprintf(dal_print_buffer, fmt, args);
    BUG_ON(i>=ARRAY_SIZE(dal_print_buffer));
    va_end (args);
    DAL_CHECK_MFC_RET(MFC_Print(mfc_handle, dal_print_buffer));

    flush_cache_all();

    if (!dal_shown) {
        dal_shown = TRUE;
    }
    DAL_UpdateScreen(TRUE, TRUE, DAL_WIDTH, DAL_HEIGHT);
    DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, DAL_WIDTH, DAL_HEIGHT));

    DAL_UNLOCK();
    return ret;
}
Ejemplo n.º 7
0
void mt65xx_disp_update(UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{
    DISP_CHECK_RET(DISP_UpdateScreen(x, y, width, height));
}
DAL_STATUS DAL_Printf(const char *fmt, ...)
{
	va_list args;
	uint i;
    DAL_STATUS ret = DAL_STATUS_OK;
    //printk("[MTKFB_DAL] DAL_Printf mfc_handle=0x%08X, fmt=0x%08X\n", mfc_handle, fmt);
    if (NULL == mfc_handle) 
        return DAL_STATUS_NOT_READY;

    if (NULL == fmt)
        return DAL_STATUS_INVALID_ARGUMENT;

    DAL_LOCK();

	va_start (args, fmt);
	i = vsprintf(dal_print_buffer, fmt, args);
        BUG_ON(i>=ARRAY_SIZE(dal_print_buffer));
	va_end (args);

    DAL_CHECK_MFC_RET(MFC_Print(mfc_handle, dal_print_buffer));

    flush_cache_all();
/*
    if (LCD_STATE_POWER_OFF == LCD_GetState()) {
        ret = DAL_STATUS_LCD_IN_SUSPEND;
        dal_enable_when_resume = TRUE;
        goto End;
    }
    */
    if (down_interruptible(&sem_early_suspend)) {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "can't get semaphore in DAL_Printf()\n");
        goto End;
    }

#if 0
	if(is_early_suspended){
		up(&sem_early_suspend);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "DAL_Printf in power off\n");
		goto End;
	}
#endif
    up(&sem_early_suspend);

    mutex_lock(&OverlaySettingMutex);

    if (!dal_shown) {
        dal_shown = TRUE;
    }

    //DAL enable, switch ui layer from default 3 to 2
    if(isAEEEnabled==0)
    {
        printk("[DDP] isAEEEnabled from 0 to 1, ASSERT_LAYER=%d, dal_fb_pa %x\n", 
            ASSERT_LAYER, dal_fb_pa);
            
        isAEEEnabled = 1;
        DAL_CHECK_LCD_RET(LCD_Dynamic_Change_FB_Layer(isAEEEnabled)); // default_ui_ layer coniig to changed_ui_layer
        
        DAL_CHECK_MFC_RET(MFC_Open(&mfc_handle, dal_fb_addr,
                                   DAL_WIDTH, DAL_HEIGHT, DAL_BPP,
                                   DAL_FG_COLOR, DAL_BG_COLOR));        
        //DAL_Clean();        
        DAL_CHECK_LCD_RET(LCD_LayerSetAddress(ASSERT_LAYER, dal_fb_pa));
        DAL_CHECK_LCD_RET(LCD_LayerSetAlphaBlending(ASSERT_LAYER, TRUE, 0x80));
        DAL_CHECK_LCD_RET(LCD_LayerSetPitch(ASSERT_LAYER, DAL_WIDTH * DAL_BPP));  
		cached_layer_config[ASSERT_LAYER].fmt= DAL_FORMAT;
		cached_layer_config[ASSERT_LAYER].src_x = 0;
		cached_layer_config[ASSERT_LAYER].src_y = 0;
		cached_layer_config[ASSERT_LAYER].src_w = DAL_WIDTH;
		cached_layer_config[ASSERT_LAYER].src_h = DAL_HEIGHT;
		cached_layer_config[ASSERT_LAYER].dst_x = 0;
		cached_layer_config[ASSERT_LAYER].dst_y = 0;
		cached_layer_config[ASSERT_LAYER].dst_w = DAL_WIDTH;
		cached_layer_config[ASSERT_LAYER].dst_h = DAL_HEIGHT;
        DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE));

        printk("after AEE config LCD layer 3: \n");
        LCD_Dump_Layer_Info();
    }
    atomic_set(&OverlaySettingDirtyFlag, 1);
    atomic_set(&OverlaySettingApplied, 0);
    mutex_unlock(&OverlaySettingMutex);

    DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, 
                                         DAL_WIDTH,
                                         DAL_HEIGHT));
End:
    DAL_UNLOCK();

    return ret;
}
DAL_STATUS DAL_Clean(void)
{
    const UINT32 BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_BG_COLOR, DAL_BG_COLOR);
    DAL_STATUS ret = DAL_STATUS_OK;
    UINT32 i, *ptr;
    static int dal_clean_cnt = 0;
    
    printk("[MTKFB_DAL] DAL_Clean\n");
    if (NULL == mfc_handle) 
        return DAL_STATUS_NOT_READY;

//    if (LCD_STATE_POWER_OFF == LCD_GetState())
//        return DAL_STATUS_LCD_IN_SUSPEND;

    DAL_LOCK();

    DAL_CHECK_MFC_RET(MFC_ResetCursor(mfc_handle));
 
    ptr = (UINT32 *)dal_fb_addr;
   	for(i = 0; i < DAL_GetLayerSize() / sizeof(UINT32); ++ i) {
       	*ptr ++ = BG_COLOR;
   	}
/*
    if (LCD_STATE_POWER_OFF == LCD_GetState()) {
	    DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "dal_clean in power off\n");
        dal_disable_when_resume = TRUE;
        ret = DAL_STATUS_LCD_IN_SUSPEND;
        goto End;
    }
    */
    if (down_interruptible(&sem_early_suspend)) {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "can't get semaphore in DAL_Clean()\n");
        goto End;
    }
		//xuecheng, for debug
#if 0
	if(is_early_suspended){
		up(&sem_early_suspend);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "dal_clean in power off\n");
		goto End;
	}
	#endif
    up(&sem_early_suspend);

    mutex_lock(&OverlaySettingMutex);

    //TODO: if dal_shown=false, and 3D enabled, mtkfb may disable UI layer, please modify 3D driver
    if(isAEEEnabled==1)
    {
        DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE));
        
        // DAL disable, switch UI layer to default layer 3
        printk("[DDP]* isAEEEnabled from 1 to 0, %d \n", dal_clean_cnt++);
        isAEEEnabled = 0;
        DAL_CHECK_LCD_RET(LCD_Dynamic_Change_FB_Layer(isAEEEnabled));  // restore UI layer to DEFAULT_UI_LAYER
    }
    
    dal_shown = FALSE;
#ifdef DAL_LOWMEMORY_ASSERT
   	if (dal_lowMemory_shown) {//only need show lowmemory assert
		UINT32 LOWMEMORY_FG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_FG_COLOR, DAL_LOWMEMORY_FG_COLOR);
		UINT32 LOWMEMORY_BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_LOWMEMORY_BG_COLOR, DAL_LOWMEMORY_BG_COLOR);

		DAL_CHECK_MFC_RET(MFC_LowMemory_Printf(mfc_handle, low_memory_msg, LOWMEMORY_FG_COLOR, LOWMEMORY_BG_COLOR));
		Show_LowMemory();
   	}
	dal_enable_when_resume_lowmemory = FALSE;
	dal_disable_when_resume_lowmemory = FALSE;
#endif
	dal_disable_when_resume = FALSE;
    atomic_set(&OverlaySettingDirtyFlag, 1);
    atomic_set(&OverlaySettingApplied, 0);
    mutex_unlock(&OverlaySettingMutex);

    
    DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, 
                                         DAL_WIDTH,
                                         DAL_HEIGHT));
                                         
	
End:
	DAL_UNLOCK();
    return ret;
}
Ejemplo n.º 10
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);
}
static void process_dbg_opt(const char *opt)
{
    if (0 == strncmp(opt, "stop_trigger_loop", 17))
	{
		_cmdq_stop_trigger_loop();
		return;
	}
	else if (0 == strncmp(opt, "start_trigger_loop", 18))
	{
		_cmdq_start_trigger_loop();
		return;
	}	
	else if (0 == strncmp(opt, "cmdqregw:", 9))
    {
        char *p = (char *)opt + 9;
        unsigned int addr = simple_strtoul(p, &p, 16);
        unsigned int val  = simple_strtoul(p + 1, &p, 16);

        if (addr) {
            primary_display_cmdq_set_reg(addr, val);
        } else {
            return;
        }
    }	
	else if (0 == strncmp(opt, "idle_switch_DC", 14))
    {
        if (0 == strncmp(opt + 14, "on", 2))
        {  
			enable_screen_idle_switch_decouple();
            printk("enable screen_idle_switch_decouple\n");
        }
        else if (0 == strncmp(opt + 14, "off", 3))
		{
			disable_screen_idle_switch_decouple();
			printk("disable screen_idle_switch_decouple\n");
        }
	}
	else if (0 == strncmp(opt, "shortpath", 9))
	{
		char *p = (char *)opt + 10;
		int s = simple_strtoul(p, &p, 10);
		DISPMSG("will %s use shorter decouple path\n", s?"":"not");
		disp_helper_set_option(DISP_HELPER_OPTION_TWO_PIPE_INTERFACE_PATH, s);
	}
	else if (0 == strncmp(opt, "helper", 6))
	{
		char *p = (char *)opt + 7;
		int option = simple_strtoul(p, &p, 10);
		int value = simple_strtoul(p + 1, &p, 10);
		DISPMSG("will set option %d to %d\n", option, value);
		disp_helper_set_option(option, value);
	}
	else if (0 == strncmp(opt, "dc565", 5))
	{
		char *p = (char *)opt + 6;
		int s = simple_strtoul(p, &p, 10);
		DISPMSG("will %s use RGB565 decouple path\n", s?"":"not");
		disp_helper_set_option(DISP_HELPER_OPTION_DECOUPLE_MODE_USE_RGB565, s);
	}
	else if (0 == strncmp(opt, "switch_mode:", 12))
	{
		int session_id = MAKE_DISP_SESSION(DISP_SESSION_PRIMARY,0);
		char *p = (char *)opt + 12;
        unsigned long sess_mode = simple_strtoul(p, &p, 10);
		primary_display_switch_mode(sess_mode, session_id, 1);
	}
	else if (0 == strncmp(opt, "dsipattern", 10))
	{
		char *p = (char *)opt + 11;
		unsigned int pattern = (unsigned int) simple_strtoul(p, &p, 16);

		if (pattern) 
		{
			DSI_BIST_Pattern_Test(DISP_MODULE_DSI0,NULL,true,pattern);
			DISPMSG("enable dsi pattern: 0x%08x\n", pattern);
		}
		else 
		{
			primary_display_manual_lock();
			DSI_BIST_Pattern_Test(DISP_MODULE_DSI0,NULL,false,0);
			primary_display_manual_unlock();
			return;
		}
	}
    else if (0 == strncmp(opt, "rdma_color:", 11))
    {
        printk("zeng: rdma_color\n");
        if (0 == strncmp(opt + 11, "on", 2))
        {
            printk("zeng:rdma_color on\n");
            char *p = (char *)opt + 14;
            unsigned int red = simple_strtoul(p, &p, 10);
            unsigned int green = simple_strtoul(p + 1, &p, 10);
            unsigned int blue = simple_strtoul(p + 1, &p, 10);
            rdma_color_matrix matrix = {0};
            rdma_color_pre pre = {0};
            rdma_color_post post = {255, 0, 0};
            post.ADD0 = red;
            post.ADD1 = green;
            post.ADD2 = blue;
            rdma_set_color_matrix(DISP_MODULE_RDMA0, &matrix, &pre, &post);
            rdma_enable_color_transform(DISP_MODULE_RDMA0);
        }
        else if (0 == strncmp(opt + 11, "off", 3))
        {
            printk("zeng:rdma_color off\n");
            rdma_disable_color_transform(DISP_MODULE_RDMA0);
        }
    } 
	else if (0 == strncmp(opt, "diagnose", 8))
	{
		primary_display_diagnose();
		return;
	}
    else if (0 == strncmp(opt, "_efuse_test", 11))
	{
		primary_display_check_test();
	}
	else if (0 == strncmp(opt, "dprec_reset", 11))
	{
		dprec_logger_reset_all();
		return;
	}
	else if (0 == strncmp(opt, "suspend", 4))
    {
    	primary_display_suspend();
		return;
    }
    else if (0 == strncmp(opt, "ata",3))
    {
    	mtkfb_fm_auto_test();
		return;
    }
    else if (0 == strncmp(opt, "resume", 4))
    {
    		primary_display_resume();
    }
    else if (0 == strncmp(opt, "dalprintf", 9))
    {
    		DAL_Printf("display aee layer test\n");
    }
    else if (0 == strncmp(opt, "dalclean", 8))
    {
    		DAL_Clean();
    }
    else if(0 == strncmp(opt, "lfr_setting:",12))
	{
		char *p = (char *)opt + 12;
        unsigned int enable = (unsigned int) simple_strtoul(p, &p, 12);
        unsigned int mode =  (unsigned int)simple_strtoul(p+1, &p, 12);
		LCM_PARAMS lcm_param;
		//unsigned int  mode=3;
		unsigned int  type=0;
		unsigned int  skip_num = 1;
		printk("--------------enable/disable lfr--------------\n");
        if (enable)
        {
            printk("lfr enable %d mode =%d\n",enable,mode);
			enable=1;
			DSI_Set_LFR(DISP_MODULE_DSI0, NULL,mode,type,enable,skip_num);
        }else{
			printk("lfr disable %d mode=%d\n",enable,mode);
			enable=0;
			DSI_Set_LFR(DISP_MODULE_DSI0, NULL,mode,type,enable,skip_num);
        }
	}
	else if(0 == strncmp(opt, "vsync_switch:",13))
	{
		char *p = (char *)opt + 13;
        unsigned int method = 0;
		method =(unsigned int) simple_strtoul(p, &p, 13);
		primary_display_vsync_switch(method);

	}
	else if (0 == strncmp(opt, "DP", 2))
	{
		char *p = (char *)opt + 3;
		unsigned int pattern = (unsigned int) simple_strtoul(p, &p, 16);
		g_display_debug_pattern_index = pattern;
		return;
	}
	else if(0==strncmp(opt,"dsi0_clk:",9))
   	{
        char*p=(char*)opt+9;
        UINT32 clk=simple_strtoul(p, &p, 10);
//        DSI_ChangeClk(DISP_MODULE_DSI0,clk);
    }
    else if (0 == strncmp(opt, "diagnose", 8))
    {
    	primary_display_diagnose();
		return;
    }
		else if (0 == strncmp(opt, "switch:", 7))
    	{
        	char*p=(char*)opt+7;
        	UINT32 mode=simple_strtoul(p, &p, 10);
    		primary_display_switch_dst_mode(mode%2);
			return;
    	}

	    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 {
            return;
        }
    }
    else if (0 == strncmp(opt, "regr:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned long addr = (unsigned int) simple_strtoul(p, &p, 16);

        if (addr) {
            printk("Read register 0x%lx: 0x%08x\n", addr, INREG32(addr));
        } else {
           return;
        }
    }
    else if (0 == strncmp(opt, "cmmva_dprec", 11))
    {
		dprec_handle_option(0x7);
	}
    else if (0 == strncmp(opt, "cmmpa_dprec", 11))
    {
		dprec_handle_option(0x3);
	}
    else if (0 == strncmp(opt, "dprec", 5))
    {
		char *p = (char *)opt + 6;
		unsigned int option = (unsigned int) simple_strtoul(p, &p, 16);
		dprec_handle_option(option);
	}
    else if (0 == strncmp(opt, "cmdq", 4))
    {
		char *p = (char *)opt + 5;
		unsigned int option = (unsigned int) simple_strtoul(p, &p, 16);
		if(option)
			primary_display_switch_cmdq_cpu(CMDQ_ENABLE);
		else
			primary_display_switch_cmdq_cpu(CMDQ_DISABLE);
	}
    else if (0 == strncmp(opt, "maxlayer", 8))
    {
		char *p = (char *)opt + 9;
		unsigned int maxlayer = (unsigned int) simple_strtoul(p, &p, 10);
		if(maxlayer)
			primary_display_set_max_layer(maxlayer);
		else
			DISPERR("can't set max layer to 0\n");
	}
    else if (0 == strncmp(opt, "primary_reset", 13))
    {
		primary_display_reset();
	}
	else if(0 == strncmp(opt, "esd_check", 9))
	{
		char *p = (char *)opt + 10;
		unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
		primary_display_esd_check_enable(enable);
	}
	else if(0 == strncmp(opt, "esd_recovery", 12))
	{
		primary_display_esd_recovery();
	}
	else if(0 == strncmp(opt, "lcm0_reset", 10))
	{
	#if 1
	    DISP_CPU_REG_SET(DISPSYS_CONFIG_BASE+0x150, 1);
	    msleep(10);
	    DISP_CPU_REG_SET(DISPSYS_CONFIG_BASE+0x150, 0);
	    msleep(10);
	    DISP_CPU_REG_SET(DISPSYS_CONFIG_BASE+0x150, 1);
	#else
    #if 0
		mt_set_gpio_mode(GPIO106|0x80000000, GPIO_MODE_00);
		mt_set_gpio_dir(GPIO106|0x80000000, GPIO_DIR_OUT);
		mt_set_gpio_out(GPIO106|0x80000000, GPIO_OUT_ONE);
		msleep(10);
		mt_set_gpio_out(GPIO106|0x80000000, GPIO_OUT_ZERO);
		msleep(10);
		mt_set_gpio_out(GPIO106|0x80000000, GPIO_OUT_ONE);
    #endif
	#endif
	}
	else if(0 == strncmp(opt, "lcm0_reset0", 11))
	{
		DISP_CPU_REG_SET(DDP_REG_BASE_MMSYS_CONFIG+0x150,0);
	}
	else if(0 == strncmp(opt, "lcm0_reset1", 11))
	{
		DISP_CPU_REG_SET(DDP_REG_BASE_MMSYS_CONFIG+0x150,1);
	}
	else if (0 == strncmp(opt, "cg", 2))
    {
		char *p = (char *)opt + 2;
		unsigned int enable = (unsigned int) simple_strtoul(p, &p, 10);
		primary_display_enable_path_cg(enable);
	}
	else if (0 == strncmp(opt, "ovl2mem:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2))
            switch_ovl1_to_mem(true);
        else
            switch_ovl1_to_mem(false);
    }
	else if (0 == strncmp(opt, "dump_layer:", 11))
    {
        if (0 == strncmp(opt + 11, "on", 2))
        {           
            char *p = (char *)opt + 14;
            gCapturePriLayerDownX = simple_strtoul(p, &p, 10);
            gCapturePriLayerDownY = simple_strtoul(p+1, &p, 10);
			gCapturePriLayerNum= simple_strtoul(p+1, &p, 10);
			gCapturePriLayerEnable = 1;
			gCaptureWdmaLayerEnable = 1;
			if(gCapturePriLayerDownX==0)
				gCapturePriLayerDownX = 20;
			if(gCapturePriLayerDownY==0)
				gCapturePriLayerDownY = 20;
            printk("dump_layer En %d DownX %d DownY %d,Num %d",gCapturePriLayerEnable,gCapturePriLayerDownX,gCapturePriLayerDownY,gCapturePriLayerNum);
            
        }
        else if (0 == strncmp(opt + 11, "off", 3))
        {
            gCapturePriLayerEnable = 0;
            gCaptureWdmaLayerEnable = 0;
			gCapturePriLayerNum = OVL_LAYER_NUM;
			printk("dump_layer En %d\n",gCapturePriLayerEnable);
        }
    }
#ifdef MTK_TODO
#error
    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, "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_layer_info();
    }
    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);
    }
    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, "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, "log:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
			mtkfb_log_enable(true);
			disp_log_enable(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_log_enable(false);
			disp_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();
    }
    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;
        }
    }
    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_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
	{
	    if (disphal_process_dbg_opt(opt))
		goto Error;
	}

    return;

Error:
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "ERROR", "parse command error!\n\n%s", STR_HELP);
#endif
}
Ejemplo n.º 12
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, "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_layer_info();
    }
    else if (0 == strncmp(opt, "fm_test:", 8))
    {
        unsigned int ret = 0;
        char *p = (char *)opt + 8;
        unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);
        color = level;
        ret = mtkfb_fm_auto_test();
        printk("ret = %d, 0x%x\n", ret,color);
    }
    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);
    }
    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, "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, "log:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            mtkfb_log_enable(true);
            disp_log_enable(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_log_enable(false);
            disp_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();
    }
    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;
        }
    }
    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;
            gCaptureLayerRawData = 0;
        }
        else if (0 == strncmp(opt + 11, "raw", 3))
        {
            gCaptureLayerDownX = 1;
            gCaptureLayerDownY = 1;
            gCaptureLayerEnable = 1;
            gCaptureLayerRawData = 1;
        }
        else if (0 == strncmp(opt + 11, "off", 3))
        {
            gCaptureLayerEnable = 0;
            gCaptureLayerRawData = 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);
            gCaptureOvlEnable = 1;
            gCaptureOvlRawData = 0;
        }
        else if (0 == strncmp(opt + 9, "raw", 3))
        {
            gCaptureOvlDownX = 1;
            gCaptureOvlDownY = 1;
            gCaptureOvlEnable = 1;
            gCaptureOvlRawData = 1;
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            gCaptureOvlEnable = 0;
            gCaptureOvlRawData = 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);
            gCaptureFBEnable = 1;
            gCaptureFBRawData = 0;
        }
        else if (0 == strncmp(opt + 8, "raw", 3))
        {
            gCaptureFBDownX = 1;
            gCaptureFBDownY = 1;
            gCaptureFBEnable = 1;
            gCaptureFBRawData = 1;
        }
        else if (0 == strncmp(opt + 8, "off", 3))
        {
            gCaptureFBEnable = 0;
            gCaptureFBRawData = 0;
        }
    }
    else if (0 == strncmp(opt, "decouple:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            struct fb_overlay_mode mode;

            mode.mode = DISP_DECOUPLE_MODE;
            DISP_SwitchDisplayMode(&mode);
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            struct fb_overlay_mode mode;

            mode.mode = DISP_DIRECT_LINK_MODE;
            DISP_SwitchDisplayMode(&mode);
        }
    }
    else
    {
        if (disphal_process_dbg_opt(opt))
            goto Error;
    }

    return;

Error:
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "ERROR", "parse command error!\n\n%s", STR_HELP);
}