diff options
-rw-r--r-- | drivers/video/tridentfb.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index 6b3bb1e20738..62701c5570fd 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -829,6 +829,7 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, | |||
829 | { | 829 | { |
830 | struct tridentfb_par *par = info->par; | 830 | struct tridentfb_par *par = info->par; |
831 | int bpp = var->bits_per_pixel; | 831 | int bpp = var->bits_per_pixel; |
832 | int ramdac = 230000; /* 230MHz for most 3D chips */ | ||
832 | debug("enter\n"); | 833 | debug("enter\n"); |
833 | 834 | ||
834 | /* check color depth */ | 835 | /* check color depth */ |
@@ -837,6 +838,12 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, | |||
837 | /* check whether resolution fits on panel and in memory */ | 838 | /* check whether resolution fits on panel and in memory */ |
838 | if (par->flatpanel && nativex && var->xres > nativex) | 839 | if (par->flatpanel && nativex && var->xres > nativex) |
839 | return -EINVAL; | 840 | return -EINVAL; |
841 | /* various resolution checks */ | ||
842 | var->xres = (var->xres + 7) & ~0x7; | ||
843 | if (var->xres != var->xres_virtual) | ||
844 | var->xres_virtual = var->xres; | ||
845 | if (var->yres > var->yres_virtual) | ||
846 | var->yres_virtual = var->yres; | ||
840 | if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len) | 847 | if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len) |
841 | return -EINVAL; | 848 | return -EINVAL; |
842 | 849 | ||
@@ -868,6 +875,33 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, | |||
868 | default: | 875 | default: |
869 | return -EINVAL; | 876 | return -EINVAL; |
870 | } | 877 | } |
878 | |||
879 | if (is_xp(par->chip_id)) | ||
880 | ramdac = 350000; | ||
881 | |||
882 | switch (par->chip_id) { | ||
883 | case TGUI9440: | ||
884 | ramdac = 90000; | ||
885 | break; | ||
886 | case CYBER9320: | ||
887 | case TGUI9660: | ||
888 | ramdac = 135000; | ||
889 | break; | ||
890 | case PROVIDIA9685: | ||
891 | case CYBER9388: | ||
892 | case CYBER9382: | ||
893 | case CYBER9385: | ||
894 | ramdac = 170000; | ||
895 | break; | ||
896 | } | ||
897 | |||
898 | /* The clock is doubled for 32 bpp */ | ||
899 | if (bpp == 32) | ||
900 | ramdac /= 2; | ||
901 | |||
902 | if (PICOS2KHZ(var->pixclock) > ramdac) | ||
903 | return -EINVAL; | ||
904 | |||
871 | debug("exit\n"); | 905 | debug("exit\n"); |
872 | 906 | ||
873 | return 0; | 907 | return 0; |