diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-04 20:06:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-08 13:48:56 -0500 |
commit | b7468168631e03c70105491a0236137868613436 (patch) | |
tree | a258e2049a245c4d652faa016dd438b2faba5e1e /drivers/video | |
parent | e83102cab0fd95d4508361b061146c978b3abd60 (diff) |
atyfb: Properly save PCI state before changing PCI PM level
This fixes atyfb to properly save the PCI config space -before- it
potentially switches the PM state of the chip. This avoids a
warning with the new PM core and is the right thing to do anyway.
I also slightly cleaned up the code that checks whether we are
running on a PowerMac to do a runtime check instead of a compile
check only, and replaced a deprecated number with the proper
symbolic constant.
Finally, I removed the useless switch to D0 from resume since
the core does it for us.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/aty/atyfb_base.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 1d6e16d346a5..1207c208a30b 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -1978,7 +1978,7 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par) | |||
1978 | 1978 | ||
1979 | return timeout ? 0 : -EIO; | 1979 | return timeout ? 0 : -EIO; |
1980 | } | 1980 | } |
1981 | #endif | 1981 | #endif /* CONFIG_PPC_PMAC */ |
1982 | 1982 | ||
1983 | static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 1983 | static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
1984 | { | 1984 | { |
@@ -2002,9 +2002,15 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2002 | par->asleep = 1; | 2002 | par->asleep = 1; |
2003 | par->lock_blank = 1; | 2003 | par->lock_blank = 1; |
2004 | 2004 | ||
2005 | /* Because we may change PCI D state ourselves, we need to | ||
2006 | * first save the config space content so the core can | ||
2007 | * restore it properly on resume. | ||
2008 | */ | ||
2009 | pci_save_state(pdev); | ||
2010 | |||
2005 | #ifdef CONFIG_PPC_PMAC | 2011 | #ifdef CONFIG_PPC_PMAC |
2006 | /* Set chip to "suspend" mode */ | 2012 | /* Set chip to "suspend" mode */ |
2007 | if (aty_power_mgmt(1, par)) { | 2013 | if (machine_is(powermac) && aty_power_mgmt(1, par)) { |
2008 | par->asleep = 0; | 2014 | par->asleep = 0; |
2009 | par->lock_blank = 0; | 2015 | par->lock_blank = 0; |
2010 | atyfb_blank(FB_BLANK_UNBLANK, info); | 2016 | atyfb_blank(FB_BLANK_UNBLANK, info); |
@@ -2047,11 +2053,15 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2047 | 2053 | ||
2048 | acquire_console_sem(); | 2054 | acquire_console_sem(); |
2049 | 2055 | ||
2056 | /* PCI state will have been restored by the core, so | ||
2057 | * we should be in D0 now with our config space fully | ||
2058 | * restored | ||
2059 | */ | ||
2060 | |||
2050 | #ifdef CONFIG_PPC_PMAC | 2061 | #ifdef CONFIG_PPC_PMAC |
2051 | if (pdev->dev.power.power_state.event == 2) | 2062 | if (machine_is(powermac) && |
2063 | pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) | ||
2052 | aty_power_mgmt(0, par); | 2064 | aty_power_mgmt(0, par); |
2053 | #else | ||
2054 | pci_set_power_state(pdev, PCI_D0); | ||
2055 | #endif | 2065 | #endif |
2056 | 2066 | ||
2057 | aty_resume_chip(info); | 2067 | aty_resume_chip(info); |