Skip to content

Commit

Permalink
1: fix disp resume bug;
Browse files Browse the repository at this point in the history
2: support a12 hdmi super standby
  • Loading branch information
yanggq authored and yanggq committed Jul 7, 2012
1 parent 6764e06 commit 158d41e
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 37 deletions.
4 changes: 4 additions & 0 deletions drivers/video/sun5i/disp/de_bsp/bsp_display.h
Expand Up @@ -100,6 +100,8 @@ typedef struct
__s32 (*hdmi_get_HPD_status)(void);
__s32 (*hdmi_set_pll)(__u32 pll, __u32 clk);
__s32 (*disp_int_process)(__u32 sel);
__s32 (*hdmi_suspend)(void);
__s32 (*hdmi_resume)(void);
}__disp_bsp_init_para;


Expand Down Expand Up @@ -248,6 +250,8 @@ extern __s32 BSP_disp_hdmi_check_support_mode(__u32 sel, __u8 mode);
extern __s32 BSP_disp_hdmi_get_hpd_status(__u32 sel);
extern __s32 BSP_disp_hdmi_set_src(__u32 sel, __disp_lcdc_src_t src);
extern __s32 BSP_disp_set_hdmi_func(__disp_hdmi_func * func);
extern __s32 BSP_disp_hdmi_suspend(void);
extern __s32 BSP_disp_hdmi_resume(void);

extern __s32 BSP_disp_vga_open(__u32 sel);
extern __s32 BSP_disp_vga_close(__u32 sel);
Expand Down
20 changes: 12 additions & 8 deletions drivers/video/sun5i/disp/de_bsp/de/disp_clk.c
Expand Up @@ -984,6 +984,11 @@ __s32 BSP_disp_clk_on(__u32 type)
{
OSAL_CCMU_MclkOnOff(h_debe1mclk, CLK_ON);
}
if((g_clk_status & CLK_HDMI_MOD_ON) == CLK_HDMI_MOD_ON)
{
OSAL_CCMU_MclkOnOff(h_hdmimclk, CLK_ON);
}

}

if(type & 2)
Expand Down Expand Up @@ -1033,10 +1038,6 @@ __s32 BSP_disp_clk_on(__u32 type)
OSAL_CCMU_MclkOnOff(h_lcd1ch1mclk1, CLK_ON);
OSAL_CCMU_MclkOnOff(h_lcd1ch1mclk2, CLK_ON);
}
if((g_clk_status & CLK_HDMI_MOD_ON) == CLK_HDMI_MOD_ON)
{
OSAL_CCMU_MclkOnOff(h_hdmimclk, CLK_ON);
}
}

if(type == 2)
Expand Down Expand Up @@ -1090,6 +1091,7 @@ __s32 BSP_disp_clk_off(__u32 type)
{
OSAL_CCMU_MclkOnOff(h_hdmiahbclk, CLK_OFF);
}

//OSAL_CCMU_MclkOnOff(h_tveahbclk, CLK_OFF);

//MODULE CLK
Expand All @@ -1101,7 +1103,13 @@ __s32 BSP_disp_clk_off(__u32 type)
{
OSAL_CCMU_MclkOnOff(h_debe1mclk, CLK_OFF);
}
if((g_clk_status & CLK_HDMI_MOD_ON) == CLK_HDMI_MOD_ON)
{
OSAL_CCMU_MclkOnOff(h_hdmimclk, CLK_OFF);
}
}



if(type & 2)
{
Expand Down Expand Up @@ -1150,10 +1158,6 @@ __s32 BSP_disp_clk_off(__u32 type)
OSAL_CCMU_MclkOnOff(h_lcd1ch1mclk1, CLK_OFF);
OSAL_CCMU_MclkOnOff(h_lcd1ch1mclk2, CLK_OFF);
}
if((g_clk_status & CLK_HDMI_MOD_ON) == CLK_HDMI_MOD_ON)
{
OSAL_CCMU_MclkOnOff(h_hdmimclk, CLK_OFF);
}
}

if(type == 2)
Expand Down
14 changes: 9 additions & 5 deletions drivers/video/sun5i/disp/de_bsp/de/disp_event.c
Expand Up @@ -3,6 +3,7 @@
#include "disp_de.h"
#include "disp_video.h"
#include "disp_scaler.h"
#include "disp_clk.h"

