mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sven-Haegar Koch <haegar@sdinet.de>
To: Dave Jones <davej@codemonkey.org.uk>
Cc: Linux-Kernel-Mailinglist <linux-kernel@vger.kernel.org>
Subject: Suspend/Resume support for ati-agp
Date: Sun, 8 Aug 2004 03:39:33 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0408080331490.15568@mercury.sdinet.de> (raw)

hello,

while trying to debug a strange resume problem with 2.6.8-rc3-mm1 and
software suspend 2 I suspeced ati-agp, and created the following attached
patch to add powermanagement support for it.

I don't know if it's the completely right thing to do, I just copied the
way via-agp and intel-agp do it - but perhaps you like it and want to send
it upstream.

c'ya
sven

ps:
this did not fix the strange "weird vertical bars instead of movie in
mplayer after resume" I have, but does not do any bad things either ;)

--- linux/drivers/char/agp/ati-agp.c.orig	2004-08-08 02:53:10.000000000 +0200
+++ linux/drivers/char/agp/ati-agp.c	2004-08-08 03:06:03.000000000 +0200
@@ -505,6 +505,33 @@
 	agp_put_bridge(bridge);
 }

+#ifdef CONFIG_PM
+
+static int agp_ati_suspend(struct pci_dev *pdev, u32 state)
+{
+	pci_save_state (pdev, pdev->saved_config_space);
+	pci_set_power_state (pdev, 3);
+
+	return 0;
+}
+
+static int agp_ati_resume(struct pci_dev *pdev)
+{
+	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+
+	/* set power state 0 and restore PCI space */
+	pci_set_power_state (pdev, 0);
+	pci_restore_state(pdev, pdev->saved_config_space);
+
+	/* reconfigure AGP hardware again */
+	if (bridge->driver == &ati_generic_bridge)
+		return ati_configure();
+
+	return 0;
+}
+
+#endif /* CONFIG_PM */
+
 static struct pci_device_id agp_ati_pci_table[] = {
 	{
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
@@ -524,6 +551,10 @@
 	.id_table	= agp_ati_pci_table,
 	.probe		= agp_ati_probe,
 	.remove		= agp_ati_remove,
+#ifdef CONFIG_PM
+	.suspend	= agp_ati_suspend,
+	.resume		= agp_ati_resume,
+#endif
 };

 static int __init agp_ati_init(void)


             reply	other threads:[~2004-08-08  1:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-08  1:39 Sven-Haegar Koch [this message]
2004-08-08 19:50 ` Pavel Machek
2004-08-09 10:13   ` Sven-Haegar Koch
2004-08-09 11:26     ` Pavel Machek
2004-08-09 11:48 ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0408080331490.15568@mercury.sdinet.de \
    --to=haegar@sdinet.de \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®