viafb: clean up duoview
[deliverable/linux.git] / drivers / video / via / viafbdev.c
index 743eed48a5f707976c6f9e38ff6aa5eb963a289f..0cd112a3690185d6a09cab82a9b636442a30ed77 100644 (file)
@@ -53,51 +53,6 @@ static void retrieve_device_setting(struct viafb_ioctl_setting
 static void viafb_set_video_device(u32 video_dev_info);
 static void viafb_get_video_device(u32 *video_dev_info);
 
-/* Mode information */
-static const struct viafb_modeinfo viafb_modentry[] = {
-       {480, 640, VIA_RES_480X640},
-       {640, 480, VIA_RES_640X480},
-       {800, 480, VIA_RES_800X480},
-       {800, 600, VIA_RES_800X600},
-       {1024, 768, VIA_RES_1024X768},
-       {1152, 864, VIA_RES_1152X864},
-       {1280, 1024, VIA_RES_1280X1024},
-       {1600, 1200, VIA_RES_1600X1200},
-       {1440, 1050, VIA_RES_1440X1050},
-       {1280, 768, VIA_RES_1280X768,},
-       {1280, 800, VIA_RES_1280X800},
-       {1280, 960, VIA_RES_1280X960},
-       {1920, 1440, VIA_RES_1920X1440},
-       {848, 480, VIA_RES_848X480},
-       {1400, 1050, VIA_RES_1400X1050},
-       {720, 480, VIA_RES_720X480},
-       {720, 576, VIA_RES_720X576},
-       {1024, 512, VIA_RES_1024X512},
-       {1024, 576, VIA_RES_1024X576},
-       {1024, 600, VIA_RES_1024X600},
-       {1280, 720, VIA_RES_1280X720},
-       {1920, 1080, VIA_RES_1920X1080},
-       {1366, 768, VIA_RES_1368X768},
-       {1680, 1050, VIA_RES_1680X1050},
-       {960, 600, VIA_RES_960X600},
-       {1000, 600, VIA_RES_1000X600},
-       {1024, 576, VIA_RES_1024X576},
-       {1024, 600, VIA_RES_1024X600},
-       {1088, 612, VIA_RES_1088X612},
-       {1152, 720, VIA_RES_1152X720},
-       {1200, 720, VIA_RES_1200X720},
-       {1280, 600, VIA_RES_1280X600},
-       {1360, 768, VIA_RES_1360X768},
-       {1440, 900, VIA_RES_1440X900},
-       {1600, 900, VIA_RES_1600X900},
-       {1600, 1024, VIA_RES_1600X1024},
-       {1792, 1344, VIA_RES_1792X1344},
-       {1856, 1392, VIA_RES_1856X1392},
-       {1920, 1200, VIA_RES_1920X1200},
-       {2048, 1536, VIA_RES_2048X1536},
-       {0, 0, VIA_RES_INVALID}
-};
-
 static struct fb_ops viafb_ops;
 
 
@@ -1054,7 +1009,8 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
                return -ENODEV;
 
        /* When duoview and using lcd , use soft cursor */
-       if (viafb_LCD_ON || ((struct viafb_par *)(info->par))->duoview)
+       if (viafb_LCD_ON || (!viafb_SAMM_ON &&
+               viafb_LCD2_ON + viafb_DVI_ON + viafb_CRT_ON == 2))
                return -ENODEV;
 
        viafb_show_hw_cursor(info, HW_Cursor_OFF);
@@ -1239,12 +1195,16 @@ int viafb_get_mode_index(int hres, int vres)
        u32 i;
        DEBUG_MSG(KERN_INFO "viafb_get_mode_index!\n");
 
-       for (i = 0; viafb_modentry[i].mode_index != VIA_RES_INVALID; i++)
-               if (viafb_modentry[i].xres == hres &&
-                       viafb_modentry[i].yres == vres)
+       for (i = 0; i < NUM_TOTAL_MODETABLE; i++)
+               if (CLE266Modes[i].mode_array &&
+                       CLE266Modes[i].crtc[0].crtc.hor_addr == hres &&
+                       CLE266Modes[i].crtc[0].crtc.ver_addr == vres)
                        break;
 
-       return viafb_modentry[i].mode_index;
+       if (i == NUM_TOTAL_MODETABLE)
+               return VIA_RES_INVALID;
+
+       return CLE266Modes[i].ModeIndex;
 }
 
 static void check_available_device_to_enable(int device_id)
@@ -1420,18 +1380,6 @@ static int get_primary_device(void)
        return primary_device;
 }
 
-static u8 is_duoview(void)
-{
-       if (0 == viafb_SAMM_ON) {
-               if (viafb_LCD_ON + viafb_LCD2_ON +
-                       viafb_DVI_ON + viafb_CRT_ON == 2)
-                       return true;
-               return false;
-       } else {
-               return false;
-       }
-}
-
 static void apply_second_mode_setting(struct fb_var_screeninfo
        *sec_var)
 {
@@ -1540,8 +1488,6 @@ static int apply_device_setting(struct viafb_ioctl_setting setting_info,
                need_set_mode = 1;
        }
 
-       viaparinfo->duoview = is_duoview();
-
        if (!need_set_mode) {
                ;
        } else {
@@ -1662,7 +1608,6 @@ static void parse_active_dev(void)
                viafb_CRT_ON = STATE_ON;
                viafb_SAMM_ON = STATE_OFF;
        }
-       viaparinfo->duoview = is_duoview();
 }
 
 static void parse_video_dev(void)
@@ -2134,12 +2079,16 @@ static int __devinit via_pci_probe(void)
 
        if (!viaparinfo->fbmem_virt) {
                printk(KERN_INFO "ioremap failed\n");
-               return -1;
+               return -ENOMEM;
        }
 
        viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len);
        viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base,
                viaparinfo->mmio_len);
+       if (!viaparinfo->io_virt) {
+               printk(KERN_WARNING "ioremap failed: hardware acceleration disabled\n");
+               viafb_accel = 0;
+       }
 
        viafbinfo->node = 0;
        viafbinfo->fbops = &viafb_ops;
This page took 0.041748 seconds and 5 git commands to generate.