PM: video drivers and PM_EVENT_PRETHAW
authorDavid Brownell <david-b@pacbell.net>
Tue, 15 Aug 2006 06:11:06 +0000 (23:11 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Sep 2006 04:08:37 +0000 (21:08 -0700)
Video drivers which explicitly test for messages reporting PM_EVENT_FREEZE
will now handle PM_EVENT_PRETHAW the same way.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/video/aty/radeon_pm.c
drivers/video/i810/i810_main.c
drivers/video/nvidia/nvidia.c
drivers/video/savage/savagefb_driver.c

index e308ed2d249abdbebda6a00422206b2708b8d6f4..365de5dcc888edf9c37766276f091ae689da648e 100644 (file)
@@ -2621,25 +2621,28 @@ static int radeon_restore_pci_cfg(struct radeonfb_info *rinfo)
 }
 
 
-int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
        int i;
 
-       if (state.event == pdev->dev.power.power_state.event)
+       if (mesg.event == pdev->dev.power.power_state.event)
                return 0;
 
-       printk(KERN_DEBUG "radeonfb (%s): suspending to state: %d...\n",
-              pci_name(pdev), state.event);
+       printk(KERN_DEBUG "radeonfb (%s): suspending for event: %d...\n",
+              pci_name(pdev), mesg.event);
 
        /* For suspend-to-disk, we cheat here. We don't suspend anything and
         * let fbcon continue drawing until we are all set. That shouldn't
         * really cause any problem at this point, provided that the wakeup
         * code knows that any state in memory may not match the HW
         */
-       if (state.event == PM_EVENT_FREEZE)
+       switch (mesg.event) {
+       case PM_EVENT_FREEZE:           /* about to take snapshot */
+       case PM_EVENT_PRETHAW:          /* before restoring snapshot */
                goto done;
+       }
 
        acquire_console_sem();
 
@@ -2706,7 +2709,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        release_console_sem();
 
  done:
-       pdev->dev.power.power_state = state;
+       pdev->dev.power.power_state = mesg;
 
        return 0;
 }
index a6ca02f2156a810b03cc91161e1aba4644a7531e..d42edaccb84c732bab17286ef9b5fc90687ca419 100644 (file)
@@ -1554,15 +1554,17 @@ static struct fb_ops i810fb_ops __devinitdata = {
 /***********************************************************************
  *                         Power Management                            *
  ***********************************************************************/
-static int i810fb_suspend(struct pci_dev *dev, pm_message_t state)
+static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg)
 {
        struct fb_info *info = pci_get_drvdata(dev);
        struct i810fb_par *par = info->par;
 
-       par->cur_state = state.event;
+       par->cur_state = mesg.event;
 
-       if (state.event == PM_EVENT_FREEZE) {
-               dev->dev.power.power_state = state;
+       switch (mesg.event) {
+       case PM_EVENT_FREEZE:
+       case PM_EVENT_PRETHAW:
+               dev->dev.power.power_state = mesg;
                return 0;
        }
 
@@ -1578,7 +1580,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state)
 
        pci_save_state(dev);
        pci_disable_device(dev);
-       pci_set_power_state(dev, pci_choose_state(dev, state));
+       pci_set_power_state(dev, pci_choose_state(dev, mesg));
        release_console_sem();
 
        return 0;
index d4f850117874899f76afd661c5340fa2508d997f..f8cd4c519aebf1125ba9e6a347be3cdc67f80418 100644 (file)
@@ -950,24 +950,25 @@ static struct fb_ops nvidia_fb_ops = {
 };
 
 #ifdef CONFIG_PM
-static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t state)
+static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg)
 {
        struct fb_info *info = pci_get_drvdata(dev);
        struct nvidia_par *par = info->par;
 
+       if (mesg.event == PM_EVENT_PRETHAW)
+               mesg.event = PM_EVENT_FREEZE;
        acquire_console_sem();
-       par->pm_state = state.event;
+       par->pm_state = mesg.event;
 
-       if (state.event == PM_EVENT_FREEZE) {
-               dev->dev.power.power_state = state;
-       } else {
+       if (mesg.event == PM_EVENT_SUSPEND) {
                fb_set_suspend(info, 1);
                nvidiafb_blank(FB_BLANK_POWERDOWN, info);
                nvidia_write_regs(par, &par->SavedReg);
                pci_save_state(dev);
                pci_disable_device(dev);
-               pci_set_power_state(dev, pci_choose_state(dev, state));
+               pci_set_power_state(dev, pci_choose_state(dev, mesg));
        }
+       dev->dev.power.power_state = mesg;
 
        release_console_sem();
        return 0;
index 461e094e7b45de0a15829310a45e78163b66956b..82b3deaae02de532ba7ee3e34f21e47392d5a585 100644 (file)
@@ -2323,24 +2323,24 @@ static void __devexit savagefb_remove(struct pci_dev *dev)
        }
 }
 
-static int savagefb_suspend(struct pci_dev* dev, pm_message_t state)
+static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg)
 {
        struct fb_info *info = pci_get_drvdata(dev);
        struct savagefb_par *par = info->par;
 
        DBG("savagefb_suspend");
 
-
-       par->pm_state = state.event;
+       if (mesg.event == PM_EVENT_PRETHAW)
+               mesg.event = PM_EVENT_FREEZE;
+       par->pm_state = mesg.event;
+       dev->dev.power.power_state = mesg;
 
        /*
         * For PM_EVENT_FREEZE, do not power down so the console
         * can remain active.
         */
-       if (state.event == PM_EVENT_FREEZE) {
-               dev->dev.power.power_state = state;
+       if (mesg.event == PM_EVENT_FREEZE)
                return 0;
-       }
 
        acquire_console_sem();
        fb_set_suspend(info, 1);
@@ -2353,7 +2353,7 @@ static int savagefb_suspend(struct pci_dev* dev, pm_message_t state)
        savage_disable_mmio(par);
        pci_save_state(dev);
        pci_disable_device(dev);
-       pci_set_power_state(dev, pci_choose_state(dev, state));
+       pci_set_power_state(dev, pci_choose_state(dev, mesg));
        release_console_sem();
 
        return 0;