Commit 58a40ef7 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] aty128fb: Disable AGP on suspend

This patch improves reliability of suspend/resume by making sure AGP is
disabled on the Rage 128 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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cd616dd9
......@@ -2334,6 +2334,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state)
{
struct fb_info *info = pci_get_drvdata(pdev);
struct aty128fb_par *par = info->par;
u8 agp;
/* We don't do anything but D2, for now we return 0, but
* we may want to change that. How do we know if the BIOS
......@@ -2371,6 +2372,27 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state)
par->asleep = 1;
par->lock_blank = 1;
/* 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 "aty128fb: AGP was enabled, "
"disabling ...\n");
cmd &= ~PCI_AGP_COMMAND_AGP;
pci_write_config_dword(pdev, agp + PCI_AGP_COMMAND,
cmd);
}
}
/* We need a way to make sure the fbdev layer will _not_ touch the
* framebuffer before we put the chip to suspend state. On 2.4, I
* used dummy fb ops, 2.5 need proper support for this at the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment