Ejemplo n.º 1
0
void mt_disp_init(void *lcdbase)
{
	// TODO: Fixit!!!!!
	//workaround for video mode
	//if(lcm_params->type==LCM_TYPE_DSI && lcm_params->dsi.mode!=CMD_MODE) 
	//	return;
	unsigned int lcm_fake_width = 0;
	unsigned int lcm_fake_height = 0;
	void *boot_mode_addr = 0;
    fb_size = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT) * ALIGN_TO(CFG_DISPLAY_HEIGHT, MTK_FB_ALIGNMENT) * 32 / 8;
	boot_mode_addr = (void *)((UINT32)lcdbase + fb_size);
    logo_db_addr = (void *)((UINT32)lcdbase - 4 * 1024 * 1024);
//    fb_addr      = (void *)((UINT32)lcdbase + fb_size);
	fb_addr  =   lcdbase;
	fb_offset_logo = 3;

    ///for debug prupose
    disp_log_enable(1);
    dbi_log_enable(1);

	mt_disp_parse_dfo_setting();	

	if((0 == mt_disp_get_dfo_setting("LCM_FAKE_WIDTH", &lcm_fake_width)) && (0 == mt_disp_get_dfo_setting("LCM_FAKE_HEIGHT", &lcm_fake_height)))
	{
		if(DISP_STATUS_OK != DISP_Change_LCM_Resolution(lcm_fake_width, lcm_fake_height))
		{
			dprintf(INFO,"[DISP_DFO]WARNING!!! Change LCM Resolution FAILED!!!\n");
		}
	}
		
    DISP_CHECK_RET(DISP_Init((UINT32)lcdbase, (UINT32)lcdbase, FALSE));
	memset((void*)lcdbase, 0x0, DISP_GetVRamSize());
    /* transparent front buffer for fb_console display */
#if 1
    LCD_CHECK_RET(LCD_LayerEnable(FB_LAYER, TRUE));
    LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER, (UINT32)boot_mode_addr));
    LCD_CHECK_RET(LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565));
	LCD_CHECK_RET(LCD_LayerSetPitch(FB_LAYER, CFG_DISPLAY_WIDTH*2/*ALIGN_TO(CFG_DISPLAY_WIDTH,MTK_FB_ALIGNMENT)*2*/));
    LCD_CHECK_RET(LCD_LayerSetOffset(FB_LAYER, 0, 0));
    LCD_CHECK_RET(LCD_LayerSetSize(FB_LAYER, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT));
    LCD_CHECK_RET(LCD_LayerSetSourceColorKey(FB_LAYER, TRUE, 0xff000000));
#endif

    /* background buffer for uboot logo display */
    LCD_CHECK_RET(LCD_LayerEnable(FB_LAYER - 1, TRUE));
    LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER - 1, (UINT32)fb_addr));
    LCD_CHECK_RET(LCD_LayerSetFormat(FB_LAYER - 1, LCD_LAYER_FORMAT_RGB565));
    LCD_CHECK_RET(LCD_LayerSetOffset(FB_LAYER - 1, 0, 0));
    LCD_CHECK_RET(LCD_LayerSetSize(FB_LAYER - 1, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT));
    LCD_CHECK_RET(LCD_LayerSetPitch(FB_LAYER - 1, ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT)*2));

#if 0
    if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3))
    {
		LCD_CHECK_RET(LCD_LayerSetRotation(FB_LAYER, LCD_LAYER_ROTATE_180));
		LCD_CHECK_RET(LCD_LayerSetRotation(FB_LAYER - 1, LCD_LAYER_ROTATE_180));
    }
#endif
}
DAL_STATUS DAL_LowMemoryOff(void)
{
	UINT32 BG_COLOR = MAKE_TWO_RGB565_COLOR(DAL_BG_COLOR, DAL_BG_COLOR);
	DAL_LOG("Enter DAL_LowMemoryOff()\n");

	DAL_CHECK_MFC_RET(MFC_SetMem(mfc_handle, low_memory_msg, BG_COLOR));
	
	if (LCD_STATE_POWER_OFF == LCD_GetState()) {
        dal_disable_when_resume_lowmemory = TRUE;
        goto End;
    }
//what about LCM_PHYSICAL_ROTATION = 180
	if(!dal_shown){// only low memory assert shown on screen
		DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE));
		DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0));
		DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER, 0,0));
   		DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER,
                                       DAL_WIDTH,
                                       DAL_HEIGHT));

	}
/*
	DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, 
                                         DAL_WIDTH,
                                         DAL_HEIGHT));
*/
End:			
	dal_lowMemory_shown = FALSE;
	DAL_LOG("Leave DAL_LowMemoryOff()\n");
    return DAL_STATUS_OK;
}
Ejemplo n.º 3
0
void mt_disp_init(void *lcdbase)
{
   UINT32 boot_mode_addr = 0;

   fb_size = ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT) * ALIGN_TO(CFG_DISPLAY_HEIGHT, MTK_FB_ALIGNMENT) * CFG_DISPLAY_BPP / 8;
   boot_mode_addr = (UINT32)((UINT32)lcdbase + fb_size);
   logo_db_addr = (void *)((UINT32)lcdbase - 4 * 1024 * 1024);
   //    fb_addr      = (void *)((UINT32)lcdbase + fb_size);
   fb_addr  =   lcdbase;
	fb_offset_logo = 3;
   
#if 0
   ///for debug prupose
   disp_log_enable(1);
   dbi_log_enable(1);
#endif

   DISP_CHECK_RET(DISP_Init((UINT32)lcdbase, (UINT32)lcdbase, FALSE));
   
   memset((void*)lcdbase, 0x0, DISP_GetVRamSize());
    /* transparent front buffer for fb_console display */
#if 1
    LCD_CHECK_RET(LCD_LayerEnable(FB_LAYER, TRUE));
    LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER, (UINT32)boot_mode_addr));
    LCD_CHECK_RET(LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565));
	LCD_CHECK_RET(LCD_LayerSetPitch(FB_LAYER, CFG_DISPLAY_WIDTH*2));
    LCD_CHECK_RET(LCD_LayerSetOffset(FB_LAYER, 0, 0));
    LCD_CHECK_RET(LCD_LayerSetSize(FB_LAYER, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT));
    LCD_CHECK_RET(LCD_LayerSetSourceColorKey(FB_LAYER, TRUE, 0xff000000));
