Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.git] / drivers / video / via / viafbdev.c
index 6c651e4..289edd5 100644 (file)
@@ -57,7 +57,7 @@ static int viafb_pan_display(struct fb_var_screeninfo *var,
 static struct fb_ops viafb_ops;
 
 /* supported output devices on each IGP
- * only CX700, VX800, VX855 were documented
+ * only CX700, VX800, VX855, VX900 were documented
  * VIA_CRT should be everywhere
  * VIA_6C can be onle pre-CX700 (probably only on CLE266) as 6C is used for PLL
  * source selection on CX700 and later
@@ -80,6 +80,7 @@ static const u32 supported_odev_map[] = {
        [UNICHROME_P4M900]      = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
        [UNICHROME_VX800]       = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
        [UNICHROME_VX855]       = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
+       [UNICHROME_VX900]       = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
 };
 
 static void viafb_fill_var_color_info(struct fb_var_screeninfo *var, u8 depth)
@@ -812,7 +813,8 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
                bg_color = cursor->image.bg_color;
                if (chip_name == UNICHROME_CX700 ||
                        chip_name == UNICHROME_VX800 ||
-                       chip_name == UNICHROME_VX855) {
+                       chip_name == UNICHROME_VX855 ||
+                       chip_name == UNICHROME_VX900) {
                        fg_color =
                                ((info->cmap.red[fg_color] & 0xFFC0) << 14) |
                                ((info->cmap.green[fg_color] & 0xFFC0) << 4) |
@@ -1670,31 +1672,19 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
 
 
 #ifdef CONFIG_PM
-int viafb_suspend(struct pci_dev *pdev, pm_message_t state)
+static int viafb_suspend(void *unused)
 {
-       if (state.event == PM_EVENT_SUSPEND) {
-               acquire_console_sem();
-               fb_set_suspend(viafbinfo, 1);
-
-               viafb_sync(viafbinfo);
-
-               pci_save_state(pdev);
-               pci_disable_device(pdev);
-               pci_set_power_state(pdev, pci_choose_state(pdev, state));
-               release_console_sem();
-       }
+       acquire_console_sem();
+       fb_set_suspend(viafbinfo, 1);
+       viafb_sync(viafbinfo);
+       release_console_sem();
 
        return 0;
 }
 
-int viafb_resume(struct pci_dev *pdev)
+static int viafb_resume(void *unused)
 {
        acquire_console_sem();
-       pci_set_power_state(pdev, PCI_D0);
-       pci_restore_state(pdev);
-       if (pci_enable_device(pdev))
-               goto fail;
-       pci_set_master(pdev);
        if (viaparinfo->shared->vdev->engine_mmio)
                viafb_reset_engine(viaparinfo);
        viafb_set_par(viafbinfo);
@@ -1702,11 +1692,15 @@ int viafb_resume(struct pci_dev *pdev)
                viafb_set_par(viafbinfo1);
        fb_set_suspend(viafbinfo, 0);
 
-fail:
        release_console_sem();
        return 0;
 }
 
+static struct viafb_pm_hooks viafb_fb_pm_hooks = {
+       .suspend = viafb_suspend,
+       .resume = viafb_resume
+};
+
 #endif
 
 
@@ -1897,6 +1891,10 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
 
        viafb_init_proc(viaparinfo->shared);
        viafb_init_dac(IGA2);
+
+#ifdef CONFIG_PM
+       viafb_pm_register(&viafb_fb_pm_hooks);
+#endif
        return 0;
 
 out_fb_unreg: