summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-20 10:02:20 +1000
committerDave Airlie <airlied@redhat.com>2008-02-20 10:02:20 +1000
commit6c41e5381fb8ea890943b6679fe6ae7ac4cfea4d (patch)
tree9467361943830f84a7622d61b19ce57b40e058a8
parent5d8c754bc2c720d70bbdeca6b294660105717a62 (diff)
drm: add support for passing state into the suspend hooks.
fix i915 driver to use state for hibernate save avoidance. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--linux-core/drmP.h2
-rw-r--r--linux-core/drm_sysfs.c2
-rw-r--r--linux-core/i915_drv.c13
3 files changed, 11 insertions, 6 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 33f3649e..f196e11d 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -617,7 +617,7 @@ struct drm_driver {
void (*postclose) (struct drm_device *, struct drm_file *);
void (*lastclose) (struct drm_device *);
int (*unload) (struct drm_device *);
- int (*suspend) (struct drm_device *);
+ int (*suspend) (struct drm_device *, pm_message_t state);
int (*resume) (struct drm_device *);
int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
void (*dma_ready) (struct drm_device *);
diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c
index 3aaac11b..c02e2049 100644
--- a/linux-core/drm_sysfs.c
+++ b/linux-core/drm_sysfs.c
@@ -36,7 +36,7 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
printk(KERN_ERR "%s\n", __FUNCTION__);
if (drm_dev->driver->suspend)
- return drm_dev->driver->suspend(drm_dev);
+ return drm_dev->driver->suspend(drm_dev, state);
return 0;
}
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 9d8b4685..cfcb62ed 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -263,7 +263,7 @@ static void i915_restore_vga(struct drm_device *dev)
}
-static int i915_suspend(struct drm_device *dev)
+static int i915_suspend(struct drm_device *dev, pm_message_t state)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int i;
@@ -274,6 +274,9 @@ static int i915_suspend(struct drm_device *dev)
return -ENODEV;
}
+ if (state.event == PM_EVENT_PRETHAW)
+ return 0;
+
pci_save_state(dev->pdev);
pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
@@ -388,9 +391,11 @@ static int i915_suspend(struct drm_device *dev)
i915_save_vga(dev);
- /* Shut down the device */
- pci_disable_device(dev->pdev);
- pci_set_power_state(dev->pdev, PCI_D3hot);
+ if (state.event == PM_EVENT_SUSPEND) {
+ /* Shut down the device */
+ pci_disable_device(dev->pdev);
+ pci_set_power_state(dev->pdev, PCI_D3hot);
+ }
return 0;
}