#endif
   
   /* background buffer for uboot logo display */
   LCD_CHECK_RET(LCD_LayerEnable(FB_LAYER - 1, TRUE));
   LCD_CHECK_RET(LCD_LayerSetAddress(FB_LAYER - 1, (UINT32)fb_addr));
   LCD_CHECK_RET(LCD_LayerSetFormat(FB_LAYER - 1, LCD_LAYER_FORMAT_RGB565));
   LCD_CHECK_RET(LCD_LayerSetOffset(FB_LAYER - 1, 0, 0));
   LCD_CHECK_RET(LCD_LayerSetSize(FB_LAYER - 1, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT));
   LCD_CHECK_RET(LCD_LayerSetPitch(FB_LAYER - 1, ALIGN_TO(CFG_DISPLAY_WIDTH, MTK_FB_ALIGNMENT) * 2));
   
   if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3))
   {
      LCD_CHECK_RET(LCD_LayerSetRotation(FB_LAYER, LCD_LAYER_ROTATE_180));
      LCD_CHECK_RET(LCD_LayerSetRotation(FB_LAYER - 1, LCD_LAYER_ROTATE_180));
   }
}
Ejemplo n.º 4
0
void TVDVT_init_lcd(void)
{

    UINT32 i;


    LCD_CHECK_RET(LCD_LayerSetAddress(LCD_LAYER_0, src_buf_pa));
    LCD_CHECK_RET(LCD_LayerSetFormat(LCD_LAYER_0, LCD_LAYER_FORMAT_RGB888));
    LCD_CHECK_RET(LCD_LayerSetOffset(LCD_LAYER_0, 0, 0));
    LCD_CHECK_RET(LCD_LayerSetSize(LCD_LAYER_0,  SCREEN_WIDTH,SCREEN_HEIGHT));


    LCD_CHECK_RET(LCD_LayerSetPitch(LCD_LAYER_0, SCREEN_WIDTH * 3));


    LCD_CHECK_RET(LCD_LayerEnable(LCD_LAYER_0, FALSE));
    //LCD_CHECK_RET(LCD_LayerEnable(LCD_LAYER_ALL, FALSE));

    //LCD_CHECK_RET(LCD_LayerSetTriggerMode(LCD_LAYER_ALL, LCD_SW_TRIGGER));
    LCD_CHECK_RET(LCD_LayerSetTriggerMode(LCD_LAYER_0, LCD_SW_TRIGGER));


    LCD_CHECK_RET(LCD_EnableHwTrigger(FALSE));

    LCD_CHECK_RET(LCD_SetBackgroundColor(0));
    LCD_CHECK_RET(LCD_SetRoiWindow(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));

    LCD_CHECK_RET(LCD_FBSetFormat(LCD_FB_FORMAT_RGB888));
    LCD_CHECK_RET(LCD_FBSetPitch(SCREEN_WIDTH * 3 ));
    LCD_CHECK_RET(LCD_FBSetStartCoord(0, 0));
/*
    for (i = 0; i < lcm_params.dpi.intermediat_buffer_num; ++ i)
    {
        LCD_CHECK_RET(LCD_FBSetAddress(LCD_FB_0 + i, s_tmpBuffers[i].pa));
        LCD_CHECK_RET(LCD_FBEnable(LCD_FB_0 + i, TRUE));
    }
*/

    LCD_CHECK_RET(LCD_FBSetAddress(LCD_FB_0, dst_buf_pa)); //buffer address.
    LCD_CHECK_RET(LCD_FBEnable(LCD_FB_0, TRUE));

    //LCD_CHECK_RET(LCD_SetOutputMode(LCD_OUTPUT_TO_MEM));
    LCD_CHECK_RET(LCD_SetOutputMode(LCD_OUTPUT_TO_TVROT));


    LCD_CHECK_RET(LCD_LayerEnable(LCD_LAYER_0, TRUE));


}
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_Init(UINT32 layerVA, UINT32 layerPA)
{
    dal_fb_addr = (void *)layerVA;

    MFC_CHECK_RET(MFC_Open(&mfc_handle, dal_fb_addr,
                           DAL_WIDTH, DAL_HEIGHT, DAL_BPP,
                           DAL_FG_COLOR, DAL_BG_COLOR));

    DAL_Clean();

    LCD_CHECK_RET(LCD_LayerSetAddress(ASSERT_LAYER, layerPA));
    LCD_CHECK_RET(LCD_LayerSetFormat(ASSERT_LAYER, DAL_FORMAT));
    LCD_CHECK_RET(LCD_LayerSetAlphaBlending(ASSERT_LAYER, TRUE, 0x80));
    LCD_CHECK_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0, 0));
    LCD_CHECK_RET(LCD_LayerSetSize(ASSERT_LAYER,
                                   DAL_WIDTH,
                                   DAL_HEIGHT));
    return DAL_STATUS_OK;
}
DAL_STATUS DAL_Init(UINT32 layerVA, UINT32 layerPA)
{
    dal_fb_addr = (void *)layerVA;
    dal_fb_pa = layerPA;
    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_SetRedScreen((UINT32 *)dal_fb_addr);
#if 0
    DAL_CHECK_LCD_RET(LCD_LayerSetAddress(ASSERT_LAYER, layerPA));
    DAL_CHECK_LCD_RET(LCD_LayerSetFormat(ASSERT_LAYER, DAL_FORMAT));
    DAL_CHECK_LCD_RET(LCD_LayerSetAlphaBlending(ASSERT_LAYER, TRUE, 0x80));
    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_LayerSetPitch(ASSERT_LAYER, DAL_WIDTH * DAL_BPP));
#endif
    return DAL_STATUS_OK;
}
static DAL_STATUS Show_LowMemory(void)
{
	UINT32 update_width, update_height;
	MFC_CONTEXT *ctxt = (MFC_CONTEXT *)mfc_handle;

	if(!dal_shown){//only need show lowmemory assert
			update_width = ctxt->font_width * strlen(low_memory_msg);
			update_height = ctxt->font_height;
			DISP_LOG_PRINT(ANDROID_LOG_INFO, "DAL", "update size:%d,%d",update_width, update_height);
			DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, DAL_WIDTH - update_width,0));
			DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER, DAL_WIDTH - update_width,0));
    		DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER,
                                       update_width,update_height));
			DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, TRUE));
	}
/*
	if(!dal_lowMemory_shown)
		DAL_CHECK_DISP_RET(DISP_UpdateScreen(0, 0, 
                                         DAL_WIDTH,
                                         DAL_HEIGHT));
*/
    return DAL_STATUS_OK;
}
static DISP_STATUS dbi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
    if (!disp_drv_dbi_init_context()) 
        return DISP_STATUS_NOT_IMPLEMENTED;

