aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2009-12-16 00:36:10 -0500
committerEric Anholt <eric@anholt.net>2009-12-16 12:41:32 -0500
commitcbda12d77ea590082edb6d30bd342a67ebc459e0 (patch)
tree17d07c462b4baa270ac1e3ed43f7bd755a40c595 /drivers
parent11ba159288f1bfc1a475c994e598f5fe423fde9d (diff)
drm/i915: implement new pm ops for i915
One problem in i915 hibernate with current legacy pci pm ops is that after we do freeze, we'll be forced to do resume once again, which re-init some resources and do modesetting again, that is unnecessary for hibernate. This patch trys to bypass that. We can't resolve this within legacy pm framework, but can do it easily with new pm ops. Suspend (S3) process has also been kept without change. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 2fa217862058..6978a22f70e7 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -284,6 +284,52 @@ i915_pci_resume(struct pci_dev *pdev)
284 return i915_resume(dev); 284 return i915_resume(dev);
285} 285}
286 286
287static int
288i915_pm_suspend(struct device *dev)
289{
290 return i915_pci_suspend(to_pci_dev(dev), PMSG_SUSPEND);
291}
292
293static int
294i915_pm_resume(struct device *dev)
295{
296 return i915_pci_resume(to_pci_dev(dev));
297}
298
299static int
300i915_pm_freeze(struct device *dev)
301{
302 return i915_pci_suspend(to_pci_dev(dev), PMSG_FREEZE);
303}
304
305static int
306i915_pm_thaw(struct device *dev)
307{
308 /* thaw during hibernate, do nothing! */
309 return 0;
310}
311
312static int
313i915_pm_poweroff(struct device *dev)
314{
315 return i915_pci_suspend(to_pci_dev(dev), PMSG_HIBERNATE);
316}
317
318static int
319i915_pm_restore(struct device *dev)
320{
321 return i915_pci_resume(to_pci_dev(dev));
322}
323
324const struct dev_pm_ops i915_pm_ops = {
325 .suspend = i915_pm_suspend,
326 .resume = i915_pm_resume,
327 .freeze = i915_pm_freeze,
328 .thaw = i915_pm_thaw,
329 .poweroff = i915_pm_poweroff,
330 .restore = i915_pm_restore,
331};
332
287static struct vm_operations_struct i915_gem_vm_ops = { 333static struct vm_operations_struct i915_gem_vm_ops = {
288 .fault = i915_gem_fault, 334 .fault = i915_gem_fault,
289 .open = drm_gem_vm_open, 335 .open = drm_gem_vm_open,
@@ -303,8 +349,6 @@ static struct drm_driver driver = {
303 .lastclose = i915_driver_lastclose, 349 .lastclose = i915_driver_lastclose,
304 .preclose = i915_driver_preclose, 350 .preclose = i915_driver_preclose,
305 .postclose = i915_driver_postclose, 351 .postclose = i915_driver_postclose,
306 .suspend = i915_suspend,
307 .resume = i915_resume,
308 .device_is_agp = i915_driver_device_is_agp, 352 .device_is_agp = i915_driver_device_is_agp,
309 .enable_vblank = i915_enable_vblank, 353 .enable_vblank = i915_enable_vblank,
310 .disable_vblank = i915_disable_vblank, 354 .disable_vblank = i915_disable_vblank,
@@ -344,10 +388,7 @@ static struct drm_driver driver = {
344 .id_table = pciidlist, 388 .id_table = pciidlist,
345 .probe = i915_pci_probe, 389 .probe = i915_pci_probe,
346 .remove = i915_pci_remove, 390 .remove = i915_pci_remove,
347#ifdef CONFIG_PM 391 .driver.pm = &i915_pm_ops,
348 .resume = i915_pci_resume,
349 .suspend = i915_pci_suspend,
350#endif
351 }, 392 },
352 393
353 .name = DRIVER_NAME, 394 .name = DRIVER_NAME,