__s32 BSP_disp_cmd_cache(__u32 sel)
{
Expand Down Expand Up @@ -35,7 +36,10 @@ void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)
{
__u32 cur_line = 0, start_delay = 0;
__u32 i = 0;


// if(BSP_disp_get_output_type(sel) == DISP_OUTPUT_TYPE_NONE)
// return;

Video_Operation_In_Vblanking(sel, tcon_index);


Expand Down Expand Up @@ -70,7 +74,7 @@ void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)
Scaler_close(i);
gdisp.scaler[i].b_close = FALSE;
}
if(gdisp.scaler[i].coef_change == TRUE)
if((gdisp.scaler[i].status & SCALER_USED) && (gdisp.scaler[i].screen_index == sel) && (gdisp.scaler[i].coef_change == TRUE))
{
__scal_src_size_t in_size;
__scal_out_size_t out_size;
Expand All @@ -80,7 +84,7 @@ void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)
__scal_scan_mod_t out_scan;
__disp_scaler_t * scaler;

scaler = &(gdisp.scaler[sel]);
scaler = &(gdisp.scaler[i]);

in_scan.field = FALSE;
in_scan.bottom = FALSE;
Expand All @@ -105,8 +109,8 @@ void LCD_vbi_event_proc(__u32 sel, __u32 tcon_index)

out_size.width = scaler->out_size.width;
out_size.height = scaler->out_size.height;
DE_SCAL_Set_Scaling_Coef(sel, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, scaler->smooth_mode);
//__inf("vint\n");
DE_SCAL_Set_Scaling_Coef(i, &in_scan, &in_size, &in_type, &out_scan, &out_size, &out_type, scaler->smooth_mode);

gdisp.scaler[i].coef_change = FALSE;
}
Expand Down
25 changes: 24 additions & 1 deletion drivers/video/sun5i/disp/de_bsp/de/disp_hdmi.c
Expand Up @@ -219,6 +219,29 @@ __s32 BSP_disp_set_hdmi_func(__disp_hdmi_func * func)
gdisp.init_para.hdmi_mode_support = func->hdmi_mode_support;
gdisp.init_para.hdmi_get_HPD_status = func->hdmi_get_HPD_status;
gdisp.init_para.hdmi_set_pll = func->hdmi_set_pll;

gdisp.init_para.hdmi_suspend = func->hdmi_suspend;
gdisp.init_para.hdmi_resume = func->hdmi_resume;

return DIS_SUCCESS;
}

__s32 BSP_disp_hdmi_suspend()
{
if(gdisp.init_para.hdmi_suspend)
{
return gdisp.init_para.hdmi_suspend();
}

return -1;
}

__s32 BSP_disp_hdmi_resume()
{
if(gdisp.init_para.hdmi_resume)
{
return gdisp.init_para.hdmi_resume();
}

return -1;
}

