* [PATCH] radeonfb: Disable AGP on suspend
@ 2005-03-01 4:18 Benjamin Herrenschmidt
0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2005-03-01 4:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel list, Linux Fbdev development list
Hi !
(for -mm only for now, need feedback from x86 users)
This patch improves reliability of suspend/resume by making sure AGP is
disabled on the radeon chip before putting it into a suspend state. It
works in conjunction with the uninorth-agp suspend patch, but should
be harmless on machines with a different AGP bridge.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Index: linux-work/drivers/video/aty/radeon_pm.c
===================================================================
--- linux-work.orig/drivers/video/aty/radeon_pm.c 2005-03-01 14:37:10.000000000 +1100
+++ linux-work/drivers/video/aty/radeon_pm.c 2005-03-01 14:58:44.000000000 +1100
@@ -2400,7 +2400,8 @@
* including PCI config registers, clocks, AGP conf, ...)
*/
if (suspend) {
- printk(KERN_DEBUG "radeonfb: switching to D2 state...\n");
+ printk(KERN_DEBUG "radeonfb (%s): switching to D2 state...\n",
+ pci_name(rinfo->pdev));
/* Disable dynamic power management of clocks for the
* duration of the suspend/resume process
@@ -2453,7 +2454,8 @@
mdelay(500);
}
} else {
- printk(KERN_DEBUG "radeonfb: switching to D0 state...\n");
+ printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
+ pci_name(rinfo->pdev));
/* Switch back PCI powermanagment to D0 */
mdelay(200);
@@ -2507,6 +2509,7 @@
{
struct fb_info *info = pci_get_drvdata(pdev);
struct radeonfb_info *rinfo = info->par;
+ u8 agp;
int i;
if (state == pdev->dev.power.power_state)
@@ -2523,7 +2526,8 @@
if (state != PM_SUSPEND_MEM)
goto done;
if (susdisking) {
- printk("suspending to disk but state = %d\n", state);
+ printk("radeonfb (%s): suspending to disk but state = %d\n",
+ pci_name(pdev), state);
goto done;
}
@@ -2546,6 +2550,28 @@
rinfo->lock_blank = 1;
del_timer_sync(&rinfo->lvds_timer);
+ /* Disable AGP. The AGP host should have done it, but since ordering
+ * isn't always properly guaranteed in this specific case, let's make
+ * sure it's disabled on card side now. Ultimately, when merging fbdev
+ * and dri into some common infrastructure, this will be handled
+ * more nicely. The host bridge side will (or will not) be dealt with
+ * by the bridge AGP driver, we don't attempt to touch it here.
+ */
+ agp = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+ if (agp) {
+ u32 cmd;
+
+ pci_read_config_dword(pdev, agp + PCI_AGP_COMMAND, &cmd);
+ if (cmd & PCI_AGP_COMMAND_AGP) {
+ printk(KERN_INFO "radeonfb (%s): AGP was enabled, "
+ "disabling ...\n",
+ pci_name(pdev));
+ cmd &= ~PCI_AGP_COMMAND_AGP;
+ pci_write_config_dword(pdev, agp + PCI_AGP_COMMAND,
+ cmd);
+ }
+ }
+
/* If we support wakeup from poweroff, we save all regs we can including cfg
* space
*/
@@ -2569,12 +2595,11 @@
OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000);
mdelay(20);
OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON));
-
- // FIXME: Use PCI layer
- for (i = 0; i < 64; ++i)
- pci_read_config_dword(rinfo->pdev, i * 4,
- &rinfo->cfg_save[i]);
}
+ // FIXME: Use PCI layer
+ for (i = 0; i < 64; ++i)
+ pci_read_config_dword(pdev, i * 4, &rinfo->cfg_save[i]);
+ pci_disable_device(pdev);
}
/* If we support D2, we go to it (should be fixed later with a flag forcing
* D3 only for some laptops)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-01 4:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-01 4:18 [PATCH] radeonfb: Disable AGP on suspend 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).