s32 disp_lcd_set_bright(struct disp_lcd *lcd, u32 bright)
{
	u32 duty_ns;
	__u64 backlight_bright = bright;
	__u64 backlight_dimming;
	__u64 period_ns;
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);
	bool need_enable_bl = false, need_disable_bl = false;

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return DIS_FAIL;
	}

	if((0 == lcdp->lcd_cfg.backlight_bright) && (0 != bright))
		need_enable_bl = true;
	if((0 != lcdp->lcd_cfg.backlight_bright) && (0 == bright))
		need_disable_bl = true;

	backlight_bright = (backlight_bright > 255)? 255:backlight_bright;
	if(lcdp->lcd_cfg.backlight_bright != backlight_bright) {
		lcdp->lcd_cfg.backlight_bright = backlight_bright;
		disp_notifier_call_chain(DISP_EVENT_BACKLIGHT_UPDATE, lcd->channel_id, (void*)bright);
	}

	if(backlight_bright != 0)	{
		backlight_bright += 1;
	}

	lcdp->lcd_cfg.backlight_dimming = (0 == lcdp->lcd_cfg.backlight_dimming)? 256:lcdp->lcd_cfg.backlight_dimming;
	backlight_dimming = lcdp->lcd_cfg.backlight_dimming;
	period_ns = lcdp->pwm_info.period_ns;
	duty_ns = (backlight_bright * backlight_dimming *  period_ns/256 + 128) / 256;
	lcdp->pwm_info.duty_ns = duty_ns;