2 changes: 1 addition & 1 deletion drivers/video/sun5i/disp/de_bsp/de/disp_lcd.c
Expand Up @@ -1717,7 +1717,7 @@ __s32 BSP_disp_lcd_set_bright(__u32 sel, __u32 bright, __u32 from_iep)
{
__u32 duty_ns;

if((OSAL_sw_get_ic_ver() != 0xA) && (gpanel_info[sel].lcd_pwm_not_used == 0))
if((OSAL_sw_get_ic_ver() != 0xA) && (gpanel_info[sel].lcd_pwm_not_used == 0) && (gdisp.screen[sel].lcd_cfg.lcd_used))
{
if(gpanel_info[sel].lcd_pwm_pol == 0)
{
Expand Down
8 changes: 6 additions & 2 deletions drivers/video/sun5i/disp/de_bsp/de/ebios/de_fe.c
Expand Up @@ -517,6 +517,7 @@ __s32 DE_SCAL_Set_Scaling_Coef(__u8 sel, __scal_scan_mod_t *in_scan, __scal_src_
__u32 ch0v_fir_coef_ofst, ch0h_fir_coef_ofst, ch1v_fir_coef_ofst, ch1h_fir_coef_ofst;
__s32 fir_ofst_tmp;
__u32 i;
__u32 loop_count = 0;

in_w0 = in_size->scal_width;
in_h0 = in_size->scal_height;
Expand Down Expand Up @@ -688,10 +689,13 @@ __s32 DE_SCAL_Set_Scaling_Coef(__u8 sel, __scal_scan_mod_t *in_scan, __scal_src_
ch1h_fir_coef_addr = (ch1h_fir_coef_ofst<<7);

//added for aw1625, wait ceof access
scal_dev[sel]->frm_ctrl.bits.coef_access_ctrl= 1;
while(scal_dev[sel]->status.bits.coef_access_status == 0)
scal_dev[sel]->frm_ctrl.bits.coef_access_ctrl= 1;

while((scal_dev[sel]->status.bits.coef_access_status == 0) && (loop_count < 10))
{
loop_count ++;
}

for(i=0; i<32; i++)
{
scal_dev[sel]->ch0_horzcoef0[i].dwval = fir_tab[(ch0h_fir_coef_addr>>2) + i];
Expand Down
29 changes: 10 additions & 19 deletions drivers/video/sun5i/disp/dev_disp.c
Expand Up @@ -24,9 +24,6 @@ static struct cdev *my_cdev;
static dev_t devid ;
static struct class *disp_class;

static unsigned long jiffies_resume;
static unsigned long jiffies_late_resume;

static struct resource disp_resource[DISP_IO_NUM] =
{
[DISP_IO_SCALER0] = {
Expand Down Expand Up @@ -567,8 +564,10 @@ void backlight_late_resume(struct early_suspend *h)

pr_info("==display late resume enter\n");

BSP_disp_clk_on(2);

if(suspend_prestep != 2)
{
BSP_disp_clk_on(2);
}
for(i=0; i<2; i++)
{
if(suspend_output_type[i] == DISP_OUTPUT_TYPE_LCD)
Expand All @@ -591,9 +590,6 @@ void backlight_late_resume(struct early_suspend *h)
{
DRV_lcd_open(i);
}
jiffies_late_resume = jiffies;
//pr_info("==jiffies_resume:%ld, late_resume:%ld\n", jiffies_resume, jiffies_late_resume);

}
else if(suspend_output_type[i] == DISP_OUTPUT_TYPE_TV)
{
Expand Down Expand Up @@ -677,10 +673,12 @@ int disp_suspend(struct platform_device *pdev, pm_message_t state)
BSP_disp_store_scaler_reg(0, scaler0_reg_bak);
}

BSP_disp_hdmi_suspend();
#ifndef CONFIG_HAS_EARLYSUSPEND
BSP_disp_clk_off(3);
#else
BSP_disp_clk_off(1);
BSP_disp_clk_off(2);
#endif

suspend_status |= 2;
Expand All @@ -694,12 +692,8 @@ int disp_resume(struct platform_device *pdev)
int i = 0;
pr_info("==disp_resume call\n");

#ifndef CONFIG_HAS_EARLYSUSPEND
BSP_disp_clk_on(3);
#else
BSP_disp_clk_on(1);
#endif

BSP_disp_clk_on(2);
if(SUPER_STANDBY == standby_type)
{

Expand All @@ -717,9 +711,6 @@ int disp_resume(struct platform_device *pdev)

#ifndef CONFIG_HAS_EARLYSUSPEND
{

BSP_disp_clk_on(3);

for(i=0; i<2; i++)
{
if(suspend_output_type[i] == DISP_OUTPUT_TYPE_LCD)
Expand All @@ -741,7 +732,6 @@ int disp_resume(struct platform_device *pdev)
}
}
#else
jiffies_resume = jiffies;

for(i=0; i<2; i++)
{
Expand All @@ -753,10 +743,11 @@ int disp_resume(struct platform_device *pdev)
}

#endif


BSP_disp_hdmi_resume();

suspend_status &= (~2);
suspend_prestep = 2;

return 0;
}

Expand Down
22 changes: 21 additions & 1 deletion drivers/video/sun5i/hdmi/drv_hdmi.c
Expand Up @@ -6,6 +6,8 @@

static struct semaphore *run_sem = NULL;
static struct task_struct * HDMI_task;
__s32 Hdmi_suspend(void);
__s32 Hdmi_resume(void);

void hdmi_delay_ms(__u32 t)
{
Expand Down Expand Up @@ -217,7 +219,10 @@ int Hdmi_run_thread(void *parg)
//{
// down(run_sem);
//}

if(kthread_should_stop())
{
break;
}
Hdmi_hal_main_task();

if(ghdmi.bopen)
Expand Down Expand Up @@ -269,6 +274,8 @@ __s32 Hdmi_init(void)
disp_func.hdmi_mode_support = Hdmi_mode_support;
disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status;
disp_func.hdmi_set_pll = Hdmi_set_pll;
disp_func.hdmi_suspend = Hdmi_suspend;
disp_func.hdmi_resume = Hdmi_resume;
disp_set_hdmi_func(&disp_func);

return 0;
Expand All @@ -292,3 +299,16 @@ __s32 Hdmi_exit(void)
return 0;
}

__s32 Hdmi_suspend(void)
{
Hdmi_init();

return 0;
}

__s32 Hdmi_resume(void)
{
Hdmi_exit();

return 0;
}
2 changes: 2 additions & 0 deletions include/linux/drv_display_sun4i.h
Expand Up @@ -375,6 +375,8 @@ typedef struct
__s32 (*hdmi_mode_support)(__disp_tv_mode_t mode);
__s32 (*hdmi_get_HPD_status)(void);
__s32 (*hdmi_set_pll)(__u32 pll, __u32 clk);
__s32 (*hdmi_suspend)(void);
__s32 (*hdmi_resume)(void);
}__disp_hdmi_func;

typedef struct
Expand Down

0 comments on commit 158d41e

Please sign in to comment.