aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/viafbdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r--drivers/video/via/viafbdev.c49
1 files changed, 13 insertions, 36 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 156a900aa884..98e3bd11ae17 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -97,7 +97,8 @@ static int viafb_release(struct fb_info *info, int user)
97static int viafb_check_var(struct fb_var_screeninfo *var, 97static int viafb_check_var(struct fb_var_screeninfo *var,
98 struct fb_info *info) 98 struct fb_info *info)
99{ 99{
100 int vmode_index, htotal, vtotal; 100 int htotal, vtotal;
101 struct VideoModeTable *vmode_entry;
101 struct viafb_par *ppar = info->par; 102 struct viafb_par *ppar = info->par;
102 u32 long_refresh; 103 u32 long_refresh;
103 104
@@ -107,8 +108,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
107 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE) 108 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE)
108 return -EINVAL; 109 return -EINVAL;
109 110
110 vmode_index = viafb_get_mode_index(var->xres, var->yres); 111 vmode_entry = viafb_get_mode(var->xres, var->yres);
111 if (vmode_index == VIA_RES_INVALID) { 112 if (!vmode_entry) {
112 DEBUG_MSG(KERN_INFO 113 DEBUG_MSG(KERN_INFO
113 "viafb: Mode %dx%dx%d not supported!!\n", 114 "viafb: Mode %dx%dx%d not supported!!\n",
114 var->xres, var->yres, var->bits_per_pixel); 115 var->xres, var->yres, var->bits_per_pixel);
@@ -142,7 +143,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
142 viafb_refresh = viafb_get_refresh(var->xres, var->yres, long_refresh); 143 viafb_refresh = viafb_get_refresh(var->xres, var->yres, long_refresh);
143 144
144 /* Adjust var according to our driver's own table */ 145 /* Adjust var according to our driver's own table */
145 viafb_fill_var_timing_info(var, viafb_refresh, vmode_index); 146 viafb_fill_var_timing_info(var, viafb_refresh, vmode_entry);
146 if (info->var.accel_flags & FB_ACCELF_TEXT && 147 if (info->var.accel_flags & FB_ACCELF_TEXT &&
147 !ppar->shared->engine_mmio) 148 !ppar->shared->engine_mmio)
148 info->var.accel_flags = 0; 149 info->var.accel_flags = 0;
@@ -153,39 +154,34 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
153static int viafb_set_par(struct fb_info *info) 154static int viafb_set_par(struct fb_info *info)
154{ 155{
155 struct viafb_par *viapar = info->par; 156 struct viafb_par *viapar = info->par;
156 int vmode_index; 157 struct VideoModeTable *vmode_entry, *vmode_entry1 = NULL;
157 int vmode_index1 = 0;
158 DEBUG_MSG(KERN_INFO "viafb_set_par!\n"); 158 DEBUG_MSG(KERN_INFO "viafb_set_par!\n");
159 159
160 viapar->depth = fb_get_color_depth(&info->var, &info->fix); 160 viapar->depth = fb_get_color_depth(&info->var, &info->fix);
161 viafb_update_device_setting(info->var.xres, info->var.yres, 161 viafb_update_device_setting(info->var.xres, info->var.yres,
162 info->var.bits_per_pixel, viafb_refresh, 0); 162 info->var.bits_per_pixel, viafb_refresh, 0);
163 163
164 vmode_index = viafb_get_mode_index(info->var.xres, info->var.yres); 164 vmode_entry = viafb_get_mode(info->var.xres, info->var.yres);
165
166 if (viafb_SAMM_ON == 1) { 165 if (viafb_SAMM_ON == 1) {
167 DEBUG_MSG(KERN_INFO 166 DEBUG_MSG(KERN_INFO
168 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n", 167 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
169 viafb_second_xres, viafb_second_yres, viafb_bpp1); 168 viafb_second_xres, viafb_second_yres, viafb_bpp1);
170 vmode_index1 = viafb_get_mode_index(viafb_second_xres, 169 vmode_entry1 = viafb_get_mode(viafb_second_xres,
171 viafb_second_yres); 170 viafb_second_yres);
172 DEBUG_MSG(KERN_INFO "->viafb_SAMM_ON: index=%d\n",
173 vmode_index1);
174 171
175 viafb_update_device_setting(viafb_second_xres, 172 viafb_update_device_setting(viafb_second_xres,
176 viafb_second_yres, viafb_bpp1, viafb_refresh1, 1); 173 viafb_second_yres, viafb_bpp1, viafb_refresh1, 1);
177 } 174 }
178 175
179 if (vmode_index != VIA_RES_INVALID) { 176 if (vmode_entry) {
180 viafb_update_fix(info); 177 viafb_update_fix(info);
181 viafb_bpp = info->var.bits_per_pixel; 178 viafb_bpp = info->var.bits_per_pixel;
182 if (info->var.accel_flags & FB_ACCELF_TEXT) 179 if (info->var.accel_flags & FB_ACCELF_TEXT)
183 info->flags &= ~FBINFO_HWACCEL_DISABLED; 180 info->flags &= ~FBINFO_HWACCEL_DISABLED;
184 else 181 else
185 info->flags |= FBINFO_HWACCEL_DISABLED; 182 info->flags |= FBINFO_HWACCEL_DISABLED;
186 viafb_setmode(vmode_index, info->var.xres, info->var.yres, 183 viafb_setmode(vmode_entry, info->var.bits_per_pixel,
187 info->var.bits_per_pixel, vmode_index1, 184 vmode_entry1, viafb_bpp1);
188 viafb_second_xres, viafb_second_yres, viafb_bpp1);
189 } 185 }
190 186
191 return 0; 187 return 0;
@@ -1016,23 +1012,6 @@ static int viafb_sync(struct fb_info *info)
1016 return 0; 1012 return 0;
1017} 1013}
1018 1014
1019int viafb_get_mode_index(int hres, int vres)
1020{
1021 u32 i;
1022 DEBUG_MSG(KERN_INFO "viafb_get_mode_index!\n");
1023
1024 for (i = 0; i < NUM_TOTAL_MODETABLE; i++)
1025 if (CLE266Modes[i].mode_array &&
1026 CLE266Modes[i].crtc[0].crtc.hor_addr == hres &&
1027 CLE266Modes[i].crtc[0].crtc.ver_addr == vres)
1028 break;
1029
1030 if (i == NUM_TOTAL_MODETABLE)
1031 return VIA_RES_INVALID;
1032
1033 return CLE266Modes[i].ModeIndex;
1034}
1035
1036static void check_available_device_to_enable(int device_id) 1015static void check_available_device_to_enable(int device_id)
1037{ 1016{
1038 int device_num = 0; 1017 int device_num = 0;
@@ -1848,7 +1827,7 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
1848 const struct pci_device_id *ent) 1827 const struct pci_device_id *ent)
1849{ 1828{
1850 u32 default_xres, default_yres; 1829 u32 default_xres, default_yres;
1851 int vmode_index; 1830 struct VideoModeTable *vmode_entry;
1852 u32 viafb_par_length; 1831 u32 viafb_par_length;
1853 1832
1854 DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n"); 1833 DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n");
@@ -1927,9 +1906,7 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
1927 } 1906 }
1928 1907
1929 parse_mode(viafb_mode, &default_xres, &default_yres); 1908 parse_mode(viafb_mode, &default_xres, &default_yres);
1930 vmode_index = viafb_get_mode_index(default_xres, default_yres); 1909 vmode_entry = viafb_get_mode(default_xres, default_yres);
1931 DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
1932
1933 if (viafb_SAMM_ON == 1) { 1910 if (viafb_SAMM_ON == 1) {
1934 parse_mode(viafb_mode1, &viafb_second_xres, 1911 parse_mode(viafb_mode1, &viafb_second_xres,
1935 &viafb_second_yres); 1912 &viafb_second_yres);