//		DE_DBG("[PWM]bright=%d, bright_modify=%d, backlight_dimming=%d, period_ns=%d, duty_ns=%d\n",
//		bright,(u32)backlight_bright, lcdp->lcd_cfg.backlight_dimming,  (u32)period_ns, (u32)duty_ns);
	sunxi_pwm_config(lcdp->pwm_info.channel, duty_ns, period_ns);

	if(need_enable_bl)
		disp_lcd_backlight_enable(lcd);
	if(need_disable_bl)
		disp_lcd_backlight_enable(lcd);

	return DIS_SUCCESS;
}
s32 disp_lcd_get_driver_name(struct disp_lcd *lcd, char* name)
{
	char primary_key[20];
	s32 ret;
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return DIS_FAIL;
	}

	sprintf(primary_key, "lcd%d_para", lcd->channel_id);

	ret = OSAL_Script_FetchParser_Data(primary_key, "lcd_driver_name",  (int*)name, 32);
	DE_INF("disp_lcd_get_driver_name, %s\n", name);
	return ret;
}
Esempio n. 3
0
__s32 BSP_disp_tv_get_interface(__u32 sel)
{
    __u8 dac[4];
    __s32 i = 0;
	__u32  ret = DISP_TV_NONE;

    if(!(gdisp.screen[sel].status & TV_ON))
    {
        tve_clk_on();
    }

    for(i=0; i<4; i++)
    {
        dac[i] = TVE_get_dac_status(i);
    }

    if(dac[0]>1 || dac[1]>1 || dac[2]>1 || dac[3]>1)
    {
        DE_WRN("shor to ground\n");
    }
    else
    {
        for(i=0; i<4; i++)
        {
            if(gdisp.screen[sel].dac_source[i] == DISP_TV_DAC_SRC_COMPOSITE && dac[i] == 1)
            {
                ret |= DISP_TV_CVBS;
            }
            else if(gdisp.screen[sel].dac_source[i] == DISP_TV_DAC_SRC_Y && dac[i] == 1)
            {
                ret |= DISP_TV_YPBPR;
            }
            else if(gdisp.screen[sel].dac_source[i] == DISP_TV_DAC_SRC_LUMA && dac[i] == 1)
            {
                ret |= DISP_TV_SVIDEO;
            }
        }
    }

    if(!(gdisp.screen[sel].status & TV_ON))
    {
        tve_clk_off();
    }

    return  ret;
}
s32 disp_lcd_set_panel_funs(struct disp_lcd* lcd, disp_lcd_panel_fun * lcd_cfg)
{
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return DIS_FAIL;
	}

	memset(&lcdp->lcd_panel_fun, 0, sizeof(disp_lcd_panel_fun));
	lcdp->lcd_panel_fun.cfg_panel_info= lcd_cfg->cfg_panel_info;
	lcdp->lcd_panel_fun.cfg_open_flow = lcd_cfg->cfg_open_flow;
	lcdp->lcd_panel_fun.cfg_close_flow = lcd_cfg->cfg_close_flow;
	lcdp->lcd_panel_fun.lcd_user_defined_func = lcd_cfg->lcd_user_defined_func;

	return 0;
}
Esempio n. 5
0
s32 disp_hdmi_get_vendor_id(struct disp_hdmi* hdmi, __u8 *id)
{
	struct disp_hdmi_private_data *hdmip = disp_hdmi_get_priv(hdmi);

	__inf("disp_hdmi_get_vendor_id\n");

	if((NULL == hdmi) || (NULL == hdmip)){
		DE_WRN("hdmi set func null hdl!\n");
		return DIS_FAIL;
	}
	if(hdmip->hdmi_func.hdmi_get_vendor_id == NULL){
		__inf("hdmi_get_vendor_id NULL");
		return -1;
	}

	return hdmip->hdmi_func.hdmi_get_vendor_id(id);
}
Esempio n. 6
0
s32 bsp_disp_lcd_post_enable(u32 screen_id)
{
	struct disp_lcd* lcd;
	int ret = 0;

	lcd = disp_get_lcd(screen_id);
	if(!lcd) {
		DE_WRN("get lcd%d fail\n", screen_id);
	}

	if(lcd->post_enable)
		ret = lcd->post_enable(lcd);
#if defined(__LINUX_PLAT__)
	Display_set_fb_timming(screen_id);
#endif
	return ret;
}
Esempio n. 7
0
s32 hdmi_clk_enable(struct disp_hdmi *hdmi)
{
	struct disp_hdmi_private_data *hdmip = disp_hdmi_get_priv(hdmi);
	if(!hdmi || !hdmip) {
	    DE_WRN("hdmi clk init null hdl!\n");
	    return DIS_FAIL;
	}

	hdmi_clk_config(hdmi);

	if(hdmip->drc_clk.clk)
		disp_al_hdmi_clk_enable(hdmip->drc_clk.clk);

	disp_al_hdmi_enable(hdmi->channel_id);

	return 0;
}
Esempio n. 8
0
__s32 Scaler_Request(__u32 sel)
{
    __s32 ret = DIS_NO_RES;

    DE_INF("Scaler_Request,%d\n", sel);

    sel = 0;//only one scaler

    if(sel == 0)//request scaler0
    {
        if(!(gdisp.scaler[0].status & SCALER_USED))
        {
            ret = 0;
        }
    }
    else if(sel == 1)//request scaler1
    {
        if(!(gdisp.scaler[1].status & SCALER_USED))
        {
            ret = 1;
        }
    }
    else//request any scaler
    {
        if(!(gdisp.scaler[0].status & SCALER_USED))
        {
            ret = 0;
        }
        else if(!(gdisp.scaler[1].status & SCALER_USED))
        {
            ret = 1;
        }
    }

    if(ret == 0 || ret == 1)
    {
        Scaler_open(ret);
        gdisp.scaler[ret].b_close = FALSE;
        gdisp.scaler[ret].status |= SCALER_USED;
    }
    else
    {
        DE_WRN("request scaler fail\n");
    }
    return ret;
}
Esempio n. 9
0
s32 bsp_disp_get_timming(u32 screen_id, disp_video_timing * tt)
{
	memset(tt, 0, sizeof(disp_video_timing));
	if(DISP_OUTPUT_TYPE_LCD == bsp_disp_get_output_type(screen_id)) {
		struct disp_lcd *lcd;

		lcd = disp_get_lcd(screen_id);
		if(!lcd) {
			DE_WRN("get lcd%d failed\n", screen_id);
			return DIS_FAIL;
		}
		if(lcd->get_timing)
			return lcd->get_timing(lcd, tt);
	}
#if 0
	struct disp_hdmi* hdmi;
	else if(DISP_OUTPUT_TYPE_HDMI == bsp_disp_get_output_type(screen_id)) {
Esempio n. 10
0
s32 disp_lcd_set_close_func(struct disp_lcd* lcd, LCD_FUNC func, u32 delay)
{
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return -1;
	}

	if(func) {
		lcdp->close_flow.func[lcdp->close_flow.func_num].func = func;
		lcdp->close_flow.func[lcdp->close_flow.func_num].delay = delay;
		lcdp->close_flow.func_num ++;
	}

	return DIS_SUCCESS;
}
__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;

        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);

    	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;
}
Esempio n. 12
0
s32 disp_sync_all(u32 screen_id)
{
	struct disp_manager *mgr;
	struct disp_smcl *smcl;
	struct disp_smbl *smbl;
#if defined(CONFIG_ARCH_SUN9IW1P1)
	struct disp_cursor *cursor;
#endif

	mgr = disp_get_layer_manager(screen_id);
	if(!mgr) {
		DE_WRN("get mgr%d fail\n", screen_id);
	}

	if(mgr->sync)
		mgr->sync(mgr);

	smcl = disp_get_smcl(screen_id);
	if(!smcl) {
		//DE_WRN("get smcl %d fail\n", screen_id);
	} else {
		if(smcl->sync)
			smcl->sync(smcl);
		}

	smbl = disp_get_smbl(screen_id);
	if(!smbl) {
		//DE_WRN("get smbl%d fail\n", screen_id);
	} else {
		if(smbl->sync)
			smbl->sync(smbl);
		}

#if defined(CONFIG_ARCH_SUN9IW1P1)
	cursor = disp_get_cursor(screen_id);
	if(!cursor) {
		//DE_WRN("get cursor%d fail\n", screen_id);
	} else {
		if(cursor->sync)
			cursor->sync(cursor);
		}

#endif
	return 0;
}
Esempio n. 13
0
static s32 lcd_clk_config(struct disp_lcd* lcd)
{
	u32 lcd_dclk_freq;	//Hz
	u32 pll_freq = 0;
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return -1;
	}

	lcd_dclk_freq = lcdp->panel_info.lcd_dclk_freq * 1000000;
	if ((lcdp->panel_info.lcd_if == LCD_IF_HV) || (lcdp->panel_info.lcd_if == LCD_IF_CPU)
	    || (lcdp->panel_info.lcd_if == LCD_IF_EDP))	{
		lcdp->lcd_clk.clk_div = 6;//todo?
	}	else if(lcdp->panel_info.lcd_if == LCD_IF_LVDS) {
		lcdp->lcd_clk.clk_div = 7;
	}	else if(lcdp->panel_info.lcd_if == LCD_IF_DSI) {
		u32 lane = lcdp->panel_info.lcd_dsi_lane;
		u32 bitwidth = 0;

		switch(lcdp->panel_info.lcd_dsi_format) {
			case LCD_DSI_FORMAT_RGB888:
			bitwidth = 24;
			break;
			case LCD_DSI_FORMAT_RGB666:
			bitwidth = 24;
			break;
			case LCD_DSI_FORMAT_RGB565:
			bitwidth = 16;
			break;
			case LCD_DSI_FORMAT_RGB666P://todo?
			bitwidth = 18;
			break;
		}

		lcdp->lcd_clk.clk_div = bitwidth/lane;
	}

	pll_freq = lcd_dclk_freq * (lcdp->lcd_clk.clk_div);

	set_src_freq(lcdp->lcd_clk.clk_src, pll_freq);

	return 0;
}
Esempio n. 14
0
__s32 bsp_disp_hdmi_check_support_mode(__u32 screen_id, __u8  mode)
{
	if(disp_hdmi_get_support(screen_id) && (gdisp.screen[screen_id].hdmi_used)
	    && (gdisp.init_para.hdmi_mode_support)) {
		if(gdisp.screen[screen_id].hdmi_test_mode < DISP_TV_MODE_NUM)	{
			if(mode == gdisp.screen[screen_id].hdmi_test_mode) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return gdisp.init_para.hdmi_mode_support(mode);
		}
	}	else {
		DE_WRN("hdmi_mode_support is NULL\n");
		return DIS_NOT_SUPPORT;
	}
}
Esempio n. 15
0
s32 disp_vdevice_unregister(struct disp_device *vdevice)
{
	struct disp_vdevice_private_data *vdevicep;

	if(NULL == vdevice) {
		DE_WRN("null hdl\n");
		return DIS_FAIL;
	}
	disp_device_unset_manager(vdevice);
	disp_device_unregister(vdevice);
	vdevice->exit(vdevice);
	vdevicep = (struct disp_vdevice_private_data *)vdevice->priv_data;

	disp_sys_free((void*)vdevice);
	disp_sys_free((void*)vdevicep);

	return 0;
}
Esempio n. 16
0
static s32 hdmi_clk_disable(struct disp_hdmi *hdmi)
{
	struct disp_hdmi_private_data *hdmip = disp_hdmi_get_priv(hdmi);
	if(!hdmi || !hdmip) {
	    DE_WRN("hdmi clk init null hdl!\n");
	    return DIS_FAIL;
	}

	disp_al_hdmi_disable(hdmi->channel_id);

	hdmip->lcd_clk.h_clk = OSAL_CCMU_OpenMclk(hdmip->lcd_clk.clk);
	OSAL_CCMU_MclkOnOff(hdmip->lcd_clk.h_clk, CLK_OFF);
	OSAL_CCMU_CloseMclk(hdmip->lcd_clk.h_clk);

	if(hdmip->drc_clk.clk)
		disp_al_hdmi_clk_disable(hdmip->drc_clk.clk);

	return 0;
}
Esempio n. 17
0
s32 lcd_clk_init(struct disp_lcd* lcd)
{
	struct disp_lcd_private_data *lcdp = disp_lcd_get_priv(lcd);

	if((NULL == lcd) || (NULL == lcdp)) {
		DE_WRN("NULL hdl!\n");
		return -1;
	}

	mod_clk_set_src(lcdp->lcd_clk.clk, lcdp->lcd_clk.clk_src);

	if(LCD_IF_LVDS == lcdp->panel_info.lcd_if) {
	} else if(LCD_IF_DSI == lcdp->panel_info.lcd_if) {
		mod_clk_set_src(lcdp->dsi_clk.clk, lcdp->dsi_clk.clk_src);
	} else if(LCD_IF_EDP == lcdp->panel_info.lcd_if) {
	}

	return DIS_SUCCESS;
}
Esempio n. 18
0
__s32 BSP_disp_hdmi_set_src(__u32 sel, __disp_lcdc_src_t src)
{
    switch (src)
    {
        case DISP_LCDC_SRC_DE_CH1:
            tcon1_src_select(sel, LCDC_SRC_BE0);
            break;
        case DISP_LCDC_SRC_DE_CH2:
            tcon1_src_select(sel, LCDC_SRC_BE1);
            break;
        case DISP_LCDC_SRC_BLUE:
            tcon1_src_select(sel, LCDC_SRC_BLUE);
            break;
        default:
            DE_WRN("not supported lcdc src:%d in BSP_disp_tv_set_src\n", src);
            return DIS_NOT_SUPPORT;
    }
    return DIS_SUCCESS;
}
Esempio n. 19
0
/* returns: us */
s32 bsp_disp_get_next_vb_time(void)
{
	u32 cur_line;
	u32 num_screens, screen_id;
	disp_video_timing tt;
	u32 next_time = 16000;

	num_screens = bsp_disp_feat_get_num_screens();
	for(screen_id=0; screen_id<num_screens; screen_id++) {
		if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_LCD) {
			struct disp_lcd* lcd;
			u32 time_per_line = 0;
			static disp_panel_para info;

			cur_line = disp_al_lcd_get_cur_line(screen_id);
			lcd = disp_get_lcd(screen_id);
			if(!lcd) {
				DE_WRN("get lcd%d fail\n", screen_id);
			}
			memset(&info, 0, sizeof(disp_panel_para));
			if(lcd && lcd->get_panel_info)
				lcd->get_panel_info(lcd, &info);
			if(LCD_IF_EDP != info.lcd_if) {
				if(lcd && lcd->get_timing) {
					u32 fps = 0;

					lcd->get_timing(lcd, &tt);
					if((tt.ver_total_time != 0) && (tt.hor_total_time != 0))
						fps = tt.pixel_clk*1000/(tt.ver_total_time*tt.hor_total_time);
					fps = (0 == fps)? 60:fps;
					time_per_line = 1000000 / fps / tt.ver_total_time;
					next_time = (tt.ver_total_time - cur_line) * time_per_line;
				}
			} else {
				/* EDP PANEL */
				next_time = 16000;//fix to 16ms
			}
		} else if(bsp_disp_get_output_type(screen_id) == DISP_OUTPUT_TYPE_HDMI) {
			/* FIXME: add hdmi */
		}
	}
	return next_time;
}
Esempio n. 20
0
s32 bsp_disp_hdmi_resume(u32 screen_id)
{
	struct disp_hdmi* hdmi;
	hdmi = disp_get_hdmi(screen_id);

	if(!(bsp_disp_feat_get_supported_output_types(screen_id) & DISP_OUTPUT_TYPE_HDMI))
		return 0;

	if(!hdmi) {
		DE_WRN("get hdmi%d failed!\n", screen_id);
		return DIS_FAIL;
	}

	if(hdmi->resume) {
	  return hdmi->resume(hdmi);
	}

	return DIS_FAIL;
}
Esempio n. 21
0
s32 bsp_disp_layer_deinterlace_cfg(u32 screen_id)
{
	struct disp_layer *lyr;
	int layer_id, num_layer;

	num_layer = bsp_disp_feat_get_num_layers(screen_id);
	for(layer_id = 0; layer_id < num_layer; layer_id++) {
		lyr = disp_get_layer(screen_id, layer_id);
		if(!lyr || (lyr->is_enabled && !lyr->is_enabled(lyr))) {
			continue;
		}
		if(lyr->deinterlace_cfg)
			lyr->deinterlace_cfg(lyr);
		else
			DE_WRN("lyr deinterlace_cfg is NULL\n");
	}

	return 0;
}
Esempio n. 22
0
static s32 disp_vdevice_sw_enable(struct disp_device* vdevice)
{
	struct disp_vdevice_private_data *vdevicep = disp_vdevice_get_priv(vdevice);
	struct disp_manager *mgr = NULL;
	if((NULL == vdevice) || (NULL == vdevicep)) {
		DE_WRN("null  hdl!\n");
		return DIS_FAIL;
	}
	mgr = vdevice->manager;
	if(!mgr) {
		DE_WRN("%s%d's mgr is NULL\n", vdevice->name, vdevice->disp);
		return DIS_FAIL;
	}

	if(vdevicep->enabled == 1) {
		DE_WRN("%s%d is already enabled\n", vdevice->name, vdevice->disp);
		return DIS_FAIL;
	}

	if(vdevicep->func.get_video_timing_info == NULL) {
		DE_WRN("vdevice_get_video_timing_info func is null\n");
		return DIS_FAIL;
	}

	vdevicep->func.get_video_timing_info(&(vdevicep->video_info));

	if(vdevicep->video_info == NULL) {
		DE_WRN("video info is null\n");
		return DIS_FAIL;
	}

	if(vdevicep->func.get_interface_para == NULL) {
		DE_WRN("get_interface_para func is null\n");
		return DIS_FAIL;
	}
	vdevicep->func.get_interface_para((void*)&(vdevicep->intf));

	disp_sys_lock((void*)&vdevicep->mlock);
	memcpy(&vdevice->timings, vdevicep->video_info, sizeof(disp_video_timings));
	if(mgr->sw_enable)
		mgr->sw_enable(mgr);

	disp_sys_register_irq(vdevicep->irq_no,0,disp_vdevice_event_proc,(void*)vdevice,0,0);
	disp_sys_enable_irq(vdevicep->irq_no);

	vdevicep->enabled = 1;
	disp_sys_unlock((void*)&vdevicep->mlock);

	return 0;
}
Esempio n. 23
0
s32 bsp_disp_lcd_pre_disable(u32 screen_id)
{
	struct disp_lcd* lcd;
	struct disp_manager *mgr;

	mgr = disp_get_layer_manager(screen_id);
	lcd = disp_get_lcd(screen_id);
	if(!mgr || !lcd) {
		DE_WRN("get lcd%d or mgr%d fail\n", screen_id, screen_id);
        return -1;
	}

	if(mgr->set_output_type)
		mgr->set_output_type(mgr, DISP_OUTPUT_TYPE_NONE);

	if(lcd->pre_disable) {
		return lcd->pre_disable(lcd);
	}
	return DIS_FAIL;
}
Esempio n. 24
0
s32 disp_hdmi_set_func(struct disp_hdmi*  hdmi, disp_hdmi_func * func)
{
	struct disp_hdmi_private_data *hdmip = disp_hdmi_get_priv(hdmi);
	if((NULL == hdmi) || (NULL == hdmip)) {
		DE_WRN("hdmi set func null  hdl!\n");
		return DIS_FAIL;
	}

	hdmip->hdmi_func.hdmi_open = func->hdmi_open;
	hdmip->hdmi_func.hdmi_close= func->hdmi_close;
	hdmip->hdmi_func.hdmi_set_mode= func->hdmi_set_mode;
	hdmip->hdmi_func.hdmi_mode_support= func->hdmi_mode_support;
	hdmip->hdmi_func.hdmi_get_HPD_status = func->hdmi_get_HPD_status;
	hdmip->hdmi_func.hdmi_get_input_csc= func->hdmi_get_input_csc;
	hdmip->hdmi_func.hdmi_set_pll = func->hdmi_set_pll;
	hdmip->hdmi_func.hdmi_get_video_timing_info = func->hdmi_get_video_timing_info;
	hdmip->hdmi_func.hdmi_get_video_info_index = func->hdmi_get_video_info_index;

	return 0;
}
Esempio n. 25
0
s32 bsp_disp_set_hdmi_func(u32 screen_id, disp_hdmi_func * func)
{
	struct disp_hdmi* hdmi;
	s32 ret = -1;
	hdmi = disp_get_hdmi(screen_id);
	if(!hdmi) {
	    DE_WRN("get hdmi%d failed!\n", screen_id);
	    return DIS_FAIL;
	    }

	gdisp.hdmi_registered = 1;
	if(hdmi->set_func)
	    ret = hdmi->set_func(hdmi, func);

	if(gdisp.init_para.start_process) {
		DE_INF("gdisp.init_para.start_process\n");
		gdisp.init_para.start_process();
	}
	return ret;
}
Esempio n. 26
0
static s32 hdmi_clk_enable(struct disp_hdmi *hdmi)
{
	struct disp_hdmi_private_data *hdmip = disp_hdmi_get_priv(hdmi);
	if(!hdmi || !hdmip) {
	    DE_WRN("hdmi clk init null hdl!\n");
	    return DIS_FAIL;
	}
	if((NULL == hdmi->p_sw_init_flag) || (0 == *(hdmi->p_sw_init_flag))) {
		hdmi_clk_config(hdmi);
	}
	if(hdmip->drc_clk.clk && ((NULL == hdmi->p_sw_init_flag) || (0 == *(hdmi->p_sw_init_flag))))
		disp_al_hdmi_clk_enable(hdmip->drc_clk.clk);

	if((NULL == hdmi->p_sw_init_flag) || (0 == *(hdmi->p_sw_init_flag))) {
		disp_al_hdmi_enable(hdmi->channel_id);
	} else {
		//disp_al_hdmi_enable_sw(hdmi->channel_id);
	}
	return 0;
}
Esempio n. 27
0
s32 bsp_disp_lcd_post_disable(u32 screen_id)
{
	struct disp_lcd* lcd;
	struct disp_manager *mgr;
	s32 ret = -1;

	mgr = disp_get_layer_manager(screen_id);
	lcd = disp_get_lcd(screen_id);
	if(!mgr || !lcd) {
		DE_WRN("get lcd%d or mgr%d fail\n", screen_id, screen_id);
        return -1;
	}

	if(lcd->post_disable)
		ret = lcd->post_disable(lcd);

	if(mgr->disable)
		mgr->disable(mgr);

	return ret;
}
Esempio n. 28
0
s32 bsp_disp_hdmi_disable(u32 screen_id)
{
	struct disp_hdmi* hdmi;
	struct disp_manager *mgr;
	hdmi = disp_get_hdmi(screen_id);
	mgr = disp_get_layer_manager(screen_id);
	if(!hdmi || !mgr) {
		DE_WRN("get hdm%dor mgr%d failed!\n", screen_id, screen_id);
		return DIS_FAIL;
	    }

	if(hdmi->disable)
	    hdmi->disable(hdmi);

	if(mgr->is_enabled && mgr->is_enabled(mgr))
		mgr->disable(mgr);
	if(mgr->set_output_type)
		mgr->set_output_type(mgr, DISP_OUTPUT_TYPE_NONE);

	return DIS_FAIL;
}
Esempio n. 29
0
__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;
}
Esempio n. 30
0
struct disp_hdmi* disp_get_hdmi(u32 screen_id)
{
	u32 num_screens;

	num_screens = bsp_disp_feat_get_num_screens();
	if(screen_id >= num_screens) {
		DE_WRN("screen_id %d out of range\n", screen_id);
		return NULL;
	}

	if(!(bsp_disp_feat_get_supported_output_types(screen_id) & DISP_OUTPUT_TYPE_HDMI)) {
	    DE_INF("screen_id %d do not support HDMI TYPE!\n", screen_id);
	    return NULL;
	}

	if(!disp_al_query_hdmi_mod(screen_id)) {
		DE_INF("hdmi %d is not registered\n", screen_id);
		return NULL;
	}

	return &hdmis[screen_id];
}