#ifdef MT65XX_NEW_DISP
    {
        struct disp_path_config_struct config = {0};

        config.srcModule = DISP_MODULE_OVL;
        
        config.bgROI.x = 0;
        config.bgROI.y = 0;
        config.bgROI.width = DISP_GetScreenWidth();
        config.bgROI.height = DISP_GetScreenHeight();
        config.bgColor = 0x0;	// background color
        config.pitch = DISP_GetScreenWidth()*2;
        
        config.srcROI.x = 0;config.srcROI.y = 0;
        config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth();
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 

        // Config FB_Layer port to be physical.
#if 1  // defined(MTK_M4U_SUPPORT)
        {
            M4U_PORT_STRUCT portStruct;

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

        // Reconfig FB_Layer and enable it.
        config.ovl_config.layer = FB_LAYER;
        config.ovl_config.layer_en = 1; 
        config.ovl_config.fmt = OVL_INPUT_FORMAT_RGB565;
        config.ovl_config.addr = fbPA;	
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
        config.ovl_config.src_x = 0;
        config.ovl_config.src_y = 0;
        config.ovl_config.src_w = DISP_GetScreenWidth();
        config.ovl_config.src_h = DISP_GetScreenHeight();
        config.ovl_config.dst_x = 0;	   // ROI
        config.ovl_config.dst_y = 0;
        config.ovl_config.dst_w = DISP_GetScreenWidth();
        config.ovl_config.dst_h = DISP_GetScreenHeight();
        config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(),32)*2; //pixel number
        config.ovl_config.keyEn = 0;
        config.ovl_config.key = 0xFF;	   // color key
        config.ovl_config.aen = 0;			  // alpha enable
        config.ovl_config.alpha = 0;
        LCD_LayerSetAddress(FB_LAYER, fbPA);
        LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
        LCD_LayerSetOffset(FB_LAYER, 0, 0);
        LCD_LayerSetSize(FB_LAYER,DISP_GetScreenWidth(),DISP_GetScreenHeight());
        LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(),32) * 2);
        LCD_LayerEnable(FB_LAYER, TRUE);
        config.dstModule = DISP_MODULE_DBI;// DISP_MODULE_WDMA1
        config.outFormat = RDMA_OUTPUT_FORMAT_ARGB;

        disp_path_config(&config);

        disp_bls_config();
    }
#endif


    init_io_pad();
    init_io_driving_current();
    init_lcd(isLcmInited);

    if (NULL != lcm_drv->init && !isLcmInited) {
        lcm_drv->init();
    }

    init_lcd_te_control();

    return DISP_STATUS_OK;
}
DAL_STATUS DAL_OnDispPowerOn(void)
{
    DAL_LOCK();

    /* Re-enable assertion layer when display resumes */
    
    if (LCD_STATE_POWER_OFF != LCD_GetState()){
		if(dal_enable_when_resume) {
        	dal_enable_when_resume = FALSE;
        	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;
        	}
#ifdef DAL_LOWMEMORY_ASSERT
			dal_enable_when_resume_lowmemory = FALSE;
			dal_disable_when_resume_lowmemory = FALSE;
#endif
			goto End;
    	}
		else if(dal_disable_when_resume){
			dal_disable_when_resume = FALSE;
   			DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE));
			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
			goto End;

		}
#ifdef DAL_LOWMEMORY_ASSERT
		if(dal_enable_when_resume_lowmemory){
			dal_enable_when_resume_lowmemory = FALSE;
			if(!dal_shown){//only need show lowmemory assert
				Show_LowMemory();
			}
		}
		else if(dal_disable_when_resume_lowmemory){
			if(!dal_shown){// only low memory assert shown on screen
				DAL_CHECK_LCD_RET(LCD_LayerEnable(ASSERT_LAYER, FALSE));
				DAL_CHECK_LCD_RET(LCD_LayerSetOffset(ASSERT_LAYER, 0,0));
				DAL_CHECK_LCD_RET(LCD_LayerSetWindowOffset(ASSERT_LAYER, 0,0));
   				DAL_CHECK_LCD_RET(LCD_LayerSetSize(ASSERT_LAYER,
                                       DAL_WIDTH,
                                       DAL_HEIGHT));
			}
		}
		else{}
#endif
	}

End:
    DAL_UNLOCK();

    return DAL_STATUS_OK;
}
Ejemplo n.º 11
0
static DISP_STATUS dsi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
    // DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "%s, line:%d\n", __func__, __LINE__);
    if (!disp_drv_dsi_init_context()) 
        return DISP_STATUS_NOT_IMPLEMENTED;

    // DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "%s, line:%d\n", __func__, __LINE__);
    if(lcm_params->dsi.mode == CMD_MODE) {
        #ifndef MT65XX_NEW_DISP
            init_lcd();
        #endif

        init_dsi(isLcmInited);
        mdelay(1);
        
        // DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "%s, line:%d\n", __func__, __LINE__);
        if (NULL != lcm_drv->init && !isLcmInited) 
        {
            lcm_drv->init();
            DSI_LP_Reset();
        }
        // DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "%s, line:%d\n", __func__, __LINE__);
        #ifndef MT65XX_NEW_DISP
            DSI_clk_HS_mode(0);
        #else
            DSI_clk_HS_mode(1);
        #endif

        // DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "%s, line:%d\n", __func__, __LINE__);
        DSI_SetMode(lcm_params->dsi.mode);
        #ifndef MT65XX_NEW_DISP
            init_lcd_te_control();
        #endif
    }
    else {
        #ifndef MT65XX_NEW_DISP
            init_intermediate_buffers(fbPA);
            
            init_lcd();
            init_dpi(isLcmInited);
        #endif

        if (!isLcmInited)
        {
            DSI_SetMode(0);
            mdelay(100);
            DSI_Stop();
        }
        else
        {
            is_video_mode_running = true;
        }
        init_dsi(isLcmInited);
        mdelay(1);
        
        if (NULL != lcm_drv->init && !isLcmInited) {
            lcm_drv->init();
            DSI_LP_Reset();
        }
        
        DSI_SetMode(lcm_params->dsi.mode);
        
        #ifndef BUILD_UBOOT	
            if(lcm_params->dsi.lcm_ext_te_monitor)
            {
                is_video_mode_running = false;
                LCD_TE_SetMode(LCD_TE_MODE_VSYNC_ONLY);
                LCD_TE_SetEdgePolarity(LCM_POLARITY_RISING);
                LCD_TE_Enable(FALSE);
            }
            
            if(lcm_params->dsi.noncont_clock)
                DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);
            
            if(lcm_params->dsi.lcm_int_te_monitor)
                DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);			
        #endif			
    }

