diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-03-11 00:21:30 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-13 00:52:33 +0100 |
commit | c5f06f5cddd6681b978ffdb53755e28eefccb1bb (patch) | |
tree | cf195fe5b85a03fbb4be13b905e3e4b8faed21a9 /drivers/video/via/dvi.c | |
parent | viafb: remove the remaining VIA_RES_* uses (diff) | |
download | linux-c5f06f5cddd6681b978ffdb53755e28eefccb1bb.tar.xz linux-c5f06f5cddd6681b978ffdb53755e28eefccb1bb.zip |
viafb: some dvi cleanup
Remove some unused variables, move some dvi code around and store the
detected maximum resolution for later use. The vertical resolution is
handled as the old code did it but I hope it can be read from the hardware
some day.
No runtime change expected.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/via/dvi.c')
-rw-r--r-- | drivers/video/via/dvi.c | 107 |
1 files changed, 49 insertions, 58 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c index 9cb261ce6e35..0e0852e6df26 100644 --- a/drivers/video/via/dvi.c +++ b/drivers/video/via/dvi.c @@ -23,9 +23,10 @@ static void tmds_register_write(int index, u8 data); static int tmds_register_read(int index); static int tmds_register_read_bytes(int index, u8 *buff, int buff_len); -static void dvi_get_panel_size_from_DDCv1(void); -static void dvi_get_panel_size_from_DDCv2(void); -static void dvi_get_panel_info(void); +static void dvi_get_panel_size_from_DDCv1(struct tmds_chip_information + *tmds_chip, struct tmds_setting_information *tmds_setting); +static void dvi_get_panel_size_from_DDCv2(struct tmds_chip_information + *tmds_chip, struct tmds_setting_information *tmds_setting); static int viafb_dvi_query_EDID(void); static int check_tmds_chip(int device_id_subaddr, int device_id) @@ -36,23 +37,24 @@ static int check_tmds_chip(int device_id_subaddr, int device_id) return FAIL; } -void viafb_init_dvi_size(void) +void viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, + struct tmds_setting_information *tmds_setting) { DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n"); - DEBUG_MSG(KERN_INFO - "viaparinfo->tmds_setting_info->get_dvi_size_method %d\n", - viaparinfo->tmds_setting_info->get_dvi_size_method); - switch (viaparinfo->tmds_setting_info->get_dvi_size_method) { - case GET_DVI_SIZE_BY_SYSTEM_BIOS: + viafb_dvi_sense(); + switch (viafb_dvi_query_EDID()) { + case 1: + dvi_get_panel_size_from_DDCv1(tmds_chip, tmds_setting); break; - case GET_DVI_SZIE_BY_HW_STRAPPING: + case 2: + dvi_get_panel_size_from_DDCv2(tmds_chip, tmds_setting); break; - case GET_DVI_SIZE_BY_VGA_BIOS: default: - dvi_get_panel_info(); + printk(KERN_WARNING "viafb_init_dvi_size: DVI panel size undetected!\n"); break; } + return; } @@ -314,11 +316,9 @@ static int viafb_dvi_query_EDID(void) return false; } -/* void dvi_get_panel_size_from_DDCv1(void) - * - * - Get Panel Size Using EDID1 Table - */ -static void dvi_get_panel_size_from_DDCv1(void) +/* Get Panel Size Using EDID1 Table */ +static void dvi_get_panel_size_from_DDCv1(struct tmds_chip_information + *tmds_chip, struct tmds_setting_information *tmds_setting) { int i, max_h = 0, tmp, restore; unsigned char rData; @@ -326,8 +326,8 @@ static void dvi_get_panel_size_from_DDCv1(void) DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv1 \n"); - restore = viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr; - viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = 0xA0; + restore = tmds_chip->tmds_chip_slave_addr; + tmds_chip->tmds_chip_slave_addr = 0xA0; rData = tmds_register_read(0x23); if (rData & 0x3C) @@ -373,8 +373,8 @@ static void dvi_get_panel_size_from_DDCv1(void) /* The first two byte must be zero. */ if (EDID_DATA[3] == 0xFD) { /* To get max pixel clock. */ - viaparinfo->tmds_setting_info-> - max_pixel_clock = EDID_DATA[9] * 10; + tmds_setting->max_pixel_clock = + EDID_DATA[9] * 10; } } break; @@ -384,23 +384,31 @@ static void dvi_get_panel_size_from_DDCv1(void) } } + tmds_setting->max_hres = max_h; switch (max_h) { case 640: + tmds_setting->max_vres = 480; break; case 800: + tmds_setting->max_vres = 600; break; case 1024: + tmds_setting->max_vres = 768; break; case 1280: + tmds_setting->max_vres = 1024; break; case 1400: + tmds_setting->max_vres = 1050; break; case 1440: + tmds_setting->max_vres = 1050; break; case 1600: + tmds_setting->max_vres = 1200; break; case 1920: - + tmds_setting->max_vres = 1080; break; default: DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d !\ @@ -409,72 +417,55 @@ static void dvi_get_panel_size_from_DDCv1(void) } DEBUG_MSG(KERN_INFO "DVI max pixelclock = %d\n", - viaparinfo->tmds_setting_info->max_pixel_clock); - viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = restore; + tmds_setting->max_pixel_clock); + tmds_chip->tmds_chip_slave_addr = restore; } -/* void dvi_get_panel_size_from_DDCv2(void) - * - * - Get Panel Size Using EDID2 Table - */ -static void dvi_get_panel_size_from_DDCv2(void) +/* Get Panel Size Using EDID2 Table */ +static void dvi_get_panel_size_from_DDCv2(struct tmds_chip_information + *tmds_chip, struct tmds_setting_information *tmds_setting) { - int HSize = 0, restore; + int restore; unsigned char R_Buffer[2]; DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv2 \n"); - restore = viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr; - viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = 0xA2; + restore = tmds_chip->tmds_chip_slave_addr; + tmds_chip->tmds_chip_slave_addr = 0xA2; /* Horizontal: 0x76, 0x77 */ tmds_register_read_bytes(0x76, R_Buffer, 2); - HSize = R_Buffer[0]; - HSize += R_Buffer[1] << 8; + tmds_setting->max_hres = R_Buffer[0] + (R_Buffer[1] << 8); - switch (HSize) { + switch (tmds_setting->max_hres) { case 640: + tmds_setting->max_vres = 480; break; case 800: + tmds_setting->max_vres = 600; break; case 1024: + tmds_setting->max_vres = 768; break; case 1280: + tmds_setting->max_vres = 1024; break; case 1400: + tmds_setting->max_vres = 1050; break; case 1440: + tmds_setting->max_vres = 1050; break; case 1600: + tmds_setting->max_vres = 1200; break; default: DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d!\ - set default panel size.\n", HSize); + set default panel size.\n", tmds_setting->max_hres); break; } - viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = restore; -} - -/* unsigned char dvi_get_panel_info(void) - * - * - Get Panel Size - */ -static void dvi_get_panel_info(void) -{ - DEBUG_MSG(KERN_INFO "dvi_get_panel_info! \n"); - - viafb_dvi_sense(); - switch (viafb_dvi_query_EDID()) { - case 1: - dvi_get_panel_size_from_DDCv1(); - break; - case 2: - dvi_get_panel_size_from_DDCv2(); - break; - default: - break; - } + tmds_chip->tmds_chip_slave_addr = restore; } /* If Disable DVI, turn off pad */ |