int disp_bls_set_backlight(unsigned int level) { printf("[DDP] disp_bls_set_backlight: %d, CG = 0x%x, BLS_EN = 0x%x, PWM_DUTY = %d\n", level, DISP_REG_GET(DISP_REG_CONFIG_MMSYS_CG_CON0), DISP_REG_GET(DISP_REG_BLS_EN), DISP_REG_GET(DISP_REG_BLS_PWM_DUTY)); if (level && (!(DISP_REG_GET(DISP_REG_BLS_EN) & 0x10000))) { disp_bls_config(); } #ifdef USE_DISP_BLS_MUTEX disp_bls_get_mutex(); #else DISP_REG_SET(DISP_REG_BLS_DEBUG, 0x3); #endif DISP_REG_SET(DISP_REG_BLS_PWM_DUTY, brightness_mapping(level)); printf("[DDP] PWM_DUTY: %x\n", DISP_REG_GET(DISP_REG_BLS_PWM_DUTY)); #ifdef USE_DISP_BLS_MUTEX disp_bls_release_mutex(); #else DISP_REG_SET(DISP_REG_BLS_DEBUG, 0x0); #endif return 0; }
int disp_bls_set_backlight(unsigned int level) { unsigned int mapped_level; DISP_MSG("disp_bls_set_backlight: %d, gBLSPowerOn = %d\n", level, gBLSPowerOn); mutex_lock(&backlight_mutex); if(level && !clock_is_on(MT_CG_PWM_MM_SW_CG)) enable_clock(MT_CG_PWM_MM_SW_CG, "DDP"); if (level && !clock_is_on(MT_CG_MDP_BLS_26M_SW_CG)) { // remove CG control to DDP path ASSERT(0); if (!gBLSPowerOn) { // config BLS parameter disp_bls_config(); } } #ifdef USE_DISP_BLS_MUTEX disp_bls_get_mutex(); #else DISP_REG_SET(DISP_REG_BLS_DEBUG, 0x3); #endif mapped_level = brightness_mapping(level); DISP_MSG("after mapping, mapped_level: %d\n", mapped_level); DISP_REG_SET(DISP_REG_BLS_PWM_DUTY, mapped_level); if (mapped_level) // enable PWM generator DISP_REG_SET(DISP_REG_BLS_EN, DISP_REG_GET(DISP_REG_BLS_EN) | 0x10000); else // disable PWM generator DISP_REG_SET(DISP_REG_BLS_EN, DISP_REG_GET(DISP_REG_BLS_EN) & 0xFFFEFFFF); DISP_MSG("after SET, PWM_DUTY: %d\n", DISP_REG_GET(DISP_REG_BLS_PWM_DUTY)); #ifdef USE_DISP_BLS_MUTEX disp_bls_release_mutex(); #else DISP_REG_SET(DISP_REG_BLS_DEBUG, 0x0); #endif if(!level && clock_is_on(MT_CG_PWM_MM_SW_CG)) disable_clock(MT_CG_PWM_MM_SW_CG, "DDP"); if (!level && gBLSPowerOn) { DISP_MSG("disp_bls_set_backlight: disable clock\n"); // disable_clock(MT_CG_DISP0_SMI_LARB0 , "DDP"); gBLSPowerOn = 0; } mutex_unlock(&backlight_mutex); return 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; }
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; }
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; }
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 #if 1 { struct disp_path_config_struct config = {0}; 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; #if 0 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 = DISP_GetScreenWidth()*2; //pixel number config.ovl_config.keyEn = 1; config.ovl_config.key = 0xFFFFFFFF; // color key config.ovl_config.aen = 0; // alpha enable config.ovl_config.alpha = 0; #endif } config.dstModule = DISP_MODULE_DBI;// DISP_MODULE_WDMA1 if(config.dstModule == DISP_MODULE_DBI) config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; else config.outFormat = WDMA_OUTPUT_FORMAT_ARGB; disp_path_get_mutex(); disp_path_config(&config); 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(); return DISP_STATUS_OK; }