#ifdef MT65XX_NEW_DISP
    {
        struct disp_path_config_struct config = {0};
        config.srcModule = DISP_MODULE_OVL;
        config.bgROI.x = 0;
        config.bgROI.y = 0;
        config.bgROI.width = DISP_GetScreenWidth();
        config.bgROI.height = DISP_GetScreenHeight();
        config.bgColor = 0x0;	// background color

        config.pitch = ALIGN_TO(DISP_GetScreenWidth(),32)*2;
        config.srcROI.x = 0;config.srcROI.y = 0;
        config.srcROI.height= DISP_GetScreenHeight();
        config.srcROI.width= DISP_GetScreenWidth();
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 

        config.ovl_config.layer = FB_LAYER;
        config.ovl_config.layer_en = 1; 
        config.ovl_config.fmt = OVL_INPUT_FORMAT_RGB565;
        config.ovl_config.addr = fbPA;	
        config.ovl_config.vaddr = fbVA;	
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
        config.ovl_config.src_x = 0;
        config.ovl_config.src_y = 0;
        config.ovl_config.src_w = DISP_GetScreenWidth();
        config.ovl_config.src_h = DISP_GetScreenHeight();
        config.ovl_config.dst_x = 0;	   // ROI
        config.ovl_config.dst_y = 0;
        config.ovl_config.dst_w = DISP_GetScreenWidth();
        config.ovl_config.dst_h = DISP_GetScreenHeight();
        config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(),32)*2; //pixel number
        config.ovl_config.keyEn = 0;
        config.ovl_config.key = 0xFF;	   // color key
        config.ovl_config.aen = 0;			  // alpha enable
        config.ovl_config.alpha = 0;	

        if(lcm_params->dsi.mode == CMD_MODE)
            config.dstModule = DISP_MODULE_DSI_CMD;// DISP_MODULE_WDMA1
        else
            config.dstModule = DISP_MODULE_DSI_VDO;// DISP_MODULE_WDMA1

        config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 

        LCD_LayerSetAddress(FB_LAYER, fbPA);
        LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
        LCD_LayerSetOffset(FB_LAYER, 0, 0);
        LCD_LayerSetSize(FB_LAYER,DISP_GetScreenWidth(),DISP_GetScreenHeight());
        LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(),32) * 2);
        LCD_LayerEnable(FB_LAYER, TRUE);                    

#if defined(MTK_M4U_EXT_PAGE_TABLE)
        if(lcm_params->dsi.mode != CMD_MODE)
        {
            DSI_Wait_VDO_Idle();
            disp_path_get_mutex();
        }

        disp_path_config(&config);
        
        #if 1
        // Config FB_Layer port to be physical.
        {
            M4U_PORT_STRUCT portStruct;
            
            portStruct.ePortID = M4U_PORT_LCD_OVL;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
            portStruct.Virtuality = 1;
            portStruct.Security = 0;
            portStruct.domain = 3;			  //domain : 0 1 2 3
            portStruct.Distance = 1;
            portStruct.Direction = 0;
            m4u_config_port(&portStruct);
        }
        // hook m4u debug callback function
        m4u_set_tf_callback(M4U_CLNTMOD_DISP, &disp_m4u_dump_reg);
        #endif

        if(lcm_params->dsi.mode != CMD_MODE)
        {
            disp_path_release_mutex();
            DSI_Start();
        }
        
#else
        if(lcm_params->dsi.mode != CMD_MODE){

            #define TIMECNT  1000000
            unsigned int reg1 = 0, reg2 = 0, reg3 = 0;
            unsigned int timeout_cnt = 0;
            unsigned int irq_mask;

            // dump before modification
            printk("[DISP] pa:0x%x, va:0x%x \n", fbPA, fbVA);		
            
            // enable frame done interrupt
            disp_path_get_mutex();
            OVLEnableIrq(0x2);
            disp_path_release_mutex();
            
            while (timeout_cnt < TIMECNT)
            {
                reg1 = DISP_REG_GET(DISP_REG_OVL_INTSTA);
                reg2 = DISP_REG_GET(DISP_REG_OVL_STA);
                // frame done interrupt
                if (((reg1 & 0x2) == 0x2) && ((reg2 & 0x1) == 0x0))
                {
                    DISP_REG_SET(DISP_REG_OVL_INTSTA, ~reg1);     

                    local_irq_save(irq_mask);
                    disp_path_get_mutex();
                    disp_path_config(&config);
                    disp_path_release_mutex();

                    #if 1  // defined(MTK_M4U_SUPPORT)
                    {
                        M4U_PORT_STRUCT portStruct;
                        
                        portStruct.ePortID = M4U_PORT_LCD_OVL;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
                        portStruct.Virtuality = 1;
                        portStruct.Security = 0;
                        portStruct.domain = 3;			  //domain : 0 1 2 3
                        portStruct.Distance = 1;
                        portStruct.Direction = 0;
                        m4u_config_port(&portStruct);
                    }
                    // hook m4u debug callback function
                    m4u_set_tf_callback(M4U_CLNTMOD_DISP, &disp_m4u_dump_reg);
                    #endif
                    local_irq_restore(irq_mask);

                    break;
                }
                timeout_cnt++;
            }
            // sw timeout
            if (timeout_cnt >= TIMECNT)
            {
                printk("[DISP] timeout:%d \n", timeout_cnt);		
                ASSERT(0);
            }
            // dump after modification
            printk("[DISP] cnt:%d \n", timeout_cnt);		
        }
        else
        {
            disp_path_config(&config);

            #if 1  // defined(MTK_M4U_SUPPORT)
            {
                M4U_PORT_STRUCT portStruct;
                
                portStruct.ePortID = M4U_PORT_LCD_OVL;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
                portStruct.Virtuality = 1;
                portStruct.Security = 0;
                portStruct.domain = 3;			  //domain : 0 1 2 3
                portStruct.Distance = 1;
                portStruct.Direction = 0;
                m4u_config_port(&portStruct);
            }
            // hook m4u debug callback function
            m4u_set_tf_callback(M4U_CLNTMOD_DISP, &disp_m4u_dump_reg);
            #endif
        }
#endif

    }
