__s32 BSP_disp_hdmi_open(__u32 sel) { if(!(gdisp.screen[sel].status & HDMI_ON)) { __disp_tv_mode_t tv_mod; __u32 scaler_index; tv_mod = gdisp.screen[sel].hdmi_mode; hdmi_clk_on(); lcdc_clk_on(sel); image_clk_on(sel); Image_open(sel);//set image normal channel start bit , because every de_clk_off( )will reset this bit disp_clk_cfg(sel,DISP_OUTPUT_TYPE_HDMI, tv_mod); BSP_disp_set_output_csc(sel, DISP_OUTPUT_TYPE_HDMI); DE_BE_set_display_size(sel, tv_mode_to_width(tv_mod), tv_mode_to_height(tv_mod)); DE_BE_Output_Select(sel, sel); DE_BE_Set_Outitl_enable(sel, Disp_get_screen_scan_mode(tv_mod)); for(scaler_index=0; scaler_index<2; scaler_index++) { if((gdisp.scaler[scaler_index].status & SCALER_USED) && (gdisp.scaler[scaler_index].screen_index == sel)) { if(Disp_get_screen_scan_mode(tv_mod) == 1)//interlace output { Scaler_Set_Outitl(scaler_index, TRUE); } else { Scaler_Set_Outitl(scaler_index, FALSE); } } } TCON1_set_hdmi_mode(sel,tv_mod); TCON1_open(sel); if(gdisp.init_para.Hdmi_open) { gdisp.init_para.Hdmi_open(); } else { DE_WRN("Hdmi_open is NULL\n"); return -1; } Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_HDMI, tv_mod); gdisp.screen[sel].b_out_interlace = Disp_get_screen_scan_mode(tv_mod); gdisp.screen[sel].status |= HDMI_ON; gdisp.screen[sel].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_HDMI; #ifdef __LINUX_OSAL__ Display_set_fb_timming(sel); #endif } return DIS_SUCCESS; }
__s32 disp_hdmi_init(void) { __s32 ret; __u32 value; __u32 num_screens; __u32 screen_id; num_screens = bsp_disp_feat_get_num_screens(); ret = OSAL_Script_FetchParser_Data("hdmi_para", "hdmi_used", (int *)&value, 1); if(ret == 0) { if(value) { ret = OSAL_Script_FetchParser_Data("hdmi_para", "hdmi_cts_compatibility", (int *)&value, 1); if(ret < 0) { DE_INF("disp_init.hdmi_cts_compatibility not exist\n"); } else { DE_INF("disp_init.hdmi_cts_compatibility = %d\n", value); gdisp.init_para.hdmi_cts_compatibility = value; } hdmi_clk_init(); hdmi_clk_on(); } for(screen_id=0; screen_id<num_screens; screen_id++) { gdisp.screen[screen_id].hdmi_mode = DISP_TV_MOD_720P_50HZ; gdisp.screen[screen_id].hdmi_test_mode = 0xff; gdisp.screen[screen_id].hdmi_used = value; } } return DIS_SUCCESS; }
__s32 hdmi_clk_init(void) { h_hdmiahbclk = OSAL_CCMU_OpenMclk(AW_MOD_CLK_AHB_HDMI); h_hdmimclk = OSAL_CCMU_OpenMclk(AW_MOD_CLK_HDMI); #ifdef RESET_OSAL OSAL_CCMU_MclkReset(h_hdmimclk, RST_INVAILD); #endif OSAL_CCMU_SetMclkSrc(h_hdmimclk, AW_SYS_CLK_PLL7); OSAL_CCMU_SetMclkDiv(h_hdmimclk, 1); OSAL_CCMU_MclkOnOff(h_hdmiahbclk, CLK_ON); g_clk_status |= CLK_HDMI_AHB_ON; hdmi_clk_on(); return DIS_SUCCESS; }
__s32 bsp_disp_hdmi_open(__u32 screen_id) { if(disp_hdmi_get_support(screen_id) && (gdisp.screen[screen_id].hdmi_used) && (!(gdisp.screen[screen_id].status & HDMI_ON))) { __disp_tv_mode_t tv_mod; tv_mod = gdisp.screen[screen_id].hdmi_mode; hdmi_clk_on(); lcdc_clk_on(screen_id, 1, 0); lcdc_clk_on(screen_id, 1, 1); drc_clk_open(screen_id,0); drc_clk_open(screen_id,1); tcon_init(screen_id); image_clk_on(screen_id, 1); /* set image normal channel start bit , because every de_clk_off( )will reset this bit */ Image_open(screen_id); disp_clk_cfg(screen_id,DISP_OUTPUT_TYPE_HDMI, tv_mod); //bsp_disp_set_output_csc(screen_id, DISP_OUTPUT_TYPE_HDMI, gdisp.screen[screen_id].iep_status&DRC_USED); if(gdisp.init_para.hdmi_cts_compatibility == 0) { DE_INF("bsp_disp_hdmi_open: disable dvi mode\n"); bsp_disp_hdmi_dvi_enable(screen_id, 0); } else if(gdisp.init_para.hdmi_cts_compatibility == 1) { DE_INF("bsp_disp_hdmi_open: enable dvi mode\n"); bsp_disp_hdmi_dvi_enable(screen_id, 1); } else { bsp_disp_hdmi_dvi_enable(screen_id, bsp_disp_hdmi_dvi_support(screen_id)); } if(BSP_dsip_hdmi_get_input_csc(screen_id) == 0) { __inf("bsp_disp_hdmi_open: hdmi output rgb\n"); gdisp.screen[screen_id].output_csc_type = DISP_OUT_CSC_TYPE_HDMI_RGB; bsp_disp_set_output_csc(screen_id, gdisp.screen[screen_id].output_csc_type, bsp_disp_drc_get_input_csc(screen_id)); } else { __inf("bsp_disp_hdmi_open: hdmi output yuv\n"); gdisp.screen[screen_id].output_csc_type = DISP_OUT_CSC_TYPE_HDMI_YUV;//default yuv bsp_disp_set_output_csc(screen_id, gdisp.screen[screen_id].output_csc_type, bsp_disp_drc_get_input_csc(screen_id)); } DE_BE_set_display_size(screen_id, tv_mode_to_width(tv_mod), tv_mode_to_height(tv_mod)); DE_BE_Output_Select(screen_id, screen_id); bsp_disp_hdmi_set_src(screen_id, DISP_LCDC_SRC_DE_CH1); tcon1_set_hdmi_mode(screen_id,tv_mod); tcon1_open(screen_id); if(gdisp.init_para.hdmi_open) { gdisp.init_para.hdmi_open(); } else { DE_WRN("Hdmi_open is NULL\n"); return -1; } Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_HDMI, tv_mod); gdisp.screen[screen_id].b_out_interlace = disp_get_screen_scan_mode(tv_mod); gdisp.screen[screen_id].status |= HDMI_ON; gdisp.screen[screen_id].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[screen_id].output_type = DISP_OUTPUT_TYPE_HDMI; if(bsp_disp_cmu_get_enable(screen_id) ==1) { IEP_CMU_Set_Imgsize(screen_id, bsp_disp_get_screen_width(screen_id), bsp_disp_get_screen_height(screen_id)); } Disp_set_out_interlace(screen_id); #ifdef __LINUX_OSAL__ Display_set_fb_timming(screen_id); #endif return DIS_SUCCESS; } return DIS_NOT_SUPPORT; }
__s32 BSP_disp_hdmi_open(__u32 sel) { if(!(gdisp.screen[sel].status & HDMI_ON)) { __disp_tv_mode_t tv_mod; tv_mod = gdisp.screen[sel].hdmi_mode; BSP_disp_hdmi_get_hdcp_enable(); hdmi_clk_on(); if(gdisp.screen[sel].hdmi_hdcp_en) hdcp_clk_init(tv_mod); lcdc_clk_on(sel, 1, 0); lcdc_clk_on(sel, 1, 1); Disp_lcdc_reg_isr(sel); LCDC_init(sel); image_clk_on(sel, 0); image_clk_on(sel, 1); Image_open(sel);//set image normal channel start bit , because every de_clk_off( )will reset this bit DE_BE_EnableINT(sel, DE_IMG_REG_LOAD_FINISH); disp_clk_cfg(sel,DISP_OUTPUT_TYPE_HDMI, tv_mod); if(gdisp.init_para.hdmi_cts_compatibility == 0) { DE_INF("BSP_disp_hdmi_open: disable dvi mode\n"); BSP_disp_hdmi_dvi_enable(sel, 0); } else if(gdisp.init_para.hdmi_cts_compatibility == 1) { DE_INF("BSP_disp_hdmi_open: enable dvi mode\n"); BSP_disp_hdmi_dvi_enable(sel, 1); } else { BSP_disp_hdmi_dvi_enable(sel, BSP_disp_hdmi_dvi_support(sel)); } if(BSP_dsip_hdmi_get_input_csc(sel) == 0) { __inf("BSP_disp_hdmi_open: hdmi output rgb\n"); gdisp.screen[sel].output_csc_type = DISP_OUT_CSC_TYPE_HDMI_RGB; BSP_disp_set_output_csc(sel, gdisp.screen[sel].output_csc_type); }else { __inf("BSP_disp_hdmi_open: hdmi output yuv\n"); gdisp.screen[sel].output_csc_type = DISP_OUT_CSC_TYPE_HDMI_YUV;//default yuv BSP_disp_set_output_csc(sel, gdisp.screen[sel].output_csc_type); } DE_BE_set_display_size(sel, tv_mode_to_width(tv_mod), tv_mode_to_height(tv_mod)); DE_BE_Output_Select(sel, sel); tcon1_set_hdmi_mode(sel,tv_mod); tcon1_open(sel); if(gdisp.init_para.hdmi_open) { gdisp.init_para.hdmi_open(); } else { DE_WRN("hdmi_open is NULL\n"); return -1; } Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_HDMI, tv_mod); gdisp.screen[sel].b_out_interlace = Disp_get_screen_scan_mode(tv_mod); gdisp.screen[sel].status |= HDMI_ON; gdisp.screen[sel].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_HDMI; Disp_set_out_interlace(sel); #ifdef __LINUX_OSAL__ Display_set_fb_timming(sel); #endif } return DIS_SUCCESS; }