aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-19 19:02:20 -0500
committerDave Airlie <airlied@redhat.com>2008-02-19 19:05:12 -0500
commitb932ccb5674eb649133b5c33950405c37d17aab3 (patch)
tree8ba30575cb83cc8d7d35517871b15657d1c1ab19
parentda636ad6a0d72eb5cb99738056af0bcc3db9ef9d (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--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_sysfs.c2
-rw-r--r--drivers/char/drm/i915_drv.c13
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 19d3be5c4b2d..a6789f25009b 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -568,7 +568,7 @@ struct drm_driver {
568 void (*postclose) (struct drm_device *, struct drm_file *); 568 void (*postclose) (struct drm_device *, struct drm_file *);
569 void (*lastclose) (struct drm_device *); 569 void (*lastclose) (struct drm_device *);
570 int (*unload) (struct drm_device *); 570 int (*unload) (struct drm_device *);
571 int (*suspend) (struct drm_device *); 571 int (*suspend) (struct drm_device *, pm_message_t state);
572 int (*resume) (struct drm_device *); 572 int (*resume) (struct drm_device *);
573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); 573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
574 void (*dma_ready) (struct drm_device *); 574 void (*dma_ready) (struct drm_device *);
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index fa36153619e8..05ed5043254f 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -36,7 +36,7 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
36 printk(KERN_ERR "%s\n", __FUNCTION__); 36 printk(KERN_ERR "%s\n", __FUNCTION__);
37 37
38 if (drm_dev->driver->suspend) 38 if (drm_dev->driver->suspend)
39 return drm_dev->driver->suspend(drm_dev); 39 return drm_dev->driver->suspend(drm_dev, state);
40 40
41 return 0; 41 return 0;
42} 42}
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 35758a6c8b0d..4048f39b7eed 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -238,7 +238,7 @@ static void i915_restore_vga(struct drm_device *dev)
238 238
239} 239}
240 240
241static int i915_suspend(struct drm_device *dev) 241static int i915_suspend(struct drm_device *dev, pm_message_t state)
242{ 242{
243 struct drm_i915_private *dev_priv = dev->dev_private; 243 struct drm_i915_private *dev_priv = dev->dev_private;
244 int i; 244 int i;
@@ -249,6 +249,9 @@ static int i915_suspend(struct drm_device *dev)
249 return -ENODEV; 249 return -ENODEV;
250 } 250 }
251 251
252 if (state.event == PM_EVENT_PRETHAW)
253 return 0;
254
252 pci_save_state(dev->pdev); 255 pci_save_state(dev->pdev);
253 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); 256 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
254 257
@@ -363,9 +366,11 @@ static int i915_suspend(struct drm_device *dev)
363 366
364 i915_save_vga(dev); 367 i915_save_vga(dev);
365 368
366 /* Shut down the device */ 369 if (state.event == PM_EVENT_SUSPEND) {
367 pci_disable_device(dev->pdev); 370 /* Shut down the device */
368 pci_set_power_state(dev->pdev, PCI_D3hot); 371 pci_disable_device(dev->pdev);
372 pci_set_power_state(dev->pdev, PCI_D3hot);
373 }
369 374
370 return 0; 375 return 0;
371} 376}