#endif

    printk("%s, config done\n", __func__);

    return DISP_STATUS_OK;
}
Ejemplo n.º 12
0
static DISP_STATUS dsi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dsi_init_context()) 
		return DISP_STATUS_NOT_IMPLEMENTED;

	if(lcm_params->dsi.mode == CMD_MODE) {
#ifndef MT65XX_NEW_DISP
		init_lcd();
#endif
		init_dsi(isLcmInited);

		if (NULL != lcm_drv->init && !isLcmInited) 
		{
			lcm_drv->init();
			DSI_LP_Reset();
		}
#ifndef MT65XX_NEW_DISP
		DSI_clk_HS_mode(0);
#else
		DSI_clk_HS_mode(1);
#endif
		DSI_SetMode(lcm_params->dsi.mode);
#ifndef MT65XX_NEW_DISP
		DPI_PowerOn();
		DPI_PowerOff();

		init_lcd_te_control();
#endif
	}
	else {
#ifndef MT65XX_NEW_DISP
		init_intermediate_buffers(fbPA);

	    init_lcd();
		init_dpi(isLcmInited);
#endif
        if (!isLcmInited)
        {
        DSI_SetMode(0);
        mdelay(100);
        DSI_DisableClk();
        }
        else
        {
            is_video_mode_running = true;
        }
		init_dsi(isLcmInited);

		if (NULL != lcm_drv->init && !isLcmInited) {
			lcm_drv->init();
			DSI_LP_Reset();
		}

		DSI_SetMode(lcm_params->dsi.mode);

#ifndef BUILD_UBOOT	
#ifndef MT65XX_NEW_DISP
		if(lcm_params->dsi.lcm_ext_te_monitor)
		{
			is_video_mode_running = false;
			LCD_TE_SetMode(LCD_TE_MODE_VSYNC_ONLY);
			LCD_TE_SetEdgePolarity(LCM_POLARITY_RISING);
			LCD_TE_Enable(FALSE);
		}

		if(lcm_params->dsi.noncont_clock)
			DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);

		if(lcm_params->dsi.lcm_int_te_monitor)
			DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);			
#endif
#endif			
	}
#ifdef MT65XX_NEW_DISP
		{
			struct disp_path_config_struct config = {0};
			config.srcModule = DISP_MODULE_OVL;
				config.bgROI.x = 0;
				config.bgROI.y = 0;
				config.bgROI.width = DISP_GetScreenWidth();
				config.bgROI.height = DISP_GetScreenHeight();
				config.bgColor = 0x0;	// background color
	
				config.pitch = DISP_GetScreenWidth()*2;
				config.srcROI.x = 0;config.srcROI.y = 0;
				config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth();
				config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
	
        if(lcm_params->dsi.mode != CMD_MODE)
        {
            config.ovl_config.layer = FB_LAYER;
            config.ovl_config.layer_en = 0;
            disp_path_get_mutex();
            disp_path_config_layer(&config.ovl_config);
            disp_path_release_mutex();
            disp_path_wait_reg_update();
        }
        // Config FB_Layer port to be physical.
        {
            M4U_PORT_STRUCT portStruct;
            portStruct.ePortID = M4U_PORT_OVL_CH3;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
            portStruct.Virtuality = 1;
            portStruct.Security = 0;
            portStruct.domain = 3;			  //domain : 0 1 2 3
            portStruct.Distance = 1;
            portStruct.Direction = 0;
            m4u_config_port(&portStruct);
        }
        config.ovl_config.layer = FB_LAYER;
        config.ovl_config.layer_en = 1; 
        config.ovl_config.fmt = OVL_INPUT_FORMAT_RGB565;
        config.ovl_config.addr = fbPA;	
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
        config.ovl_config.src_x = 0;
        config.ovl_config.src_y = 0;
        config.ovl_config.dst_x = 0;	   // ROI
        config.ovl_config.dst_y = 0;
        config.ovl_config.dst_w = DISP_GetScreenWidth();
        config.ovl_config.dst_h = DISP_GetScreenHeight();
        config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(),32)*2; //pixel number
        config.ovl_config.keyEn = 0;
        config.ovl_config.key = 0xFF;	   // color key
        config.ovl_config.aen = 0;			  // alpha enable
        config.ovl_config.alpha = 0;	

        LCD_LayerSetAddress(FB_LAYER, fbPA);
        LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
        LCD_LayerSetOffset(FB_LAYER, 0, 0);
        LCD_LayerSetSize(FB_LAYER,DISP_GetScreenWidth(),DISP_GetScreenHeight());
        LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(),32) * 2);
        LCD_LayerEnable(FB_LAYER, TRUE);                    
        if(lcm_params->dsi.mode == CMD_MODE)
            config.dstModule = DISP_MODULE_DSI_CMD;// DISP_MODULE_WDMA1
        else
            config.dstModule = DISP_MODULE_DSI_VDO;// DISP_MODULE_WDMA1
        config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 
        if(lcm_params->dsi.mode != CMD_MODE)
            disp_path_get_mutex();

        disp_path_config(&config);

        if(lcm_params->dsi.mode != CMD_MODE)
            disp_path_release_mutex();

        // Disable LK UI layer (Layer2)
        if(lcm_params->dsi.mode != CMD_MODE)
        {
            config.ovl_config.layer = FB_LAYER-1;
            config.ovl_config.layer_en = 0;
            disp_path_get_mutex();
            disp_path_config_layer(&config.ovl_config);
            disp_path_release_mutex();
            disp_path_wait_reg_update();
        }

        // Config LK UI layer port to be physical.
        {
            M4U_PORT_STRUCT portStruct;
            portStruct.ePortID = M4U_PORT_OVL_CH2;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
            portStruct.Virtuality = 1;
            portStruct.Security = 0;
            portStruct.domain = 3;			  //domain : 0 1 2 3
            portStruct.Distance = 1;
            portStruct.Direction = 0;
            m4u_config_port(&portStruct);
        }
		}
