__s32 LCD_PWM_EN(__u32 sel, __bool b_en) { if (gdisp.screen[sel].lcd_cfg.lcd_pwm_used) { user_gpio_set_t gpio_info[1]; __hdle hdl; memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_pwm), sizeof(user_gpio_set_t)); if (!sunxi_is_version_A() && (gpanel_info[sel].lcd_pwm_not_used == 0)) { if (b_en) pwm_enable(gpanel_info[sel].lcd_pwm_ch, b_en); else { gpio_info->mul_sel = 0; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } else { if (b_en != gpanel_info[sel].lcd_pwm_pol) { gpio_info->mul_sel = 1; gpio_info->data = 1; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } else { gpio_info->mul_sel = 1; gpio_info->data = 0; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } } return 0; }
static __s32 disp_tv_pin_cfg(__u32 on_off) { disp_gpio_set_t gpio_info[1]; __hdle lcd_pin_hdl; __u32 i; for(i=3; i<=7; i++) { gpio_info->gpio = GPIOD(0+i); gpio_info->mul_sel = (on_off)?2:7; gpio_info->drv_level = 3; gpio_info->pull = 0; gpio_info->data = 0; lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); } for(i=10; i<=12; i++) { gpio_info->gpio = GPIOD(0+i); gpio_info->mul_sel = (on_off)?2:7; gpio_info->drv_level = 3; gpio_info->pull = 0; gpio_info->data = 0; lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); } gpio_info->gpio = GPIOD(24); //dclk gpio_info->mul_sel = (on_off)?2:7; gpio_info->drv_level = 3; gpio_info->pull = 0; gpio_info->data = 0; lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); gpio_info->gpio = GPIOD(26); //hsync gpio_info->mul_sel = (on_off)?2:7; gpio_info->drv_level = 3; gpio_info->pull = 0; gpio_info->data = 0; lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); gpio_info->gpio = GPIOD(27); //vsync gpio_info->mul_sel = (on_off)?2:7; gpio_info->drv_level = 3; gpio_info->pull = 0; gpio_info->data = 0; lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); return 0; }
__s32 Disp_lcdc_pin_cfg(__u32 sel, __disp_output_type_t out_type, __u32 bon) { if(out_type == DISP_OUTPUT_TYPE_LCD) { __hdle lcd_pin_hdl; int i; for(i=0; i<28; i++) { if(gdisp.screen[sel].lcd_cfg.lcd_io_used[i]) { user_gpio_set_t gpio_info[1]; memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_io[i]), sizeof(user_gpio_set_t)); if(!bon) { gpio_info->mul_sel = 0; } else { if((gpanel_info[sel].lcd_if == 3) && (gpio_info->mul_sel==2)) { gpio_info->mul_sel = 3; } } lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); } } } else if(out_type == DISP_OUTPUT_TYPE_VGA) { __u32 reg_start = 0; __u32 tmp = 0; if(sel == 0) { reg_start = gdisp.init_para.base_pioc+0x6c; } else { reg_start = gdisp.init_para.base_pioc+0xfc; } if(bon) { tmp = sys_get_wvalue(reg_start + 0x0c) & 0xffff00ff; sys_put_wvalue(reg_start + 0x0c,tmp | 0x00002200); } else { tmp = sys_get_wvalue(reg_start + 0x0c) & 0xffff00ff; sys_put_wvalue(reg_start + 0x0c,tmp); } } return DIS_SUCCESS; }
__s32 BSP_disp_close_lcd_backlight(__u32 sel) { user_gpio_set_t gpio_info[1]; __hdle hdl; int value, ret; char primary_key[20]; sprintf(primary_key, "lcd%d_para", sel); value = 1; ret = script_parser_fetch(primary_key, "lcd_bl_en_used", &value, 1); if (value == 0) { DE_INF("%s.lcd_bl_en is not used\n", primary_key); } else { ret = script_parser_fetch(primary_key, "lcd_bl_en", (int *)gpio_info, sizeof(user_gpio_set_t) / sizeof(int)); if (ret < 0) { DE_INF("%s.lcd_bl_en not exist\n", primary_key); } else { gpio_info->data = (gpio_info->data == 0) ? 1 : 0; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } value = 1; ret = script_parser_fetch(primary_key, "lcd_pwm_used", &value, 1); if (value == 0) { DE_INF("%s.lcd_pwm is not used\n", primary_key); } else { ret = script_parser_fetch(primary_key, "lcd_pwm", (int *)gpio_info, sizeof(user_gpio_set_t) / sizeof(int)); if (ret < 0) { DE_INF("%s.lcd_pwm not exist\n", primary_key); } else { gpio_info->mul_sel = 0; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } return 0; }
__s32 pwm_enable(__u32 channel, __bool b_en) { __u32 tmp = 0; __hdle hdl; if(gdisp.screen[channel].lcd_cfg.lcd_pwm_used) { user_gpio_set_t gpio_info[1]; memcpy(gpio_info, &(gdisp.screen[channel].lcd_cfg.lcd_pwm), sizeof(user_gpio_set_t)); if(b_en) { gpio_info->mul_sel = 2; } else { gpio_info->mul_sel = 0; } hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } if(channel == 0) { tmp = pwm_read_reg(0x200); if(b_en) { tmp |= (1<<4); } else { tmp &= (~(1<<4)); } pwm_write_reg(0x200,tmp); } else { tmp = pwm_read_reg(0x200); if(b_en) { tmp |= (1<<19); } else { tmp &= (~(1<<19)); } pwm_write_reg(0x200,tmp); } gdisp.pwm[channel].enable = b_en; return 0; }
__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 LCD_GPIO_init(disp_gpio_set_t gpio_info[6], __bool lcd_gpio_used[6]) { __u32 i = 0; for(i=0; i<6; i++) { gpio_info[i].hdl = 0; if(lcd_gpio_used[i]) { gpio_info[i].hdl = OSAL_GPIO_Request(&gpio_info[i], 1); } } return 0; }
s32 disp_lcd_pin_cfg(struct disp_lcd *lcd, u32 bon) { __hdle lcd_pin_hdl; int i; struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd); if((NULL == lcd) || (NULL == lcdp)) { DE_WRN("NULL hdl!\n"); return DIS_FAIL; } DE_INF("lcd %d pin config, state %s, %d\n", lcd->channel_id, (bon)? "on":"off", bon); #if defined (__FPGA_DEBUG__) if(!bon) { //pd28--pwm, ph0--pwr writel(0x77777777, 0xf6000800+0x6c); writel(0x77777777, 0xf6000800+0x70); writel(0x77777777, 0xf6000800+0x74); writel(0x77727777, 0xf6000800+0x78); writel((readl(0xf6000800+0xfc) & (~0x0000000f)) | 0x00000007, 0xf6000800+0xfc); } else { //pd28--pwm, ph0--pwr writel(0x22222222, 0xf6000800+0x6c); writel(0x22222222, 0xf6000800+0x70); writel(0x22222222, 0xf6000800+0x74); writel(0x77722222, 0xf6000800+0x78); } #endif for(i=0; i<28; i++) { if(lcdp->lcd_cfg.lcd_io_used[i]) { disp_gpio_set_t gpio_info[1]; memcpy(gpio_info, &(lcdp->lcd_cfg.lcd_io[i]), sizeof(disp_gpio_set_t)); if(!bon) { gpio_info->mul_sel = 7; } else { if((lcdp->panel_info.lcd_if == 3) && (gpio_info->mul_sel==2)) { gpio_info->mul_sel = 3; } } lcd_pin_hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(lcd_pin_hdl, 2); } } disp_al_lcd_io_cfg(lcd->channel_id, bon, &lcdp->panel_info); return DIS_SUCCESS; }
static void LCD_vcc_off(__u32 sel) { user_gpio_set_t gpio_list; int hdl; gpio_list.port = 8;// 1:A; 2:B; 3:C;..... gpio_list.port_num = 6; gpio_list.mul_sel = 1; gpio_list.pull = 0; gpio_list.drv_level = 0; gpio_list.data = 0; hdl = OSAL_GPIO_Request(&gpio_list, 1); OSAL_GPIO_Release(hdl, 2); }
__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; }
static void LCD_power_off(__u32 sel) { //pioc8, different from another panel, only can set low to close backlight, can't adjust the luminance __hdle hdl; user_gpio_set_t gpio_set[1]; gpio_set->port = 3; gpio_set->port_num = 8; gpio_set->mul_sel = 1; gpio_set->pull = 1; gpio_set->drv_level = 1; gpio_set->data = 0; hdl = OSAL_GPIO_Request(gpio_set, 1); OSAL_GPIO_Release(hdl, 2); }
__s32 LCD_GPIO_exit(disp_gpio_set_t gpio_info[6]) { __u32 i = 0; for(i=0; i<6; i++) { if(gpio_info[i].hdl) { OSAL_GPIO_Release(gpio_info[i].hdl, 2); gpio_info[i].mul_sel = 7; gpio_info[i].hdl = OSAL_GPIO_Request(&gpio_info[i], 1); OSAL_GPIO_Release(gpio_info[i].hdl, 2); gpio_info[i].hdl = 0; } } return 0; }
__s32 LCD_BL_EN(__u32 sel, __bool b_en) { user_gpio_set_t gpio_info[1]; __hdle hdl; if (gdisp.screen[sel].lcd_cfg.lcd_bl_en_used) { memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_bl_en), sizeof(user_gpio_set_t)); if (!b_en) gpio_info->data = (gpio_info->data == 0) ? 1 : 0; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } return 0; }
/* ********************************************************************************************************* * POWER ON * * Description: * * Arguments : * * Returns : * * Note : ********************************************************************************************************* */ static void LCD_power_on(__u32 sel) { //pioc8, different from another panel, only can set high to open backlight, can't adjust the luminance __hdle hdl; user_gpio_set_t gpio_set[1]; gpio_set->port = 3; gpio_set->port_num = 8; gpio_set->mul_sel = 1; gpio_set->pull = 1; gpio_set->drv_level = 1; gpio_set->data = 1; hdl = OSAL_GPIO_Request(gpio_set, 1); OSAL_GPIO_Release(hdl, 2); //sys_put_wvalue(0xf1c20848, (sys_get_wvalue(0xf1c20848)&0xfff0ffff)|(0x1<<16)); //sys_put_wvalue(0xf1c20858, (sys_get_wvalue(0xf1c20858)&0xffffffef)); }
__s32 LCD_GPIO_cfg(disp_gpio_set_t gpio_info[], __bool used[], __u32 num, __u32 bon) { __hdle hdl; int i; for(i=0; i<num; i++) { if(used[i]) { if(!bon) { gpio_info[i].mul_sel = 7; gpio_info[i].data = 0; } hdl = OSAL_GPIO_Request(&gpio_info[i], 1); OSAL_GPIO_Release(hdl, 2); } } return 0; }
__s32 LCD_GPIO_init(__u32 sel) { __u32 i = 0; for(i=0; i<4; i++) { gdisp.screen[sel].gpio_hdl[i] = 0; if(gdisp.screen[sel].lcd_cfg.lcd_gpio_used[i]) { user_gpio_set_t gpio_info[1]; memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_gpio[i]), sizeof(user_gpio_set_t)); gdisp.screen[sel].gpio_hdl[i] = OSAL_GPIO_Request(gpio_info, 1); } } return 0; }
s32 disp_lcd_power_enable(struct disp_lcd *lcd, u32 power_id) { disp_gpio_set_t gpio_info[1]; __hdle hdl; struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd); if((NULL == lcd) || (NULL == lcdp)) { DE_WRN("NULL hdl!\n"); return DIS_FAIL; } if(disp_lcd_is_used(lcd)) { if(lcdp->lcd_cfg.lcd_power_used) { memcpy(gpio_info, &(lcdp->lcd_cfg.lcd_power[power_id]), sizeof(disp_gpio_set_t)); hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } return 0; }
s32 disp_lcd_backlight_disable(struct disp_lcd *lcd) { disp_gpio_set_t gpio_info[1]; __hdle hdl; struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd); if((NULL == lcd) || (NULL == lcdp)) { DE_WRN("NULL hdl!\n"); return DIS_FAIL; } if(disp_lcd_is_used(lcd)) { if(lcdp->lcd_cfg.lcd_bl_en_used) { memcpy(gpio_info, &(lcdp->lcd_cfg.lcd_bl_en), sizeof(disp_gpio_set_t)); gpio_info->data = (gpio_info->data==0)?1:0; gpio_info->mul_sel = 7; hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); } } return 0; }
__s32 bsp_disp_tv_open(__u32 screen_id) { if(!(gdisp.screen[screen_id].status & TV_ON)) { __disp_tv_mode_t tv_mod; tv_mod = gdisp.screen[screen_id].tv_mode; image_clk_on(screen_id, 1); Image_open(screen_id);//set image normal channel start bit , because every de_clk_off( )will reset this bit disp_clk_cfg(screen_id,DISP_OUTPUT_TYPE_TV, tv_mod); tve_clk_on(screen_id); lcdc_clk_on(screen_id, 1, 0); lcdc_clk_on(screen_id, 1, 1); tcon_init(screen_id); gdisp.screen[screen_id].output_csc_type = DISP_OUT_CSC_TYPE_TV; 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); #if (defined CONFIG_ARCH_SUN5I) __u32 scaler_index = 0; DE_BE_Set_Outitl_enable(screen_id , 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 == screen_id)) { if(disp_get_screen_scan_mode(tv_mod) == 1)//interlace output { Scaler_Set_Outitl(scaler_index, TRUE); } else { Scaler_Set_Outitl(scaler_index, FALSE); } } } #endif tcon1_set_tv_mode(screen_id,tv_mod); TVE_set_tv_mode(screen_id, tv_mod); Disp_TVEC_DacCfg(screen_id, tv_mod); tcon1_open(screen_id); Disp_TVEC_Open(screen_id); Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_TV, tv_mod); #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) { 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, 0, "audio_pa_ctrl"); } } } #endif gdisp.screen[screen_id].b_out_interlace = disp_get_screen_scan_mode(tv_mod); gdisp.screen[screen_id].status |= TV_ON; gdisp.screen[screen_id].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[screen_id].output_type = DISP_OUTPUT_TYPE_TV; #if (defined CONFIG_ARCH_SUN7I) Disp_set_out_interlace(screen_id); #endif #ifdef __LINUX_OSAL__ Display_set_fb_timming(screen_id); #endif } 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 BSP_disp_tv_open(__u32 sel) { if (!(gdisp.screen[sel].status & TV_ON)) { __disp_tv_mode_t tv_mod; tv_mod = gdisp.screen[sel].tv_mode; image_clk_on(sel); /* * set image normal channel start bit , because every * de_clk_off( )will reset this bit */ Image_open(sel); disp_clk_cfg(sel, DISP_OUTPUT_TYPE_TV, tv_mod); tve_clk_on(sel); lcdc_clk_on(sel); BSP_disp_set_output_csc(sel, DISP_OUTPUT_TYPE_TV, gdisp.screen[sel]. iep_status & DRC_USED); DE_BE_set_display_size(sel, tv_mode_to_width(tv_mod), tv_mode_to_height(tv_mod)); DE_BE_Output_Select(sel, sel); if (sunxi_is_sun5i()) { int scaler_index; 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)) { /* interlace output */ if (Disp_get_screen_scan_mode(tv_mod) == 1) Scaler_Set_Outitl(scaler_index, TRUE); else Scaler_Set_Outitl(scaler_index, FALSE); } } TCON1_set_tv_mode(sel, tv_mod); TVE_set_tv_mode(sel, tv_mod); Disp_TVEC_DacCfg(sel, tv_mod); TCON1_open(sel); Disp_TVEC_Open(sel); Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_TV, tv_mod); Disp_de_flicker_enable(sel, TRUE); { 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, 0, "audio_pa_ctrl"); } } } gdisp.screen[sel].b_out_interlace = Disp_get_screen_scan_mode(tv_mod); gdisp.screen[sel].status |= TV_ON; gdisp.screen[sel].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_TV; Disp_set_out_interlace(sel); Display_set_fb_timing(sel); } return DIS_SUCCESS; }
__s32 LCD_POWER_EN(__u32 sel, __bool b_en) { #if 0 disp_gpio_set_t gpio_info[1]; __hdle hdl; if(b_en) { if(gdisp.screen[sel].lcd_cfg.lcd_power_used) { if(gpanel_info[sel].lcd_if == LCD_IF_EXT_DSI) { LCD_POWER_ELDO3_EN(sel, 1, 12); msleep(10); } memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_power), sizeof(disp_gpio_set_t)); if(!b_en) { gpio_info->data = (gpio_info->data==0)?1:0; } hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); udelay(200); if((gpanel_info[sel].lcd_if == LCD_IF_EDP) && (gpanel_info[sel].lcd_edp_tx_ic == 0)) { __u8 data; __u32 ret; __u8 addr; addr = 0x1b; data = 0x0b; ret = ar100_axp_write_reg(&addr, &data, 1); //set eldo3 to 1.8v if(ret != 0) { DE_WRN("set eldo3 to 1.8v fail\n"); } addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } addr = 0x12; data |= 0x04; ar100_axp_write_reg(&addr, &data, 1); //enable eldo3 if(ret != 0) { DE_WRN("enable eldo3 fail\n"); } } else if((gpanel_info[sel].lcd_if == LCD_IF_EDP) && (gpanel_info[sel].lcd_edp_tx_ic == 1)) { __u8 data; __u32 ret; __u8 addr; addr = 0x15; data = 0x12; ret = ar100_axp_write_reg(&addr, &data, 1); //set dldo1 to 2.5v if(ret != 0) { DE_WRN("set dldo1 to 2.5v fail\n"); } addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } addr = 0x12; data |= 0x08; ar100_axp_write_reg(&addr, &data, 1); //enable dldo1 if(ret != 0) { DE_WRN("enable dldo1 fail\n"); } addr = 0x1b; data = 0x05; ret = ar100_axp_write_reg(&addr, &data, 1); //set eldo3 to 1.2v if(ret != 0) { DE_WRN("set eldo3 to 1.2v fail\n"); } addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } addr = 0x12; data |= 0x04; ar100_axp_write_reg(&addr, &data, 1); //enable eldo3 if(ret != 0) { DE_WRN("enable eldo3 fail\n"); } } msleep(50); } Disp_lcdc_pin_cfg(sel, DISP_OUTPUT_TYPE_LCD, 1); msleep(2); } else { Disp_lcdc_pin_cfg(sel, DISP_OUTPUT_TYPE_LCD, 0); msleep(2); if(gdisp.screen[sel].lcd_cfg.lcd_power_used) { if((gpanel_info[sel].lcd_if == LCD_IF_EDP) && (gpanel_info[sel].lcd_edp_tx_ic == 0)) { __u8 data; __u32 ret; __u8 addr; addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } data &= 0xfb; ar100_axp_write_reg(&addr, &data, 1); //enable eldo3 if(ret != 0) { DE_WRN("disable eldo3 fail\n"); } } else if((gpanel_info[sel].lcd_if == LCD_IF_EDP) && (gpanel_info[sel].lcd_edp_tx_ic == 1)) { __u8 data; __u32 ret; __u8 addr; addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } data &= 0xfb; ar100_axp_write_reg(&addr, &data, 1); //disable eldo3 if(ret != 0) { DE_WRN("disable eldo3 fail\n"); } addr = 0x12; ret = ar100_axp_read_reg(&addr, &data, 1); if(ret != 0) { DE_WRN("axp read reg fail\n"); } data &= 0xf7; ar100_axp_write_reg(&addr, &data, 1); //disable dldo1 if(ret != 0) { DE_WRN("disable dldo1 fail\n"); } } udelay(200); memcpy(gpio_info, &(gdisp.screen[sel].lcd_cfg.lcd_power), sizeof(disp_gpio_set_t)); if(!b_en) { gpio_info->data = (gpio_info->data==0)?1:0; } hdl = OSAL_GPIO_Request(gpio_info, 1); OSAL_GPIO_Release(hdl, 2); if(gpanel_info[sel].lcd_if == LCD_IF_EXT_DSI) { LCD_POWER_ELDO3_EN(sel, 0, 7); } } } #endif return 0; }
__s32 BSP_disp_tv_open(__u32 sel) { if(!(gdisp.screen[sel].status & TV_ON)) { __disp_tv_mode_t tv_mod; tv_mod = gdisp.screen[sel].tv_mode; 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_TV, tv_mod); tve_clk_on(sel); lcdc_clk_on(sel); BSP_disp_set_output_csc(sel, DISP_OUTPUT_TYPE_TV); 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_tv_mode(sel,tv_mod); TVE_set_tv_mode(sel, tv_mod); Disp_TVEC_DacCfg(sel, tv_mod); TCON1_open(sel); Disp_TVEC_Open(sel); Disp_Switch_Dram_Mode(DISP_OUTPUT_TYPE_TV, tv_mod); #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, 0, "audio_pa_ctrl"); } } } #endif gdisp.screen[sel].b_out_interlace = Disp_get_screen_scan_mode(tv_mod); gdisp.screen[sel].status |= TV_ON; gdisp.screen[sel].lcdc_status |= LCDC_TCON1_USED; gdisp.screen[sel].output_type = DISP_OUTPUT_TYPE_TV; Disp_set_out_interlace(sel); #ifdef __LINUX_OSAL__ Display_set_fb_timming(sel); #endif } return DIS_SUCCESS; }