On Wednesday, February 20, 2008 11:18 am Jesse Barnes wrote:Given the way the PM core works, do we need to set a flag like this? I really hope there's a better way of doing this... Thanks, Jesse diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c index 4048f39..a2d6242 100644 --- a/drivers/char/drm/i915_drv.c +++ b/drivers/char/drm/i915_drv.c @@ -238,6 +238,13 @@ static void i915_restore_vga(struct drm_device *dev) } +/* + * If we're doing a suspend to disk, we don't want to power off the device. + * Unfortunately, the PM core doesn't tell us if we're headed for a regular + * S3 state or that it's about to shut down the machine, so we use this flag. + */ +static int i915_hibernate; + static int i915_suspend(struct drm_device *dev, pm_message_t state) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -252,6 +259,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) if (state.event == PM_EVENT_PRETHAW) return 0; + if (state.event == PM_EVENT_FREEZE) + i915_hibernate = 1; + pci_save_state(dev->pdev); pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); @@ -366,7 +376,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) i915_save_vga(dev); - if (state.event == PM_EVENT_SUSPEND) { + if (!i915_hibernate) { /* Shut down the device */ pci_disable_device(dev->pdev); pci_set_power_state(dev->pdev, PCI_D3hot); @@ -385,6 +395,8 @@ static int i915_resume(struct drm_device *dev) if (pci_enable_device(dev->pdev)) return -1; + i915_hibernate = 0; + pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); /* Pipe & plane A info */ --
| Linus Torvalds | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Mike Galbraith | Re: regression: CD burning (k3b) went broke |
| Con Kolivas | Re: -mm merge plans for 2.6.23 |
git: | |
| Gerrit Renker | [PATCH 24/37] dccp: Processing Confirm options |
| Linus Torvalds | Re: [GIT]: Networking |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Woodhouse | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