#endif

	return DISP_STATUS_OK;
}
Ejemplo n.º 13
0
// ---------------------------------------------------------------------------
//  DBI Display Driver Public Functions
// ---------------------------------------------------------------------------
static DISP_STATUS dsi_config_ddp(UINT32 fbPA)
{
	struct disp_path_config_struct config = {0};
	if (DISP_IsDecoupleMode()) {
		config.srcModule = DISP_MODULE_RDMA;
	} else {
		config.srcModule = DISP_MODULE_OVL;
	}

	config.bgROI.x = 0;
	config.bgROI.y = 0;
	config.bgROI.width = lcm_params->width;
	config.bgROI.height = lcm_params->height;
	config.bgColor = 0x0;	// background color

	config.pitch = lcm_params->width*2;
	config.srcROI.x = 0;config.srcROI.y = 0;
	config.srcROI.height= lcm_params->height;
	config.srcROI.width= lcm_params->width;
	config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
	
	if(lcm_params->dsi.mode != CMD_MODE)
	{
		config.ovl_config.layer = DDP_OVL_LAYER_MUN-1;
		config.ovl_config.layer_en = 0;
		//disp_path_get_mutex();
		disp_path_config_layer(&config.ovl_config);
		//disp_path_release_mutex();
		//disp_path_wait_reg_update();
	}
#if 1
		// Disable LK UI layer (Layer2)
	{
		config.ovl_config.layer = DDP_OVL_LAYER_MUN-1-1;
		config.ovl_config.layer_en = 0; // disable LK UI layer anyway
		//disp_path_get_mutex();
		disp_path_config_layer(&config.ovl_config);
		//disp_path_release_mutex();
		//disp_path_wait_reg_update();
	}
#endif
		config.ovl_config.layer = DDP_OVL_LAYER_MUN-1;
		config.ovl_config.layer_en = 1; 
		config.ovl_config.fmt = eRGB565;
		config.ovl_config.addr = fbPA;	
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
		config.ovl_config.src_x = 0;
		config.ovl_config.src_y = 0;
		config.ovl_config.dst_x = 0;	   // ROI
		config.ovl_config.dst_y = 0;
		config.ovl_config.dst_w = lcm_params->width;
		config.ovl_config.dst_h = lcm_params->height;
		config.ovl_config.src_pitch = ALIGN_TO(lcm_params->width, MTK_FB_ALIGNMENT)*2; //pixel number
		config.ovl_config.keyEn = 0;
		config.ovl_config.key = 0xFF;	   // color key
		config.ovl_config.aen = 0;			  // alpha enable
		config.ovl_config.alpha = 0;	

		/*LCD_LayerSetAddress(DDP_OVL_LAYER_MUN-1, fbPA);
		LCD_LayerSetFormat(DDP_OVL_LAYER_MUN-1, LCD_LAYER_FORMAT_RGB565);
		LCD_LayerSetOffset(DDP_OVL_LAYER_MUN-1, 0, 0);
		LCD_LayerSetSize(DDP_OVL_LAYER_MUN-1,lcm_params->width,lcm_params->height);
		LCD_LayerSetPitch(DDP_OVL_LAYER_MUN-1, ALIGN_TO(lcm_params->width, MTK_FB_ALIGNMENT) * 2);
		LCD_LayerEnable(DDP_OVL_LAYER_MUN-1, TRUE); */
		LCD_LayerSetAddress(FB_LAYER, fbPA);
		LCD_LayerSetFormat(FB_LAYER, eRGB565);
		LCD_LayerSetOffset(FB_LAYER, 0, 0);
		LCD_LayerSetSize(FB_LAYER,lcm_params->width,lcm_params->height);
		LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(lcm_params->width, MTK_FB_ALIGNMENT) * 2);
		LCD_LayerEnable(FB_LAYER, TRUE);

		if(lcm_params->dsi.mode == CMD_MODE)
			config.dstModule = DISP_MODULE_DSI_CMD;// DISP_MODULE_WDMA1
		else
			config.dstModule = DISP_MODULE_DSI_VDO;// DISP_MODULE_WDMA1
		config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 
		disp_path_config(&config);
		
	if(lcm_params->dsi.mode != CMD_MODE)
	{
		//DSI_Wait_VDO_Idle();
		disp_path_get_mutex();
	}

	// Config FB_Layer port to be physical.
	{
		M4U_PORT_STRUCT portStruct;

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

	if(lcm_params->dsi.mode != CMD_MODE)
	{
		disp_path_release_mutex();
		//if(1 == lcm_params->dsi.ufoe_enable)
		//	UFOE_Start();
		//DSI_Start();
	}
	printk("%s, config done\n", __func__);
	return DISP_STATUS_OK;
}
// ---------------------------------------------------------------------------
//  DBI Display Driver Public Functions
// ---------------------------------------------------------------------------
static DISP_STATUS dsi_config_ddp(UINT32 fbPA)
{
    unsigned long irq_mask;
    struct disp_path_config_struct config = {0};

    if (DISP_IsDecoupleMode()) 
    {
        config.srcModule = DISP_MODULE_RDMA0;
    } 
    else 
    {
        config.srcModule = DISP_MODULE_OVL;
    }
    
    config.bgROI.x = 0;
    config.bgROI.y = 0;
    config.bgROI.width = lcm_params->width;
    config.bgROI.height = lcm_params->height;
    config.bgColor = 0x0;	// background color
    
    config.pitch = lcm_params->width*2;
    config.srcROI.x = 0;config.srcROI.y = 0;
    config.srcROI.height= lcm_params->height;
    config.srcROI.width= lcm_params->width;
    config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
    
    config.ovl_config.layer = DDP_OVL_LAYER_MUN-1;
    config.ovl_config.layer_en = 1; 
    config.ovl_config.fmt = eRGB565;
    config.ovl_config.addr = fbPA;	
    config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
    config.ovl_config.src_x = 0;
    config.ovl_config.src_y = 0;
    config.ovl_config.dst_x = 0;	   // ROI
    config.ovl_config.dst_y = 0;
    config.ovl_config.dst_w = lcm_params->width;
    config.ovl_config.dst_h = lcm_params->height;
    config.ovl_config.src_pitch = ALIGN_TO(lcm_params->width, MTK_FB_ALIGNMENT)*2; //pixel number
    config.ovl_config.keyEn = 0;
    config.ovl_config.key = 0xFF;	   // color key
    config.ovl_config.aen = 0;			  // alpha enable
    config.ovl_config.alpha = 0;	
    
    LCD_LayerSetAddress(DDP_OVL_LAYER_MUN-1, fbPA);
    LCD_LayerSetFormat(DDP_OVL_LAYER_MUN-1, LCD_LAYER_FORMAT_RGB565);
    LCD_LayerSetOffset(DDP_OVL_LAYER_MUN-1, 0, 0);
    LCD_LayerSetSize(DDP_OVL_LAYER_MUN-1,lcm_params->width,lcm_params->height);
    LCD_LayerSetPitch(DDP_OVL_LAYER_MUN-1, ALIGN_TO(lcm_params->width, MTK_FB_ALIGNMENT) * 2);
    LCD_LayerEnable(DDP_OVL_LAYER_MUN-1, TRUE); 
    
    if(lcm_params->dsi.mode == CMD_MODE)
    {
        config.dstModule = DISP_MODULE_DSI_CMD;// DISP_MODULE_WDMA1
    }
    else
    {
        config.dstModule = DISP_MODULE_DSI_VDO;// DISP_MODULE_WDMA1
    }
    config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 
    
    if(lcm_params->dsi.mode != CMD_MODE)
    {
        DSI_Wait_VDO_Idle();
        local_irq_save(irq_mask);
        disp_path_get_mutex();
    }
    
    disp_path_config(&config);

    // Config FB_Layer port to be physical.
    {
        M4U_PORT_STRUCT portStruct;
        
        portStruct.ePortID = M4U_PORT_LCD_OVL;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
        portStruct.Virtuality = 1;
        portStruct.Security = 0;
        portStruct.domain = 3;			  //domain : 0 1 2 3
        portStruct.Distance = 1;
        portStruct.Direction = 0;
        m4u_config_port(&portStruct);
    }
    // hook m4u debug callback function
    m4u_set_tf_callback(M4U_CLNTMOD_DISP, &disp_m4u_dump_reg);
    
    if(lcm_params->dsi.mode != CMD_MODE)
    {
        disp_path_release_mutex();
        DSI_Start();
        local_irq_restore(irq_mask);
    }
    printk("%s, config done\n", __func__);

    return DISP_STATUS_OK;
}
Ejemplo n.º 15
0
void DSI_set_cmdq_V2(unsigned cmd, unsigned char count, unsigned char *para_list, unsigned char force_update)
{
	UINT32 i, layer, layer_state, lane_num;
	UINT32 goto_addr, mask_para, set_para;
	UINT32 fbPhysAddr, fbVirAddr;
	DSI_T0_INS t0;	
	DSI_T1_INS t1;	
	DSI_T2_INS t2;	

    _WaitForEngineNotBusy();
    
	if (count > 59)
	{
		UINT32 pixel = count/3 + ((count%3) ? 1 : 0);
		
		LCD_REG_LAYER 	fb_layer_info;
		LCD_REG_DSI_DC	dsi_info;

		// backup layer state.
		layer_state = AS_UINT32(&LCD_REG->WROI_CONTROL) & 0xFC000000;

		// backup FB layer info.
		memcpy((void *)&fb_layer_info, (void *)&LCD_REG->LAYER[FB_LAYER], sizeof(LCD_REG_LAYER));

		// backup LCD-DSI I/F configuration.
		dsi_info = LCD_REG->DS_DSI_CON;

		// backup lane number.
		lane_num = DSI_REG->DSI_TXRX_CTRL.LANE_NUM;

		// HW limitation.
		// LP type-1 command can't go with 2 lanes. So we must switch to lane mode.
		DSI_REG->DSI_TXRX_CTRL.LANE_NUM = 1;
		DSI_PHY_REG->MIPITX_CON1.RG_DSI_CK_SEL = 0;

		// Modify LCD-DSI configuration
		LCD_REG->DS_DSI_CON.DC_DSI = TRUE;
		// Let LSB of RGB(BGR in buffer) first.
		LCD_REG->DS_DSI_CON.RGB_SWAP = LCD_DSI_IF_FMT_COLOR_ORDER_BGR;
		// Let parameters be in unit of byte.
		LCD_REG->DS_DSI_CON.CLR_FMT = LCD_DSI_IF_FORMAT_RGB888;
		// HW limitation
		// It makes package numbers > 1.
		LCD_REG->DS_DSI_CON.PACKET_SIZE = 30;

		// Start of Enable only one layer (FB layer) to push data to DSI
		LCD_CHECK_RET(LCD_LayerEnable(LCD_LAYER_ALL, FALSE));
		LCD_CHECK_RET(LCD_LayerEnable(FB_LAYER, TRUE));
		LCD_CHECK_RET(LCD_SetRoiWindow(0, 0, pixel, 1));
		LCD_CHECK_RET(LCD_SetBackgroundColor(0));
                
		// operates on FB layer
		{
		    extern void disp_get_fb_address(UINT32 *fbVirAddr, UINT32 *fbPhysAddr);
            disp_get_fb_address(&fbVirAddr ,&fbPhysAddr);

		    // copy parameters to FB layer buffer.
		    memcpy((void *)fbVirAddr, (void *)para_list, count);
		    LCD_REG->LAYER[FB_LAYER].ADDRESS = fbPhysAddr;
		}

		LCD_CHECK_RET(LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB888));
		LCD_CHECK_RET(LCD_LayerSetPitch(FB_LAYER, pixel*3));
		LCD_CHECK_RET(LCD_LayerSetOffset(FB_LAYER, 0, 0));
		LCD_CHECK_RET(LCD_LayerSetSize(FB_LAYER, pixel, 1));
		// End of Enable only one layer (FB layer) to push data to DSI

		t1.CONFG = 1;
		t1.Data_ID = DSI_DCS_LONG_PACKET_ID;
		t1.mem_start0 = (cmd&0xFF);
		t1.mem_start1 = (cmd>>8);

		OUTREG32(&DSI_CMDQ_REG->data0[0], AS_UINT32(&t1));
		OUTREG32(&DSI_REG->DSI_CMDQ_SIZE, 1);	

		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "[DISP] - kernel - DSI_set_cmdq_V2. command(0x%x) parameter count = %d > 59, pixel = %d \n", cmd, count, pixel);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "[DISP] - kernel - command queue only support 16 x 4 bytes. Header used 4 byte. DCS used 1 byte. If parameter > 59 byte, work around by Type-1 command. \n");
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "para_list[%d] = {", count);
	    for (i = 0; i < count; i++)
	        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "0x%02x, ", para_list[i]);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "} \n");

		LCD_M4U_On(0);

		if(force_update)
		{
			LCD_CHECK_RET(LCD_StartTransfer(FALSE));		
			DSI_EnableClk();
		}

		_WaitForEngineNotBusy();

		LCD_M4U_On(1);

		// restore FB layer info.
		memcpy((void *)&LCD_REG->LAYER[FB_LAYER], (void *)&fb_layer_info, sizeof(LCD_REG_LAYER));

		// restore LCD-DSI I/F configuration.
		LCD_REG->DS_DSI_CON = dsi_info;

		// restore lane number.
		DSI_REG->DSI_TXRX_CTRL.LANE_NUM = lane_num;
		DSI_PHY_REG->MIPITX_CON1.RG_DSI_CK_SEL = (lane_num - 1);
		
		// restore layer state.
		for(layer=LCD_LAYER_0; layer<LCD_LAYER_NUM; layer++)
		{
			if(layer_state&(0x80000000>>layer))
				LCD_CHECK_RET(LCD_LayerEnable(layer, TRUE));
			else
				LCD_CHECK_RET(LCD_LayerEnable(layer, FALSE));
		}
