DRM support for new pm_ops hooks
PATCH 1/1 DRM support for new pm_ops hooks
The PCI linux-next branch has support for the new PM ops hooks, so I thought I should refresh the DRM support for suspend/resume based on the new stuff.
I think we can get away with having drivers provide just save/restore hooks and let the core take care of the rest. When we flesh out the prepare/complete hooks we may need another driver callback, not sure yet.
How does it look?
Thanks,
Jesse
drivers/char/drm/drmP.h +2 -2
@@ -570,8 +570,8 @@ 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 *,pm_message_t state); -int (*resume) (struct drm_device *); +int (*save) (struct drm_device *); +int (*restore) (struct drm_device *);int (*dma_ioctl) (struct drm_device *dev,void *data,struct drm_file *file_priv);void (*dma_ready) (struct drm_device *);int (*dma_quiescent) (struct drm_device *);
drivers/char/drm/drm_sysfs.c +90 -16
146 lines not on this page · raw message
drivers/char/drm/i915_drv.c +4 -17
@@ -239,7 +239,7 @@ static void i915_restore_vga(struct drm_device *dev) } -static int i915_suspend (struct drm_device *dev,pm_message_t state) +static int i915_save (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;int i;
@@ -250,10 +250,6 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)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);/* Display arbitration control */
@@ -371,24 +367,15 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)i915_save_vga (dev); -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 ; } -static int i915_resume (struct drm_device *dev) +static int i915_restore (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;int i;pci_set_power_state (dev->pdev,PCI_D0 ); -pci_restore_state (dev->pdev); -if (pci_enable_device (dev->pdev)) -return -1 ;pci_write_config_byte (dev->pdev,LBB , dev_priv->saveLBB);
@@ -544,10 +531,10 @@ static struct drm_driver driver = { DRIVER_IRQ_VBL2, .load = i915_driver_load, .unload = i915_driver_unload, + .save = i915_save, + .restore = i915_restore, .lastclose = i915_driver_lastclose, .preclose = i915_driver_preclose, - .suspend = i915_suspend, - .resume = i915_resume, .device_is_agp = i915_driver_device_is_agp, .vblank_wait = i915_driver_vblank_wait, .vblank_wait2 = i915_driver_vblank_wait2,
Quoted 8 lines · Jesse Barnes
The PCI linux-next branch has support for the new PM ops hooks, so I thought I should refresh the DRM support for suspend/resume based on the new stuff.
I think we can get away with having drivers provide just save/restore hooks and let the core take care of the rest. When we flesh out the prepare/complete hooks we may need another driver callback, not sure yet.
How does it look?
Good (to me). :-)
Thanks,
Rafael