PM: video drivers and PM_EVENT_PRETHAW

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>
This commit is contained in:
David Brownell 2006-08-14 23:11:06 -07:00 committed by Greg Kroah-Hartman
parent b887d2e63c
commit c78a7c2dd9
4 changed files with 30 additions and 24 deletions

View 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;
}

View 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;

View 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;

View 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;