Ejemplo n.º 16
0
static DISP_STATUS dbi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dbi_init_context())
		return DISP_STATUS_NOT_IMPLEMENTED;
#if 0
#ifdef MT65XX_NEW_DISP
	{
		struct disp_path_config_struct config = { 0 };

		config.srcModule = DISP_MODULE_OVL;

		config.bgROI.x = 0;
		config.bgROI.y = 0;
		config.bgROI.width = DISP_GetScreenWidth();
		config.bgROI.height = DISP_GetScreenHeight();
		config.bgColor = 0x0;	/* background color */
		config.pitch = DISP_GetScreenWidth() * 2;

		config.srcROI.x = 0;
		config.srcROI.y = 0;
		config.srcROI.height = DISP_GetScreenHeight();
		config.srcROI.width = DISP_GetScreenWidth();
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
		/* Config FB_Layer port to be physical. */
		{
			M4U_PORT_STRUCT portStruct;
			portStruct.ePortID = M4U_PORT_OVL_CH3;	/* hardware port ID, defined in M4U_PORT_ID_ENUM */
			portStruct.Virtuality = 1;
			portStruct.Security = 0;
			portStruct.domain = 3;	/* domain : 0 1 2 3 */
			portStruct.Distance = 1;
			portStruct.Direction = 0;
			m4u_config_port(&portStruct);
		}
		/* Reconfig FB_Layer and enable it. */
		config.ovl_config.layer = FB_LAYER;
		config.ovl_config.layer_en = 1;
		config.ovl_config.fmt = eRGB565;
		config.ovl_config.addr = fbPA;
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
		config.ovl_config.src_x = 0;
		config.ovl_config.src_y = 0;
		config.ovl_config.dst_x = 0;	/* ROI */
		config.ovl_config.dst_y = 0;
		config.ovl_config.dst_w = DISP_GetScreenWidth();
		config.ovl_config.dst_h = DISP_GetScreenHeight();
		config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(), 32) * 2;
		config.ovl_config.keyEn = 0;
		config.ovl_config.key = 0xFF;	/* color key */
		config.ovl_config.aen = 0;	/* alpha enable */
		config.ovl_config.alpha = 0;
		LCD_LayerSetAddress(FB_LAYER, fbPA);
		LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
		LCD_LayerSetOffset(FB_LAYER, 0, 0);
		LCD_LayerSetSize(FB_LAYER, DISP_GetScreenWidth(), DISP_GetScreenHeight());
		LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(), 32) * 2);
		LCD_LayerEnable(FB_LAYER, TRUE);
		config.dstModule = DISP_MODULE_DBI;	/* DISP_MODULE_WDMA1 */
		config.outFormat = RDMA_OUTPUT_FORMAT_ARGB;
		/* disp_path_get_mutex(); */
		disp_path_config(&config);
		/* Config LK UI layer port to be physical. */
		{
			M4U_PORT_STRUCT portStruct;
			portStruct.ePortID = M4U_PORT_OVL_CH2;	/* hardware port ID, defined in M4U_PORT_ID_ENUM */
			portStruct.Virtuality = 1;
			portStruct.Security = 0;
			portStruct.domain = 3;	/* domain : 0 1 2 3 */
			portStruct.Distance = 1;
			portStruct.Direction = 0;
			m4u_config_port(&portStruct);
		}

		disp_bls_config();
	}
