static DISP_STATUS dpi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited) { if (!disp_drv_dpi_init_context()) return DISP_STATUS_NOT_IMPLEMENTED; init_intermediate_buffers(fbPA); 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(); return DISP_STATUS_OK; }
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) { init_lcd(); init_dsi(isLcmInited); if (NULL != lcm_drv->init && !isLcmInited) { lcm_drv->init(); } DSI_clk_HS_mode(0); DSI_SetMode(lcm_params->dsi.mode); DPI_PowerOn(); DPI_PowerOff(); init_lcd_te_control(); } else { #ifndef BUILD_UBOOT spin_lock(&g_handle_esd_lock); #endif init_intermediate_buffers(fbPA); init_lcd(); init_dpi(isLcmInited); init_dsi(isLcmInited); if (NULL != lcm_drv->init && !isLcmInited) { lcm_drv->init(); } DSI_SetMode(lcm_params->dsi.mode); #ifndef BUILD_UBOOT if(lcm_params->dsi.lcm_ext_te_monitor) { dsi_vdo_streaming = 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); spin_unlock(&g_handle_esd_lock); #endif } return DISP_STATUS_OK; }
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; }
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; memset(&config, 0x0, sizeof(config)); config.srcModule = DISP_MODULE_OVL; if(config.srcModule == DISP_MODULE_RDMA) { config.inFormat = RDMA_INPUT_FORMAT_RGB565; config.addr = fbPA; config.pitch = ALIGN_TO(DISP_GetScreenWidth()*2, MTK_FB_ALIGNMENT); config.srcROI.x = 0;config.srcROI.y = 0; config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth(); } else { 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 1 config.ovl_config.layer = 2; 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.x = 0; // ROI config.ovl_config.y = 0; config.ovl_config.w = DISP_GetScreenWidth(); config.ovl_config.h = DISP_GetScreenHeight(); config.ovl_config.pitch = ALIGN_TO(DISP_GetScreenWidth()*2, MTK_FB_ALIGNMENT); config.ovl_config.keyEn = 0; config.ovl_config.key = 0xff; // color key config.ovl_config.aen = 0; // alpha enable config.ovl_config.alpha = 0; #endif } config.dstModule = DISP_MODULE_DPI0;// DISP_MODULE_WDMA1 if(config.dstModule == DISP_MODULE_DPI0) config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; else config.outFormat = WDMA_OUTPUT_FORMAT_ARGB; disp_path_get_mutex(); disp_path_config(&config); disp_path_release_mutex(); disp_bls_config(); } #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(); return DISP_STATUS_OK; }
int main(){ init_dpi(); my_pcap(); term_dpi(); return 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 init_mipi_pll(); init_io_pad(); init_io_driving_current(); printf("%s, %d\n", __func__, __LINE__); init_lcd(); // must initialize lcm before dpi enable if (NULL != lcm_drv->init && !isLcmInited) { lcm_drv->init(); } init_dpi(isLcmInited); printf("%s, %d\n", __func__, __LINE__); { struct disp_path_config_struct config = {0}; printf("%s, %d\n", __func__, __LINE__); config.srcModule = DISP_MODULE_OVL; if(config.srcModule == DISP_MODULE_RDMA0) { config.inFormat = RDMA_INPUT_FORMAT_RGB565; config.addr = fbPA; config.pitch = DISP_GetScreenWidth()*2; config.srcROI.x = 0;config.srcROI.y = 0; config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth(); } else { 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.ovl_config.layer = 2; 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.x = 0; // ROI config.ovl_config.y = 0; config.ovl_config.w = DISP_GetScreenWidth(); config.ovl_config.h = DISP_GetScreenHeight(); config.ovl_config.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; } } config.dstModule = DISP_MODULE_DPI0;// DISP_MODULE_WDMA1 if(config.dstModule == DISP_MODULE_DPI0) config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; else config.outFormat = WDMA_OUTPUT_FORMAT_ARGB; disp_path_get_mutex(); disp_path_config(&config); disp_bls_init(DISP_GetScreenWidth(), DISP_GetScreenHeight()); printf("%s, %d\n", __func__, __LINE__); disp_path_release_mutex(); } #endif return DISP_STATUS_OK; }
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; }
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 } dsi_config_ddp(fbPA); printk("%s, config done\n", __func__); return DISP_STATUS_OK; }
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}; 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; // Disable FB layer (Layer3) { 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(); } // Disable LK UI layer (Layer2) { 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(); } #if 1 // defined(MTK_M4U_SUPPORT) // 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); } // Reconfig FB_Layer and enable it. #endif 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_DPI0;// DISP_MODULE_WDMA1 config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; disp_path_get_mutex(); disp_path_config(&config); disp_bls_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(); } return DISP_STATUS_OK; }
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; }
int main(int argc, char *argv[]) { format = sstrdup("%s"); char *socket_path = NULL; char *pattern = sstrdup("pango:monospace 8"); int o, option_index = 0; static struct option long_options[] = { {"socket", required_argument, 0, 's'}, {"version", no_argument, 0, 'v'}, {"limit", required_argument, 0, 'l'}, {"prompt", required_argument, 0, 'P'}, {"prefix", required_argument, 0, 'p'}, {"format", required_argument, 0, 'F'}, {"font", required_argument, 0, 'f'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; char *options_string = "s:p:P:f:l:F:vh"; while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) { switch (o) { case 's': FREE(socket_path); socket_path = sstrdup(optarg); break; case 'v': printf("i3-input " I3_VERSION); return 0; case 'p': /* This option is deprecated, but will still work in i3 v4.1, 4.2 and 4.3 */ fprintf(stderr, "i3-input: WARNING: the -p option is DEPRECATED in favor of the -F (format) option\n"); FREE(format); sasprintf(&format, "%s%%s", optarg); break; case 'l': limit = atoi(optarg); break; case 'P': i3string_free(prompt); prompt = i3string_from_utf8(optarg); break; case 'f': FREE(pattern); pattern = sstrdup(optarg); break; case 'F': FREE(format); format = sstrdup(optarg); break; case 'h': printf("i3-input " I3_VERSION "\n"); printf("i3-input [-s <socket>] [-F <format>] [-l <limit>] [-P <prompt>] [-f <font>] [-v]\n"); printf("\n"); printf("Example:\n"); printf(" i3-input -F 'workspace \"%%s\"' -P 'Switch to workspace: '\n"); return 0; } } printf("using format \"%s\"\n", format); int screen; conn = xcb_connect(NULL, &screen); if (!conn || xcb_connection_has_error(conn)) die("Cannot open display\n"); sockfd = ipc_connect(socket_path); root_screen = xcb_aux_get_screen(conn, screen); root = root_screen->root; symbols = xcb_key_symbols_alloc(conn); init_dpi(); font = load_font(pattern, true); set_font(&font); if (prompt != NULL) prompt_offset = predict_text_width(prompt); const xcb_rectangle_t win_pos = get_window_position(); /* Open an input window */ win = xcb_generate_id(conn); xcb_create_window( conn, XCB_COPY_FROM_PARENT, win, /* the window id */ root, /* parent == root */ win_pos.x, win_pos.y, win_pos.width, win_pos.height, /* dimensions */ 0, /* X11 border = 0, we draw our own */ XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */ XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK, (uint32_t[]){ 0, /* back pixel: black */ 1, /* override redirect: don’t manage this window */ XCB_EVENT_MASK_EXPOSURE}); /* Map the window (make it visible) */ xcb_map_window(conn, win); /* Initialize the drawable surface */ draw_util_surface_init(conn, &surface, win, get_visualtype(root_screen), win_pos.width, win_pos.height); /* Grab the keyboard to get all input */ xcb_flush(conn); /* Try (repeatedly, if necessary) to grab the keyboard. We might not * get the keyboard at the first attempt because of the keybinding * still being active when started via a wm’s keybinding. */ xcb_grab_keyboard_cookie_t cookie; xcb_grab_keyboard_reply_t *reply = NULL; int count = 0; while ((reply == NULL || reply->status != XCB_GRAB_STATUS_SUCCESS) && (count++ < 500)) { cookie = xcb_grab_keyboard(conn, false, win, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); reply = xcb_grab_keyboard_reply(conn, cookie, NULL); usleep(1000); } if (reply->status != XCB_GRAB_STATUS_SUCCESS) { fprintf(stderr, "Could not grab keyboard, status = %d\n", reply->status); exit(-1); } xcb_flush(conn); xcb_generic_event_t *event; while ((event = xcb_wait_for_event(conn)) != NULL) { if (event->response_type == 0) { fprintf(stderr, "X11 Error received! sequence %x\n", event->sequence); continue; } /* Strip off the highest bit (set if the event is generated) */ int type = (event->response_type & 0x7F); switch (type) { case XCB_KEY_PRESS: handle_key_press(NULL, conn, (xcb_key_press_event_t *)event); break; case XCB_KEY_RELEASE: handle_key_release(NULL, conn, (xcb_key_release_event_t *)event); break; case XCB_EXPOSE: if (((xcb_expose_event_t *)event)->count == 0) { handle_expose(NULL, conn, (xcb_expose_event_t *)event); } break; } free(event); } draw_util_surface_free(conn, &surface); return 0; }