Revert "drm/vbl rework: rework how the drm deals with vblank."
[firefly-linux-kernel-4.4.55.git] / drivers / char / drm / i915_drv.c
index 35758a6c8b0deb4afd181d6d824ca0d110b69e6a..b2b451dc44608870a48cbfea56b7de522044aa40 100644 (file)
@@ -222,6 +222,7 @@ static void i915_restore_vga(struct drm_device *dev)
                           dev_priv->saveGR[0x18]);
 
        /* Attribute controller registers */
+       inb(st01);
        for (i = 0; i < 20; i++)
                i915_write_ar(st01, i, dev_priv->saveAR[i], 0);
        inb(st01); /* switch back to index mode */
@@ -238,7 +239,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 +250,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 +367,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;
 }