diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-03-10 18:21:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:33 -0500 |
commit | dd73d6868b9ecb4841def0c6ff0a25da27db33ba (patch) | |
tree | 353558254ac6ad9561beb6f3bac7b5254301c95c /drivers/video/via/dvi.c | |
parent | 2365dfe99495159b3395dd0eddece2f0d58f527a (diff) |
viafb: split global index up
This is the first step to remove an artificial global index that was used
in two ways:
1. As a pseudo index in the mode table. Pseudo as you had to search
through the table to find the referenced entry. This was replaced by
using a pointer to the entry.
2. As a shortcut to compare a combination of horizontal and vertical
resolution at the same time.
This was replaced by a "(hres<<16) | vres" which is good enough for
now and the near future. If vres or hres become greater than 2^16 this
might indeed cause problems but this solution allows to split this
indexing mess up without the requirement to do even more code changes.
This is a big change that will allow more clean ups. It should be a bit
faster but that is probably not relevant for normal operation. No
regressions expected but as this is a relatively big step heavy testing is
appreciated.
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 | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c index 67b36932212b..92f75934e124 100644 --- a/drivers/video/via/dvi.c +++ b/drivers/video/via/dvi.c | |||
@@ -23,8 +23,6 @@ | |||
23 | static void tmds_register_write(int index, u8 data); | 23 | static void tmds_register_write(int index, u8 data); |
24 | static int tmds_register_read(int index); | 24 | static int tmds_register_read(int index); |
25 | static int tmds_register_read_bytes(int index, u8 *buff, int buff_len); | 25 | static int tmds_register_read_bytes(int index, u8 *buff, int buff_len); |
26 | static int check_reduce_blanking_mode(int mode_index, | ||
27 | int refresh_rate); | ||
28 | static int dvi_get_panel_size_from_DDCv1(void); | 26 | static int dvi_get_panel_size_from_DDCv1(void); |
29 | static int dvi_get_panel_size_from_DDCv2(void); | 27 | static int dvi_get_panel_size_from_DDCv2(void); |
30 | static unsigned char dvi_get_panel_info(void); | 28 | static unsigned char dvi_get_panel_info(void); |
@@ -189,42 +187,14 @@ static int tmds_register_read_bytes(int index, u8 *buff, int buff_len) | |||
189 | return 0; | 187 | return 0; |
190 | } | 188 | } |
191 | 189 | ||
192 | static int check_reduce_blanking_mode(int mode_index, | ||
193 | int refresh_rate) | ||
194 | { | ||
195 | if (refresh_rate != 60) | ||
196 | return false; | ||
197 | |||
198 | switch (mode_index) { | ||
199 | /* Following modes have reduce blanking mode. */ | ||
200 | case VIA_RES_1360X768: | ||
201 | case VIA_RES_1400X1050: | ||
202 | case VIA_RES_1440X900: | ||
203 | case VIA_RES_1600X900: | ||
204 | case VIA_RES_1680X1050: | ||
205 | case VIA_RES_1920X1080: | ||
206 | case VIA_RES_1920X1200: | ||
207 | break; | ||
208 | |||
209 | default: | ||
210 | DEBUG_MSG(KERN_INFO | ||
211 | "This dvi mode %d have no reduce blanking mode!\n", | ||
212 | mode_index); | ||
213 | return false; | ||
214 | } | ||
215 | |||
216 | return true; | ||
217 | } | ||
218 | |||
219 | /* DVI Set Mode */ | 190 | /* DVI Set Mode */ |
220 | void viafb_dvi_set_mode(int video_index, int mode_bpp, int set_iga) | 191 | void viafb_dvi_set_mode(struct VideoModeTable *mode, int mode_bpp, |
192 | int set_iga) | ||
221 | { | 193 | { |
222 | struct VideoModeTable *videoMode = NULL; | 194 | struct VideoModeTable *rb_mode; |
223 | struct crt_mode_table *pDviTiming; | 195 | struct crt_mode_table *pDviTiming; |
224 | unsigned long desirePixelClock, maxPixelClock; | 196 | unsigned long desirePixelClock, maxPixelClock; |
225 | int status = 0; | 197 | pDviTiming = mode->crtc; |
226 | videoMode = viafb_get_modetbl_pointer(video_index); | ||
227 | pDviTiming = videoMode->crtc; | ||
228 | desirePixelClock = pDviTiming->clk / 1000000; | 198 | desirePixelClock = pDviTiming->clk / 1000000; |
229 | maxPixelClock = (unsigned long)viaparinfo-> | 199 | maxPixelClock = (unsigned long)viaparinfo-> |
230 | tmds_setting_info->max_pixel_clock; | 200 | tmds_setting_info->max_pixel_clock; |
@@ -232,20 +202,14 @@ void viafb_dvi_set_mode(int video_index, int mode_bpp, int set_iga) | |||
232 | DEBUG_MSG(KERN_INFO "\nDVI_set_mode!!\n"); | 202 | DEBUG_MSG(KERN_INFO "\nDVI_set_mode!!\n"); |
233 | 203 | ||
234 | if ((maxPixelClock != 0) && (desirePixelClock > maxPixelClock)) { | 204 | if ((maxPixelClock != 0) && (desirePixelClock > maxPixelClock)) { |
235 | /*Check if reduce-blanking mode is exist */ | 205 | rb_mode = viafb_get_rb_mode(mode->crtc[0].crtc.hor_addr, |
236 | status = | 206 | mode->crtc[0].crtc.ver_addr); |
237 | check_reduce_blanking_mode(video_index, | 207 | if (rb_mode) { |
238 | pDviTiming->refresh_rate); | 208 | mode = rb_mode; |
239 | if (status) { | 209 | pDviTiming = rb_mode->crtc; |
240 | video_index += 100; /*Use reduce-blanking mode */ | ||
241 | videoMode = viafb_get_modetbl_pointer(video_index); | ||
242 | pDviTiming = videoMode->crtc; | ||
243 | DEBUG_MSG(KERN_INFO | ||
244 | "DVI use reduce blanking mode %d!!\n", | ||
245 | video_index); | ||
246 | } | 210 | } |
247 | } | 211 | } |
248 | viafb_fill_crtc_timing(pDviTiming, video_index, mode_bpp / 8, set_iga); | 212 | viafb_fill_crtc_timing(pDviTiming, mode, mode_bpp / 8, set_iga); |
249 | viafb_set_output_path(DEVICE_DVI, set_iga, | 213 | viafb_set_output_path(DEVICE_DVI, set_iga, |
250 | viaparinfo->chip_info->tmds_chip_info.output_interface); | 214 | viaparinfo->chip_info->tmds_chip_info.output_interface); |
251 | } | 215 | } |