__s32 BSP_disp_close(void) { __u32 sel = 0; if (!disp_initialised) return DIS_SUCCESS; for (sel = 0; sel < 2; sel++) { Image_close(sel); if (gdisp.scaler[sel].status & SCALER_USED) Scaler_close(sel); if (gdisp.screen[sel].lcdc_status & LCDC_TCON0_USED) { TCON0_close(sel); LCDC_close(sel); } else if (gdisp.screen[sel].lcdc_status & LCDC_TCON1_USED) { TCON1_close(sel); LCDC_close(sel); } else if (gdisp.screen[sel].status & (TV_ON | VGA_ON)) { TVE_close(sel); } } for (sel = 0; sel < 2; sel++) { gdisp.screen[sel].status &= ~(IMAGE_USED | LCD_ON | TV_ON | VGA_ON | HDMI_ON); gdisp.screen[sel].lcdc_status &= ~(LCDC_TCON0_USED & LCDC_TCON1_USED); } return DIS_SUCCESS; }
__s32 BSP_disp_close(void) { __u32 sel = 0; for(sel = 0; sel<2; sel++) { Image_close(sel); if(gdisp.scaler[sel].status & SCALER_USED) { Scaler_close(sel); } if(gdisp.screen[sel].lcdc_status & LCDC_TCON0_USED) { TCON0_close(sel); LCDC_close(sel); } else if(gdisp.screen[sel].lcdc_status & LCDC_TCON1_USED) { TCON1_close(sel); LCDC_close(sel); } else if(gdisp.screen[sel].status & (TV_ON | VGA_ON)) { TVE_close(sel); } } gdisp.screen[sel].status &= (IMAGE_USED_MASK & LCD_OFF & TV_OFF & VGA_OFF & HDMI_OFF); gdisp.screen[sel].lcdc_status &= (LCDC_TCON0_USED_MASK & LCDC_TCON1_USED_MASK); return DIS_SUCCESS; }
__s32 BSP_disp_hdmi_close(__u32 sel) { if(gdisp.screen[sel].status & HDMI_ON) { if(gdisp.init_para.Hdmi_close) { gdisp.init_para.Hdmi_close(); } else { DE_WRN("Hdmi_close is NULL\n"); return -1; } Image_close(sel); TCON1_close(sel); image_clk_off(sel); lcdc_clk_off(sel); hdmi_clk_off(); gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[sel].status &= HDMI_OFF; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); Disp_set_out_interlace(sel); } return DIS_SUCCESS; }
void TCON_close(__u32 sel) { if(gpanel_info[sel].tcon_index == 0) { TCON0_close(sel); gdisp.screen[sel].lcdc_status &= LCDC_TCON0_USED_MASK; } else { TCON1_close(sel); gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; } }
void TCON_close(__u32 sel) { if (gpanel_info[sel].lcd_if == 3) LCD_LVDS_close(sel); if (gpanel_info[sel].tcon_index == 0) { TCON0_close(sel); gdisp.screen[sel].lcdc_status &= ~LCDC_TCON0_USED; } else { TCON1_close(sel); gdisp.screen[sel].lcdc_status &= ~LCDC_TCON1_USED; } }
__s32 BSP_disp_tv_close(__u32 sel) { if(gdisp.screen[sel].status & TV_ON) { Image_close(sel); TCON1_close(sel); Disp_TVEC_Close(sel); tve_clk_off(sel); image_clk_off(sel); lcdc_clk_off(sel); #ifdef __LINUX_OSAL__ { user_gpio_set_t gpio_info[1]; __hdle gpio_pa_shutdown; __s32 ret; memset(gpio_info, 0, sizeof(user_gpio_set_t)); ret = OSAL_Script_FetchParser_Data("audio_para","audio_pa_ctrl", (int *)gpio_info, sizeof(user_gpio_set_t)/sizeof(int)); if(ret < 0) { DE_WRN("fetch script data audio_para.audio_pa_ctrl fail\n"); } else { gpio_pa_shutdown = OSAL_GPIO_Request(gpio_info, 1); if(!gpio_pa_shutdown) { DE_WRN("audio codec_wakeup request gpio fail!\n"); } else { OSAL_GPIO_DevWRITE_ONEPIN_DATA(gpio_pa_shutdown, 1, "audio_pa_ctrl"); } } } #endif gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].status &= TV_OFF; gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); Disp_set_out_interlace(sel); } return DIS_SUCCESS; }
__s32 LCDC_init(__u32 sel) { TCON0_close(sel); TCON1_close(sel); LCDC_enable_int(sel, LCDC_VBI_LCD_EN); LCDC_enable_int(sel, LCDC_VBI_HD_EN); LCDC_enable_int(sel, LCDC_LTI_LCD_EN); LCDC_enable_int(sel, LCDC_LTI_HD_EN); TCON0_select_src(sel, LCDC_SRC_DE1); TCON1_select_src(sel, LCDC_SRC_DE1); LCDC_open(sel); return 0; }
__s32 BSP_disp_tv_close(__u32 sel) { if(gdisp.screen[sel].status & TV_ON) { TCON1_close(sel); Disp_TVEC_Close(); tve_clk_off(); image_clk_off(sel); lcdc_clk_off(sel); gdisp.screen[sel].status &= TV_OFF; gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); } return DIS_SUCCESS; }
__s32 BSP_disp_vga_close(__u32 sel) { if(gdisp.screen[sel].status & VGA_ON) { Image_close(sel); TCON1_close(sel); Disp_TVEC_Close(sel); tve_clk_off(sel); image_clk_off(sel); lcdc_clk_off(sel); Disp_lcdc_pin_cfg(sel, DISP_OUTPUT_TYPE_VGA, 0); gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].status &= VGA_OFF; gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); } return DIS_SUCCESS; }
__s32 BSP_disp_hdmi_close(__u32 sel) { if(gdisp.screen[sel].status & HDMI_ON) { __u32 scaler_index; if(gdisp.init_para.Hdmi_close) { gdisp.init_para.Hdmi_close(); } else { DE_WRN("Hdmi_close is NULL\n"); return -1; } Image_close(sel); TCON1_close(sel); image_clk_off(sel); lcdc_clk_off(sel); hdmi_clk_off(); DE_BE_Set_Outitl_enable(sel, FALSE); for(scaler_index=0; scaler_index<2; scaler_index++) { if((gdisp.scaler[scaler_index].status & SCALER_USED) && (gdisp.scaler[scaler_index].screen_index == sel)) { Scaler_Set_Outitl(scaler_index, FALSE); } } gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[sel].status &= HDMI_OFF; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); } return DIS_SUCCESS; }
__s32 BSP_disp_tv_close(__u32 sel) { if (gdisp.screen[sel].status & TV_ON) { Image_close(sel); TCON1_close(sel); Disp_TVEC_Close(sel); tve_clk_off(sel); image_clk_off(sel); lcdc_clk_off(sel); if (sunxi_is_sun5i()) { int scaler_index; Disp_de_flicker_enable(sel, 2); /* must close immediately, because vbi may not come */ DE_BE_Set_Outitl_enable(sel, FALSE); for (scaler_index = 0; scaler_index < 2; scaler_index++) if ((gdisp.scaler[scaler_index].status & SCALER_USED) && (gdisp.scaler[scaler_index].screen_index == sel)) Scaler_Set_Outitl(scaler_index, FALSE); } { user_gpio_set_t gpio_info[1]; __hdle gpio_pa_shutdown; __s32 ret; memset(gpio_info, 0, sizeof(user_gpio_set_t)); ret = script_parser_fetch("audio_para", "audio_pa_ctrl", (int *)gpio_info, sizeof(user_gpio_set_t) / sizeof(int)); if (ret < 0) { DE_WRN("fetch script data " "audio_para.audio_pa_ctrl fail\n"); } else { gpio_pa_shutdown = OSAL_GPIO_Request(gpio_info, 1); if (!gpio_pa_shutdown) { DE_WRN("audio codec_wakeup request " "gpio fail!\n"); } else { OSAL_GPIO_DevWRITE_ONEPIN_DATA (gpio_pa_shutdown, 1, "audio_pa_ctrl"); } } } gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].status &= ~TV_ON; gdisp.screen[sel].lcdc_status &= ~LCDC_TCON1_USED; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[sel].pll_use_status &= ((gdisp.screen[sel].pll_use_status == VIDEO_PLL0_USED) ? ~VIDEO_PLL0_USED : ~VIDEO_PLL1_USED); Disp_set_out_interlace(sel); } return DIS_SUCCESS; }