* [PATCH] Add basic PM support for Nvidia and ATI AGP bridges
@ 2005-11-24 6:00 Matthew Garrett
2005-11-24 11:33 ` Rolf Eike Beer
2005-11-25 21:01 ` Pavel Machek
0 siblings, 2 replies; 3+ messages in thread
From: Matthew Garrett @ 2005-11-24 6:00 UTC (permalink / raw)
To: davej; +Cc: linux-kernel
I retrieved these from the swsusp2 patchset, but they seem to be
independently useful. As a result, I'm not sure who the original author
is - however, they seem to be pretty obvious.
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: Add suspend/resume support to ATI and Nvidia AGP bridges
## DP: Patch author: Unknown
## DP: Upstream status: Not submitted
. $(dirname $0)/DPATCH
@DPATCH@
diff -ruNp 210-agp-resume-support.patch-old/drivers/char/agp/ati-agp.c 210-agp-resume-support.patch-new/drivers/char/agp/ati-agp.c
--- 210-agp-resume-support.patch-old/drivers/char/agp/ati-agp.c 2005-06-20 11:46:51.000000000 +1000
+++ 210-agp-resume-support.patch-new/drivers/char/agp/ati-agp.c 2005-07-04 23:14:18.000000000 +1000
@@ -507,6 +507,33 @@ static void __devexit agp_ati_remove(str
agp_put_bridge(bridge);
}
+#ifdef CONFIG_PM
+
+static int agp_ati_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+ pci_save_state (pdev);
+ 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);
+
+ /* 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),
@@ -526,6 +553,10 @@ static struct pci_driver agp_ati_pci_dri
.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)
diff -ruNp 210-agp-resume-support.patch-old/drivers/char/agp/nvidia-agp.c 210-agp-resume-support.patch-new/drivers/char/agp/nvidia-agp.c
--- 210-agp-resume-support.patch-old/drivers/char/agp/nvidia-agp.c 2005-06-20 11:46:51.000000000 +1000
+++ 210-agp-resume-support.patch-new/drivers/char/agp/nvidia-agp.c 2005-07-04 23:14:18.000000000 +1000
@@ -397,11 +397,40 @@ static struct pci_device_id agp_nvidia_p
MODULE_DEVICE_TABLE(pci, agp_nvidia_pci_table);
+#ifdef CONFIG_PM
+static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+ pci_save_state (pdev);
+ pci_set_power_state (pdev, 3);
+
+ return 0;
+}
+
+static int agp_nvidia_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);
+
+ /* reconfigure AGP hardware again */
+ if (bridge->driver == &nvidia_driver)
+ nvidia_configure();
+
+ return 0;
+}
+#endif
+
static struct pci_driver agp_nvidia_pci_driver = {
.name = "agpgart-nvidia",
.id_table = agp_nvidia_pci_table,
.probe = agp_nvidia_probe,
.remove = agp_nvidia_remove,
+#ifdef CONFIG_PM
+ .suspend = agp_nvidia_suspend,
+ .resume = agp_nvidia_resume,
+#endif
};
static int __init agp_nvidia_init(void)
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add basic PM support for Nvidia and ATI AGP bridges
2005-11-24 6:00 [PATCH] Add basic PM support for Nvidia and ATI AGP bridges Matthew Garrett
@ 2005-11-24 11:33 ` Rolf Eike Beer
2005-11-25 21:01 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Rolf Eike Beer @ 2005-11-24 11:33 UTC (permalink / raw)
To: Matthew Garrett; +Cc: davej, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]
Matthew Garrett wrote:
>I retrieved these from the swsusp2 patchset, but they seem to be
>independently useful. As a result, I'm not sure who the original author
>is - however, they seem to be pretty obvious.
>@DPATCH@
>diff -ruNp 210-agp-resume-support.patch-old/drivers/char/agp/ati-agp.c
> 210-agp-resume-support.patch-new/drivers/char/agp/ati-agp.c ---
> 210-agp-resume-support.patch-old/drivers/char/agp/ati-agp.c 2005-06-20
> 11:46:51.000000000 +1000 +++
> 210-agp-resume-support.patch-new/drivers/char/agp/ati-agp.c 2005-07-04
> 23:14:18.000000000 +1000 @@ -507,6 +507,33 @@ static void __devexit
> agp_ati_remove(str
> agp_put_bridge(bridge);
> }
>
>+#ifdef CONFIG_PM
>+
>+static int agp_ati_suspend(struct pci_dev *pdev, pm_message_t state)
>+{
>+ pci_save_state (pdev);
>+ pci_set_power_state (pdev, 3);
Please remove the spaces after the function names.
>diff -ruNp 210-agp-resume-support.patch-old/drivers/char/agp/nvidia-agp.c
> 210-agp-resume-support.patch-new/drivers/char/agp/nvidia-agp.c ---
> 210-agp-resume-support.patch-old/drivers/char/agp/nvidia-agp.c 2005-06-20
> 11:46:51.000000000 +1000 +++
> 210-agp-resume-support.patch-new/drivers/char/agp/nvidia-agp.c 2005-07-04
> 23:14:18.000000000 +1000 @@ -397,11 +397,40 @@ static struct pci_device_id
> agp_nvidia_p
>
> MODULE_DEVICE_TABLE(pci, agp_nvidia_pci_table);
>
>+#ifdef CONFIG_PM
>+static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state)
>+{
>+ pci_save_state (pdev);
>+ pci_set_power_state (pdev, 3);
Same here.
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add basic PM support for Nvidia and ATI AGP bridges
2005-11-24 6:00 [PATCH] Add basic PM support for Nvidia and ATI AGP bridges Matthew Garrett
2005-11-24 11:33 ` Rolf Eike Beer
@ 2005-11-25 21:01 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2005-11-25 21:01 UTC (permalink / raw)
To: Matthew Garrett; +Cc: davej, linux-kernel
Hi!
> I retrieved these from the swsusp2 patchset, but they seem to be
> independently useful. As a result, I'm not sure who the original author
> is - however, they seem to be pretty obvious.
>
> ## All lines beginning with `## DP:' are a description of the patch.
> ## DP: Description: Add suspend/resume support to ATI and Nvidia AGP bridges
> ## DP: Patch author: Unknown
> ## DP: Upstream status: Not submitted
>
> . $(dirname $0)/DPATCH
> @@ -507,6 +507,33 @@ static void __devexit agp_ati_remove(str
> agp_put_bridge(bridge);
> }
>
> +#ifdef CONFIG_PM
> +
> +static int agp_ati_suspend(struct pci_dev *pdev, pm_message_t state)
> +{
> + pci_save_state (pdev);
> + pci_set_power_state (pdev, 3);
PCI_D3hot, please.
> +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_D0... ....and same in other two functions. Otherwise it looks ok.
Pavel
--
Thanks, Sharp!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-25 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-24 6:00 [PATCH] Add basic PM support for Nvidia and ATI AGP bridges Matthew Garrett
2005-11-24 11:33 ` Rolf Eike Beer
2005-11-25 21:01 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox