From 7475d042cb21f1e9c1003b0be0ed05a54f17f393 Mon Sep 17 00:00:00 2001 From: kfx Date: Fri, 24 Dec 2010 10:12:35 +0800 Subject: [PATCH] update hdmi driver --- drivers/video/hdmi/chips/anx7150.c | 2 +- drivers/video/hdmi/chips/anx7150_hw.c | 1 + drivers/video/hdmi/hdmi-core.c | 12 +++++++++++- drivers/video/hdmi/hdmi-fb.c | 27 +++++++++++++++++++++++++-- include/linux/hdmi.h | 2 ++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/drivers/video/hdmi/chips/anx7150.c b/drivers/video/hdmi/chips/anx7150.c index 11ccb27bdc67..2c412bfbe13e 100755 --- a/drivers/video/hdmi/chips/anx7150.c +++ b/drivers/video/hdmi/chips/anx7150.c @@ -392,7 +392,7 @@ static int anx7150_i2c_probe(struct i2c_client *client,const struct i2c_device_i ANX7150_API_Initial(client); queue_delayed_work(anx->dev.workqueue, &anx->dev.delay_work, 200); } - hdmi_dbg(&client->dev, "anx7150 i2c probe ok\n"); + dev_info(&client->dev, "anx7150 i2c probe ok\n"); return 0; err_request_irq: diff --git a/drivers/video/hdmi/chips/anx7150_hw.c b/drivers/video/hdmi/chips/anx7150_hw.c index 61372581ebd8..f2bafff90617 100755 --- a/drivers/video/hdmi/chips/anx7150_hw.c +++ b/drivers/video/hdmi/chips/anx7150_hw.c @@ -1064,6 +1064,7 @@ int ANX7150_Interrupt_Process(struct anx7150_pdata *anx, int cur_state) anx->dev.HPD_change_cnt = 0; anx->dev.HPD_status = hot_plug; } + return state; if(state != HDMI_INITIAL && state != WAIT_HOTPLUG){ if(interrupt_staus.video_format_change){ if(state > SYSTEM_CONFIG){ diff --git a/drivers/video/hdmi/hdmi-core.c b/drivers/video/hdmi/hdmi-core.c index 047a22eb7792..59d17e4fab89 100755 --- a/drivers/video/hdmi/hdmi-core.c +++ b/drivers/video/hdmi/hdmi-core.c @@ -7,6 +7,7 @@ struct class *hdmi_class; struct hdmi_id_ref_info { + struct hdmi *hdmi; int id; int ref; }ref_info[HDMI_MAX_ID]; @@ -76,6 +77,7 @@ int hdmi_register(struct device *parent, struct hdmi *hdmi) } dev_set_drvdata(hdmi->dev, hdmi); + ref_info[i].hdmi = hdmi; INIT_WORK(&hdmi->changed_work, hdmi_changed_work); @@ -99,8 +101,15 @@ void hdmi_unregister(struct hdmi *hdmi) hdmi_remove_attrs(hdmi); device_unregister(hdmi->dev); ref_info[hdmi->id].ref = 0; + ref_info[hdmi->id].hdmi = NULL; +} +struct hdmi *get_hdmi_struct(int nr) +{ + if(ref_info[nr].ref == 0) + return NULL; + else + return ref_info[nr].hdmi; } - static int __init hdmi_class_init(void) { int i; @@ -112,6 +121,7 @@ static int __init hdmi_class_init(void) for(i = 0; i < HDMI_MAX_ID; i++) { ref_info[i].id = i; ref_info[i].ref = 0; + ref_info[i].hdmi = NULL; } return 0; } diff --git a/drivers/video/hdmi/hdmi-fb.c b/drivers/video/hdmi/hdmi-fb.c index b0728689e507..c937dc72a512 100755 --- a/drivers/video/hdmi/hdmi-fb.c +++ b/drivers/video/hdmi/hdmi-fb.c @@ -7,9 +7,11 @@ /* Base */ +#define LCD_ACLK 312000000 + #define OUT_TYPE SCREEN_RGB #define OUT_FACE OUT_P888 -#define DCLK_POL 0 +#define DCLK_POL 1 #define SWAP_RB 0 /* 720p@60Hz Timing */ @@ -86,6 +88,7 @@ static void hdmi_set_info(struct rk29fb_screen *screen) /* Timing */ screen->pixclock = OUT_CLK; + screen4->lcdc_aclk = LCD_ACLK; screen->left_margin = H_BP; screen->right_margin = H_FP; screen->hsync_len = H_PW; @@ -122,6 +125,7 @@ static void hdmi_set_info(struct rk29fb_screen *screen) /* Timing */ screen2->pixclock = OUT_CLK2; + screen2->lcdc_aclk = LCD_ACLK; screen2->left_margin = H_BP2; screen2->right_margin = H_FP2; screen2->hsync_len = H_PW2; @@ -157,6 +161,7 @@ static void hdmi_set_info(struct rk29fb_screen *screen) /* Timing */ screen3->pixclock = OUT_CLK3; + screen3->lcdc_aclk = LCD_ACLK; screen3->left_margin = H_BP3; screen3->right_margin = H_FP3; screen3->hsync_len = H_PW3; @@ -191,6 +196,7 @@ static void hdmi_set_info(struct rk29fb_screen *screen) /* Timing */ screen4->pixclock = OUT_CLK4; + screen4->lcdc_aclk = LCD_ACLK; screen4->left_margin = H_BP4; screen4->right_margin = H_FP4; screen4->hsync_len = H_PW4; @@ -243,4 +249,21 @@ int hdmi_switch_fb(int resolution, int type) } return rc; } - +int hdmi_resolution_changed(struct hdmi *hdmi, int xres, int yres) +{ + if(xres > 1280 && hdmi->resolution != HDMI_1920x1080p_50Hz) { + hdmi->resolution = HDMI_1920x1080p_50Hz; + hdmi->display_on = 1; + hdmi->hdmi_set_param(hdmi); + } + else if(xres >1024 && hdmi->resolution != HDMI_1280x720p_50Hz){ + hdmi->resolution = HDMI_1280x720p_50Hz; + hdmi->display_on = 1; + hdmi->hdmi_set_param(hdmi); + } + else { + if(hdmi->display_on == 1) + hdmi->hdmi_display_off(hdmi); + } + return 0; +} diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index cf64568b42ef..bf5194fb9740 100755 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -67,6 +67,8 @@ extern int hdmi_codec_set_audio_fs(unsigned char audio_fs); extern int hdmi_fb_set_resolution(unsigned char resolution); extern int hdmi_switch_fb(int resolution, int type); +extern int hdmi_resolution_changed(struct hdmi *hdmi, int xres, int yres); +extern struct hdmi *get_hdmi_struct(int nr); #endif -- 2.34.1