__s32 BSP_disp_tv_close(__u32 sel) { if((gdisp.screen[sel].status & TV_ON)) { tcon0_src_select(sel,4); //msleep(100); tcon0_close(sel); Image_close(sel); image_clk_off(sel, 1); lcdc_clk_off(sel); drc_clk_close(sel,0); if(gdisp.screen[sel].tv_ops.tv_close) { gdisp.screen[sel].tv_ops.tv_close(); } disp_tv_pin_cfg(0); if(gdisp.screen[sel].tv_ops.tv_power_on) { gdisp.screen[sel].tv_ops.tv_power_on(0); } gdisp.screen[sel].b_out_interlace = 0; gdisp.screen[sel].status &= TV_OFF; gdisp.screen[sel].lcdc_status &= LCDC_TCON0_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); msleep(900); } return DIS_SUCCESS; }
__s32 bsp_disp_hdmi_close(__u32 screen_id) { if(disp_hdmi_get_support(screen_id) && (gdisp.screen[screen_id].hdmi_used) && (gdisp.screen[screen_id].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(screen_id); tcon1_close(screen_id); image_clk_off(screen_id, 1); lcdc_clk_off(screen_id); drc_clk_close(screen_id,0); drc_clk_close(screen_id,1); hdmi_clk_off(); gdisp.screen[screen_id].b_out_interlace = 0; gdisp.screen[screen_id].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[screen_id].status &= HDMI_OFF; gdisp.screen[screen_id].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[screen_id].pll_use_status &= ((gdisp.screen[screen_id].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); Disp_set_out_interlace(screen_id); return DIS_SUCCESS; } return DIS_NOT_SUPPORT; }
__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; }
__s32 Disp_lcdc_init(__u32 sel) { lcdc_clk_init(sel); lcdc_clk_on(sel); //??need to be open LCDC_init(sel); lcdc_clk_off(sel); Disp_pwm_cfg(sel); if(sel == 0) { LCD_get_panel_funs_0(&lcd_panel_fun[sel]); OSAL_RegISR(INTC_IRQNO_LCDC0,0,Disp_lcdc_event_proc,(void*)sel,0,0); //OSAL_InterruptEnable(INTC_IRQNO_LCDC0); } else { LCD_get_panel_funs_1(&lcd_panel_fun[sel]); OSAL_RegISR(INTC_IRQNO_LCDC1,0,Disp_lcdc_event_proc,(void*)sel,0,0); //OSAL_InterruptEnable(INTC_IRQNO_LCDC1); } lcd_panel_fun[sel].cfg_panel_info(&gpanel_info[sel]); return DIS_SUCCESS; }
__s32 BSP_disp_hdmi_close(__u32 sel) { if(gdisp.screen[sel].status & HDMI_ON) { __u32 count = 50000; hdmi_request_close_flag = 1; // 1:request close,0:need not to close. while((count--) && hdmi_request_close_flag) udelay(1); if(hdmi_request_close_flag || count <= 0) { if(gdisp.init_para.hdmi_close){ gdisp.init_para.hdmi_close(); } DE_INF("hdmi wait vb_int timeout\n"); } tcon1_close(sel); image_clk_off(sel, 1); 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; }
__s32 bsp_disp_tv_close(__u32 screen_id) { if(gdisp.screen[screen_id].status & TV_ON) { Image_close(screen_id); tcon1_close(screen_id); Disp_TVEC_Close(screen_id); tve_clk_off(screen_id); image_clk_off(screen_id, 1); lcdc_clk_off(screen_id); #if (defined CONFIG_ARCH_SUN5I) __u32 scaler_index = 0; //disp_de_flicker_enable(screen_id, 2); //must close immediately, because vbi may not come DE_BE_Set_Outitl_enable(screen_id, FALSE); for(scaler_index=0; scaler_index<2; scaler_index++) { if((gdisp.scaler[scaler_index].status & SCALER_USED) && (gdisp.scaler[scaler_index].screen_index == screen_id)) { Scaler_Set_Outitl(scaler_index, FALSE); } } #endif #ifdef __LINUX_OSAL__ { disp_gpio_set_t gpio_info[1]; __hdle gpio_pa_shutdown; __s32 ret; memset(gpio_info, 0, sizeof(disp_gpio_set_t)); ret = OSAL_Script_FetchParser_Data("audio_para","audio_pa_ctrl", (int *)gpio_info, sizeof(disp_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[screen_id].b_out_interlace = 0; gdisp.screen[screen_id].status &= TV_OFF; gdisp.screen[screen_id].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[screen_id].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[screen_id].pll_use_status &= ((gdisp.screen[screen_id].pll_use_status == VIDEO_PLL0_USED)? VIDEO_PLL0_USED_MASK : VIDEO_PLL1_USED_MASK); Disp_set_out_interlace(screen_id); } return DIS_SUCCESS; }
__s32 BSP_disp_lcd_close_after(__u32 sel) { image_clk_off(sel); lcdc_clk_off(sel); gdisp.screen[sel].status &= LCD_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_lcd_close_after(__u32 sel) { Image_close(sel); Disp_lcdc_pin_cfg(sel, DISP_OUTPUT_TYPE_LCD, 0); image_clk_off(sel); lcdc_clk_off(sel); 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 Disp_lcdc_init(__u32 sel) { irqreturn_t ret; LCD_get_sys_config(sel, &(gdisp.screen[sel].lcd_cfg)); lcdc_clk_init(sel); lvds_clk_init(); lcdc_clk_on(sel); /* ??need to be open */ LCDC_init(sel); lcdc_clk_off(sel); if (sel == 0) ret = request_irq(INTC_IRQNO_LCDC0, Disp_lcdc_event_proc, IRQF_DISABLED, "sunxi lcd0", (void *)sel); else ret = request_irq(INTC_IRQNO_LCDC1, Disp_lcdc_event_proc, IRQF_DISABLED, "sunxi lcd1", (void *)sel); if (gdisp.screen[sel].lcd_cfg.lcd_used) { if (lcd_panel_fun[sel].cfg_panel_info) lcd_panel_fun[sel].cfg_panel_info(&gpanel_info[sel]); else LCD_get_panel_para(sel, &gpanel_info[sel]); gpanel_info[sel].tcon_index = 0; if (!sunxi_is_version_A() && (gpanel_info[sel].lcd_pwm_not_used == 0)) { __pwm_info_t pwm_info; pwm_info.enable = 0; pwm_info.active_state = 1; pwm_info.period_ns = 1000000 / gpanel_info[sel].lcd_pwm_freq; if (gpanel_info[sel].lcd_pwm_pol == 0) pwm_info.duty_ns = (gdisp.screen[sel].lcd_cfg.init_bright * pwm_info.period_ns) / 256; else pwm_info.duty_ns = ((256 - gdisp.screen[sel].lcd_cfg.init_bright) * pwm_info.period_ns) / 256; pwm_set_para(gpanel_info[sel].lcd_pwm_ch, &pwm_info); } LCD_GPIO_init(sel); } 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); #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 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 screen_id) { if(gdisp.screen[screen_id].status & VGA_ON) { Image_close(screen_id); tcon1_close(screen_id); Disp_TVEC_Close(screen_id); tve_clk_off(screen_id); image_clk_off(screen_id, 1); lcdc_clk_off(screen_id); gdisp.screen[screen_id].b_out_interlace = 0; gdisp.screen[screen_id].status &= VGA_OFF; gdisp.screen[screen_id].lcdc_status &= LCDC_TCON1_USED_MASK; gdisp.screen[screen_id].output_type = DISP_OUTPUT_TYPE_NONE; gdisp.screen[screen_id].pll_use_status &= ((gdisp.screen[screen_id].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_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_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); } 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; }
__s32 Disp_lcdc_init(__u32 sel) { LCD_get_sys_config(sel, &(gdisp.screen[sel].lcd_cfg)); lcdc_clk_init(sel); lvds_clk_init(); lcdc_clk_on(sel); //??need to be open LCDC_init(sel); lcdc_clk_off(sel); if(sel == 0) { OSAL_RegISR(INTC_IRQNO_LCDC0,0,Disp_lcdc_event_proc,(void*)sel,0,0); #ifndef __LINUX_OSAL__ OSAL_InterruptEnable(INTC_IRQNO_LCDC0); LCD_get_panel_funs_0(&lcd_panel_fun[sel]); #endif } else { OSAL_RegISR(INTC_IRQNO_LCDC1,0,Disp_lcdc_event_proc,(void*)sel,0,0); #ifndef __LINUX_OSAL__ OSAL_InterruptEnable(INTC_IRQNO_LCDC1); LCD_get_panel_funs_1(&lcd_panel_fun[sel]); #endif } if(gdisp.screen[sel].lcd_cfg.lcd_used) { if(lcd_panel_fun[sel].cfg_panel_info) { lcd_panel_fun[sel].cfg_panel_info(&gpanel_info[sel]); } else { LCD_get_panel_para(sel, &gpanel_info[sel]); } gpanel_info[sel].tcon_index = 0; if((OSAL_sw_get_ic_ver() != 0xA) && (gpanel_info[sel].lcd_pwm_not_used == 0)) { __pwm_info_t pwm_info; pwm_info.enable = 0; pwm_info.active_state = 1; pwm_info.period_ns = 1000000 / gpanel_info[sel].lcd_pwm_freq; if(gpanel_info[sel].lcd_pwm_pol == 0) { pwm_info.duty_ns = (192 * pwm_info.period_ns) / 256; } else { pwm_info.duty_ns = ((256 - 192) * pwm_info.period_ns) / 256; } pwm_set_para(gpanel_info[sel].lcd_pwm_ch, &pwm_info); } LCD_GPIO_init(sel); } return DIS_SUCCESS; }