__s32 bsp_disp_cfg_start(__u32 screen_id)
{
	__u32 cnt = 0;
	__s32 ret = -1;

	while((0 != ret) && (cnt < 100)) {
#ifdef __LINUX_OSAL__
	unsigned long flags;
	spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	cnt ++;
	if(gdisp.screen[screen_id].have_cfg_reg == FALSE) {
		gdisp.screen[screen_id].cfg_cnt++;
		ret = 0;
	}
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	if(0 != ret)
		bsp_disp_delay_us(10);
	}

	if(0 != ret) {
#ifdef __LINUX_OSAL__
	unsigned long flags;

	spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	gdisp.screen[screen_id].cfg_cnt++;
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	}
	return DIS_SUCCESS;
}
Exemple #2
0
__s32 bsp_disp_cfg_start(__u32 screen_id)
{
	__u32 cnt = 0;
	__s32 ret = -1;
	__u32 max_cnt = 0;
	__u32 start_delay = 0;
	__u32 load_reg_time = 0;
	__u32 fps = 0xff;
	__u32 delay = 10;
	__u32 lcd_dclk_freq,lcd_vt,lcd_ht;

	lcd_dclk_freq = gpanel_info[screen_id].lcd_dclk_freq;
	lcd_vt = gpanel_info[screen_id].lcd_vt;
	lcd_ht = gpanel_info[screen_id].lcd_ht;

	if(gdisp.screen[screen_id].lcdc_status & LCDC_TCON1_USED) {
		start_delay = TCON_get_start_delay(screen_id, 1);
	}else{
		start_delay = TCON_get_start_delay(screen_id, 0);
	}
	
	fps = lcd_dclk_freq*1000*1000/(lcd_vt*lcd_ht);
	
	load_reg_time = (1*1000*1000)/(fps*lcd_vt)*start_delay;
	
	max_cnt = load_reg_time/delay + 1;
	while((0 != ret) && (cnt < max_cnt)) {
#ifdef __LINUX_OSAL__
	unsigned long flags;
	spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	cnt ++;
	if(gdisp.screen[screen_id].have_cfg_reg == FALSE) {
		gdisp.screen[screen_id].cfg_cnt++;
		ret = 0;
	}
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	if(0 != ret)
		bsp_disp_delay_us(delay);
	}

	if(0 != ret) {
#ifdef __LINUX_OSAL__
	unsigned long flags;

	spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	gdisp.screen[screen_id].cfg_cnt++;
#ifdef __LINUX_OSAL__
	spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	}
	return DIS_SUCCESS;
}
s32 bsp_disp_shadow_protect(u32 screen_id, bool protect)
{
	s32 ret = -1;
	u32 cnt = 0;
	u32 max_cnt = 50;
	u32 delay = 10;//us
	disp_video_timing tt;
#ifdef __LINUX_PLAT__
	unsigned long flags;
#endif

	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 fail\n", screen_id);
		}

		if(lcd && lcd->get_timing) {
			u32 load_reg_time;
			u32 start_delay;
			u32 fps;

			lcd->get_timing(lcd, &tt);
			start_delay = disp_al_lcd_get_start_delay(screen_id);
			start_delay = (0 == start_delay)? 32:start_delay;
			fps = tt.pixel_clk*1000/(tt.ver_total_time*tt.hor_total_time);
			fps = (0 == fps)? 60:fps;
			load_reg_time = (1*1000*1000)/(fps*tt.ver_total_time)*start_delay;
			max_cnt = load_reg_time/delay + 1;
			max_cnt = max_cnt * 2;
		}
	} else if(DISP_OUTPUT_TYPE_HDMI == bsp_disp_get_output_type(screen_id)) {
		//FIXME
	}

	if(protect) {
		while((0 != ret) && (cnt < max_cnt)) {
#ifdef __LINUX_PLAT__
			spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
			cnt ++;
			if(gdisp.screen[screen_id].have_cfg_reg == false) {
				gdisp.screen[screen_id].cfg_cnt++;
				ret = 0;
			}
#ifdef __LINUX_PLAT__
			spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
			if(0 != ret)
				bsp_disp_delay_us(delay);
		}

		if(0 != ret) {
			DE_INF("wait for reg load finish time out\n");
#if defined(__LINUX_PLAT__)
			spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
			gdisp.screen[screen_id].cfg_cnt++;
#if defined(__LINUX_PLAT__)
			spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
		}
	} else {
#if defined(__LINUX_PLAT__)
			spin_lock_irqsave(&gdisp.screen[screen_id].flag_lock, flags);
#endif
			gdisp.screen[screen_id].cfg_cnt--;
#if defined(__LINUX_PLAT__)
			spin_unlock_irqrestore(&gdisp.screen[screen_id].flag_lock, flags);
#endif
	}
	return DIS_SUCCESS;
}
s32 bsp_disp_lcd_delay_us(u32 us)
{
	return bsp_disp_delay_us(us);
}