summaryrefslogtreecommitdiff
path: root/drivers/video/via/dvi.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-07 05:51:41 +0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-07 05:51:41 +0400
commitebb29fb47e198787b8b47a74cb10334cd9647a9d (patch)
tree25ab6ed861e7ada2f2c063d4e18b4e9bb2edcd9d /drivers/video/via/dvi.c
parent42edcb162d67e8a88c7b873941c19eab689db272 (diff)
downloadlinux-ebb29fb47e198787b8b47a74cb10334cd9647a9d.tar.xz
viafb: use information in var for modesetting
This patch starts to use the information in var for modesetting for CRT and DVI devices. This is the right thing as it allows us to use more generic modes than the ones predefined by VIA. We do not yet allow more generic modes as check_var still limits them to the predefined ones but with this patch applied it would be really easy to do so. A problem was VIAs SAMM mode as it has 2 different modes but just one frame buffer device. This is solved by creating a pseudo var which contains enough information to use it for modesetting. Hopefully one day we can use information in var for all modes that do not involve hardware scaling. Well I'd like to say that the chance of regressions is low but it is quite likely that the behaviour in some cases changed especially when SAMM is involved. I hope we made it better than before in particular the DVI frequency check was probably broken before and hopefully works better now. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via/dvi.c')
-rw-r--r--drivers/video/via/dvi.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index c7ff5c0e9c7e..9138e517267c 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -172,28 +172,20 @@ static int tmds_register_read_bytes(int index, u8 *buff, int buff_len)
}
/* DVI Set Mode */
-void viafb_dvi_set_mode(struct VideoModeTable *mode, int mode_bpp,
- int set_iga)
+void viafb_dvi_set_mode(const struct fb_var_screeninfo *var, int iga)
{
- struct VideoModeTable *rb_mode;
- struct crt_mode_table *pDviTiming;
- unsigned long desirePixelClock, maxPixelClock;
- pDviTiming = mode->crtc;
- desirePixelClock = pDviTiming->refresh_rate
- * pDviTiming->crtc.hor_total * pDviTiming->crtc.ver_total
- / 1000000;
- maxPixelClock = (unsigned long)viaparinfo->
- tmds_setting_info->max_pixel_clock;
-
- DEBUG_MSG(KERN_INFO "\nDVI_set_mode!!\n");
-
- if ((maxPixelClock != 0) && (desirePixelClock > maxPixelClock)) {
- rb_mode = viafb_get_rb_mode(mode->crtc[0].crtc.hor_addr,
- mode->crtc[0].crtc.ver_addr);
+ struct fb_var_screeninfo dvi_var = *var;
+ struct crt_mode_table *rb_mode;
+ int maxPixelClock;
+
+ maxPixelClock = viaparinfo->shared->tmds_setting_info.max_pixel_clock;
+ if (maxPixelClock && PICOS2KHZ(var->pixclock) / 1000 > maxPixelClock) {
+ rb_mode = viafb_get_best_rb_mode(var->xres, var->yres, 60);
if (rb_mode)
- mode = rb_mode;
+ viafb_fill_var_timing_info(&dvi_var, rb_mode);
}
- viafb_fill_crtc_timing(mode, mode_bpp / 8, set_iga);
+
+ viafb_fill_crtc_timing(&dvi_var, iga);
}
/* Sense DVI Connector */