#endif


	init_io_pad();
	init_io_driving_current();
	init_lcd();

	if (NULL != lcm_drv->init && !isLcmInited)
		lcm_drv->init();

	init_lcd_te_control();
	DPI_PowerOn();
	DPI_PowerOff();
	DSI_PowerOn();
	DSI_PowerOff();
#endif
	return DISP_STATUS_OK;
}
Ejemplo n.º 17
0
static DISP_STATUS dpi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dpi_init_context())
		return DISP_STATUS_NOT_IMPLEMENTED;
#ifndef MT65XX_NEW_DISP
	init_intermediate_buffers(fbPA);
#else
	{
		struct disp_path_config_struct config = { 0 };

		if (DISP_IsDecoupleMode())
			config.srcModule = DISP_MODULE_RDMA;
		else
			config.srcModule = DISP_MODULE_OVL;

		config.bgROI.x = 0;
		config.bgROI.y = 0;
		config.bgROI.width = DISP_GetScreenWidth();
		config.bgROI.height = DISP_GetScreenHeight();
		config.bgColor = 0x0;	/* background color */

		config.srcROI.x = 0;
		config.srcROI.y = 0;
		config.srcROI.height = DISP_GetScreenHeight();
		config.srcROI.width = DISP_GetScreenWidth();
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
#if 0
		/* Disable all layers. */
		/* First disable FB_Layer. */
		disp_path_get_mutex();
		config.ovl_config.layer = 0;
		config.ovl_config.layer_en = 0;
		disp_path_config_layer(&config.ovl_config);
		config.ovl_config.layer = 1;
		disp_path_config_layer(&config.ovl_config);
		config.ovl_config.layer = 2;
		disp_path_config_layer(&config.ovl_config);
		config.ovl_config.layer = 3;
		disp_path_config_layer(&config.ovl_config);
		disp_path_release_mutex();
		disp_path_wait_reg_update();
#endif
		/* Config FB_Layer port to be virtual. */
		{
			M4U_PORT_STRUCT portStruct;
			portStruct.ePortID = DISP_OVL_0;	/* hardware port ID, defined in M4U_PORT_ID_ENUM */
			portStruct.Virtuality = 1;
			portStruct.Security = 0;
			portStruct.domain = 3;	/* domain : 0 1 2 3 */
			portStruct.Distance = 1;
			portStruct.Direction = 0;
			m4u_config_port(&portStruct);
		}
		/* Reconfig FB_Layer and enable it. */

		config.ovl_config.layer = FB_LAYER;
		config.ovl_config.layer_en = 1;
		config.ovl_config.fmt = eRGB565;
		config.ovl_config.addr = fbPA;
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
		config.ovl_config.src_x = 0;
		config.ovl_config.src_y = 0;
		config.ovl_config.dst_x = 0;	/* ROI */
		config.ovl_config.dst_y = 0;
		config.ovl_config.dst_w = DISP_GetScreenWidth();
		config.ovl_config.dst_h = DISP_GetScreenHeight();
		config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(), 32) * 2;
		config.ovl_config.keyEn = 0;
		config.ovl_config.key = 0xFF;	/* color key */
		config.ovl_config.aen = 0;	/* alpha enable */
		config.ovl_config.alpha = 0;
		LCD_LayerSetAddress(FB_LAYER, fbPA);
		LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
		LCD_LayerSetOffset(FB_LAYER, 0, 0);
		LCD_LayerSetSize(FB_LAYER, DISP_GetScreenWidth(), DISP_GetScreenHeight());
		LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(), 32) * 2);
		LCD_LayerEnable(FB_LAYER, TRUE);

		config.dstModule = DISP_MODULE_DPI0;	/* DISP_MODULE_WDMA1 */
		config.outFormat = RDMA_OUTPUT_FORMAT_ARGB;
		disp_path_get_mutex();
		disp_path_config(&config);
		disp_path_release_mutex();

	}
#endif
	init_mipi_pll();
	init_io_pad();
	init_io_driving_current();

	init_lcd();
	init_dpi(isLcmInited);

	if (NULL != lcm_drv->init && !isLcmInited)
		lcm_drv->init();

	DSI_PowerOn();
	DSI_PowerOff();
	UFOE_PowerOn();
	UFOE_PowerOff();
#ifdef SPM_SODI_ENABLED
	spm_sodi_lcm_video_mode(TRUE);
#endif
	return DISP_STATUS_OK;
}