* [PATCH 1/3] atyfb: Properly save PCI state before changing PCI PM level
@ 2009-02-05 1:06 Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2009-02-05 1:06 UTC (permalink / raw)
To: fbdev list; +Cc: Rafael J. Wysocki, Linus Torvalds, Andrew Morton, linux-kernel
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>
---
drivers/video/aty/atyfb_base.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
--- linux-work.orig/drivers/video/aty/atyfb_base.c 2009-02-04 13:10:22.000000000 +1100
+++ linux-work/drivers/video/aty/atyfb_base.c 2009-02-04 13:13:11.000000000 +1100
@@ -1978,7 +1978,7 @@ static int aty_power_mgmt(int sleep, str
return timeout ? 0 : -EIO;
}
-#endif
+#endif /* CONFIG_PPC_PMAC */
static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
@@ -2002,9 +2002,15 @@ static int atyfb_pci_suspend(struct pci_
par->asleep = 1;
par->lock_blank = 1;
+ /* Because we may change PCI D state ourselves, we need to
+ * first save the config space content so the core can
+ * restore it properly on resume.
+ */
+ pci_save_state(pdev);
+
#ifdef CONFIG_PPC_PMAC
/* Set chip to "suspend" mode */
- if (aty_power_mgmt(1, par)) {
+ if (machine_is(powermac) && aty_power_mgmt(1, par)) {
par->asleep = 0;
par->lock_blank = 0;
atyfb_blank(FB_BLANK_UNBLANK, info);
@@ -2047,11 +2053,15 @@ static int atyfb_pci_resume(struct pci_d
acquire_console_sem();
+ /* PCI state will have been restored by the core, so
+ * we should be in D0 now with our config space fully
+ * restored
+ */
+
#ifdef CONFIG_PPC_PMAC
- if (pdev->dev.power.power_state.event == 2)
+ if (machine_is(powermac) &&
+ pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
aty_power_mgmt(0, par);
-#else
- pci_set_power_state(pdev, PCI_D0);
#endif
aty_resume_chip(info);
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 1/3] atyfb: Properly save PCI state before changing PCI PM level
@ 2009-02-05 0:57 Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2009-02-05 0:57 UTC (permalink / raw)
To: fbdev list; +Cc: Rafael J. Wysocki, Linus Torvalds, Andrew Morton, linux-kernel
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>
---
drivers/video/aty/atyfb_base.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
--- linux-work.orig/drivers/video/aty/atyfb_base.c 2009-02-04 13:10:22.000000000 +1100
+++ linux-work/drivers/video/aty/atyfb_base.c 2009-02-04 13:13:11.000000000 +1100
@@ -1978,7 +1978,7 @@ static int aty_power_mgmt(int sleep, str
return timeout ? 0 : -EIO;
}
-#endif
+#endif /* CONFIG_PPC_PMAC */
static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
@@ -2002,9 +2002,15 @@ static int atyfb_pci_suspend(struct pci_
par->asleep = 1;
par->lock_blank = 1;
+ /* Because we may change PCI D state ourselves, we need to
+ * first save the config space content so the core can
+ * restore it properly on resume.
+ */
+ pci_save_state(pdev);
+
#ifdef CONFIG_PPC_PMAC
/* Set chip to "suspend" mode */
- if (aty_power_mgmt(1, par)) {
+ if (machine_is(powermac) && aty_power_mgmt(1, par)) {
par->asleep = 0;
par->lock_blank = 0;
atyfb_blank(FB_BLANK_UNBLANK, info);
@@ -2047,11 +2053,15 @@ static int atyfb_pci_resume(struct pci_d
acquire_console_sem();
+ /* PCI state will have been restored by the core, so
+ * we should be in D0 now with our config space fully
+ * restored
+ */
+
#ifdef CONFIG_PPC_PMAC
- if (pdev->dev.power.power_state.event == 2)
+ if (machine_is(powermac) &&
+ pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
aty_power_mgmt(0, par);
-#else
- pci_set_power_state(pdev, PCI_D0);
#endif
aty_resume_chip(info);
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-05 1:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 1:06 [PATCH 1/3] atyfb: Properly save PCI state before changing PCI PM level Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2009-02-05 0:57 Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).