drm: add support for passing state into the suspend hooks.
authorDave Airlie <airlied@redhat.com>
Wed, 20 Feb 2008 00:02:20 +0000 (10:02 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 20 Feb 2008 00:05:12 +0000 (10:05 +1000)
fix i915 driver to use state for hibernate save avoidance.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/char/drm/drmP.h
drivers/char/drm/drm_sysfs.c
drivers/char/drm/i915_drv.c

index 19d3be5c4b2d73f9457834102e7ac25cc769cc4d..a6789f25009b4858c1370104883601220f83be79 100644 (file)
@@ -568,7 +568,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 *);
index fa36153619e83a28696b1360de42c1776c943aec..05ed5043254fa4212fc6b36475902516b9c0954a 100644 (file)
@@ -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;
 }
index 35758a6c8b0deb4afd181d6d824ca0d110b69e6a..4048f39b7eed3acfad6b31b6e73b0c63ef73efc4 100644 (file)
@@ -238,7 +238,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;
@@ -249,6 +249,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);
 
@@ -363,9 +366,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;
 }