summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2005-06-27 12:39:02 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2005-06-27 12:39:02 +0000
commit1a6780348c9e61833ca240ce6fb80aaa6e75fb92 (patch)
treed41a6f318e10562c926224cbf993fe956c35eeba
parentfa24ccccf4beeef41d8de23a345408b7b047ae3f (diff)
Check for 2.6.12 suspend/resume changes (pm_message_t)
-rw-r--r--linux-core/drm_pm.c13
-rw-r--r--shared-core/i915_pm.c38
2 files changed, 39 insertions, 12 deletions
diff --git a/linux-core/drm_pm.c b/linux-core/drm_pm.c
index 1e93e1da..844266ac 100644
--- a/linux-core/drm_pm.c
+++ b/linux-core/drm_pm.c
@@ -36,15 +36,24 @@
#include <linux/sysdev.h>
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)
static int drm_suspend(struct sys_device *sysdev, u32 state)
+#else
+static int drm_suspend(struct sys_device *sysdev, pm_message_t state)
+#endif
{
struct drm_device *dev =
container_of(sysdev, struct drm_device, sysdev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ int event = state.event;
+#else
+ int event = state;
+#endif
- DRM_DEBUG("state=%d\n", state);
+ DRM_DEBUG("event=%d\n", event);
if (dev->driver->power)
- return dev->driver->power(dev, state);
+ return dev->driver->power(dev, event);
else
return 0;
}
diff --git a/shared-core/i915_pm.c b/shared-core/i915_pm.c
index b1a152e0..93ad555d 100644
--- a/shared-core/i915_pm.c
+++ b/shared-core/i915_pm.c
@@ -113,18 +113,27 @@ static int i915_set_dpms(drm_device_t *dev, int mode)
return 0;
}
-int i915_suspend( struct pci_dev *pdev, unsigned state )
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+int i915_suspend(struct pci_dev *pdev, pm_message_t state)
+#else
+int i915_suspend(struct pci_dev *pdev, u32 state)
+#endif
{
drm_device_t *dev = (drm_device_t *)pci_get_drvdata(pdev);
drm_i915_private_t *dev_priv =
(drm_i915_private_t *)dev->dev_private;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ int event = state.event;
+#else
+ int event = state;
+#endif
- DRM_DEBUG("%s state=%d\n", __FUNCTION__, state);
+ DRM_DEBUG("%s event=%d\n", __FUNCTION__, event);
- if (!dev_priv) return;
+ if (!dev_priv) return 0;
/* Save state for power up later */
- if (state != 0) {
+ if (event != 0) {
I915_WRITE( SRX_INDEX, SR01 );
dev_priv->sr01 = I915_READ( SRX_DATA );
dev_priv->dvoc = I915_READ( DVOC );
@@ -134,7 +143,7 @@ int i915_suspend( struct pci_dev *pdev, unsigned state )
dev_priv->ppcr = I915_READ( PPCR );
}
- switch(state) {
+ switch(event) {
case 0:
/* D0: set DPMS mode on */
i915_set_dpms(dev, 0);
@@ -166,17 +175,26 @@ int i915_resume( struct pci_dev *pdev )
return 0;
}
-int i915_power( drm_device_t *dev, unsigned int state )
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+int i915_power( drm_device_t *dev, pm_message_t state)
+#else
+int i915_power( drm_device_t *dev, u32 state)
+#endif
{
drm_i915_private_t *dev_priv =
(drm_i915_private_t *)dev->dev_private;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ int event = state.event;
+#else
+ int event = state;
+#endif
- DRM_DEBUG("%s state=%d\n", __FUNCTION__, state);
+ DRM_DEBUG("%s event=%d\n", __FUNCTION__, event);
- if (!dev_priv) return;
+ if (!dev_priv) return 0;
/* Save state for power up later */
- if (state != 0) {
+ if (event != 0) {
I915_WRITE( SRX_INDEX, SR01 );
dev_priv->sr01 = I915_READ( SRX_DATA );
dev_priv->dvoc = I915_READ( DVOC );
@@ -187,7 +205,7 @@ int i915_power( drm_device_t *dev, unsigned int state )
}
/* D0: set DPMS mode on */
- i915_set_dpms(dev, state);
+ i915_set_dpms(dev, event);
return 0;
}