Commit cf9f1155 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

gma500: Fix up suspend/resume

This isn't ideal as we could do with deferring the power on a lot more on
Oaktrail and Medfield. We can't however do that without fixing other things
first.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2a30cda7
...@@ -83,7 +83,7 @@ static void gma_suspend_display(struct drm_device *dev) ...@@ -83,7 +83,7 @@ static void gma_suspend_display(struct drm_device *dev)
{ {
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
if (dev_priv->suspended) if (!dev_priv->display_power)
return; return;
dev_priv->ops->save_regs(dev); dev_priv->ops->save_regs(dev);
dev_priv->ops->power_down(dev); dev_priv->ops->power_down(dev);
...@@ -101,7 +101,7 @@ static void gma_resume_display(struct pci_dev *pdev) ...@@ -101,7 +101,7 @@ static void gma_resume_display(struct pci_dev *pdev)
struct drm_device *dev = pci_get_drvdata(pdev); struct drm_device *dev = pci_get_drvdata(pdev);
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
if (dev_priv->suspended == false) if (dev_priv->display_power)
return; return;
/* turn on the display power island */ /* turn on the display power island */
...@@ -265,6 +265,8 @@ bool gma_power_begin(struct drm_device *dev, bool force_on) ...@@ -265,6 +265,8 @@ bool gma_power_begin(struct drm_device *dev, bool force_on)
/* Ok power up needed */ /* Ok power up needed */
ret = gma_resume_pci(dev->pdev); ret = gma_resume_pci(dev->pdev);
if (ret == 0) { if (ret == 0) {
/* FIXME: we want to defer this for Medfield/Oaktrail */
gma_resume_display(dev);
psb_irq_preinstall(dev); psb_irq_preinstall(dev);
psb_irq_postinstall(dev); psb_irq_postinstall(dev);
pm_runtime_get(&dev->pdev->dev); pm_runtime_get(&dev->pdev->dev);
......
...@@ -448,12 +448,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -448,12 +448,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
if (ret) if (ret)
return ret; return ret;
#if 0
/*enable runtime pm at last*/ /* Enable runtime pm at last */
pm_runtime_enable(&dev->pdev->dev);
pm_runtime_set_active(&dev->pdev->dev); pm_runtime_set_active(&dev->pdev->dev);
#endif
/*Intel drm driver load is done, continue doing pvr load*/
return 0; return 0;
out_err: out_err:
psb_driver_unload(dev); psb_driver_unload(dev);
...@@ -470,14 +467,13 @@ static int psb_sizes_ioctl(struct drm_device *dev, void *data, ...@@ -470,14 +467,13 @@ static int psb_sizes_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_psb_private *dev_priv = psb_priv(dev); struct drm_psb_private *dev_priv = psb_priv(dev);
struct drm_psb_sizes_arg *arg = struct drm_psb_sizes_arg *arg = data;
(struct drm_psb_sizes_arg *) data;
*arg = dev_priv->sizes; *arg = dev_priv->sizes;
return 0; return 0;
} }
static int psb_dc_state_ioctl(struct drm_device *dev, void * data, static int psb_dc_state_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
uint32_t flags; uint32_t flags;
...@@ -485,8 +481,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data, ...@@ -485,8 +481,7 @@ static int psb_dc_state_ioctl(struct drm_device *dev, void * data,
struct drm_mode_object *obj; struct drm_mode_object *obj;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_psb_dc_state_arg *arg = struct drm_psb_dc_state_arg *arg = data;
(struct drm_psb_dc_state_arg *)data;
/* Double check MRST case */ /* Double check MRST case */
...@@ -1114,15 +1109,12 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd, ...@@ -1114,15 +1109,12 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd,
{ {
struct drm_file *file_priv = filp->private_data; struct drm_file *file_priv = filp->private_data;
struct drm_device *dev = file_priv->minor->dev; struct drm_device *dev = file_priv->minor->dev;
struct drm_psb_private *dev_priv = dev->dev_private; int ret;
static unsigned int runtime_allowed;
pm_runtime_forbid(dev->dev);
if (runtime_allowed == 1 && dev_priv->is_lvds_on) { ret = drm_ioctl(filp, cmd, arg);
runtime_allowed++; pm_runtime_allow(dev->dev);
pm_runtime_allow(&dev->pdev->dev); return ret;
dev_priv->rpm_enabled = 1;
}
return drm_ioctl(filp, cmd, arg);
/* FIXME: do we need to wrap the other side of this */ /* FIXME: do we need to wrap the other side of this */
} }
...@@ -1141,8 +1133,12 @@ static void psb_remove(struct pci_dev *pdev) ...@@ -1141,8 +1133,12 @@ static void psb_remove(struct pci_dev *pdev)
} }
static const struct dev_pm_ops psb_pm_ops = { static const struct dev_pm_ops psb_pm_ops = {
.resume = gma_power_resume,
.suspend = gma_power_suspend, .suspend = gma_power_suspend,
.resume = gma_power_resume,
.freeze = gma_power_suspend,
.thaw = gma_power_resume,
.poweroff = gma_power_suspend,
.restore = gma_power_resume,
.runtime_suspend = psb_runtime_suspend, .runtime_suspend = psb_runtime_suspend,
.runtime_resume = psb_runtime_resume, .runtime_resume = psb_runtime_resume,
.runtime_idle = psb_runtime_idle, .runtime_idle = psb_runtime_idle,
......
...@@ -1102,10 +1102,6 @@ static int psb_crtc_set_config(struct drm_mode_set *set) ...@@ -1102,10 +1102,6 @@ static int psb_crtc_set_config(struct drm_mode_set *set)
{ {
int ret; int ret;
struct drm_device *dev = set->crtc->dev; struct drm_device *dev = set->crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
if (!dev_priv->rpm_enabled)
return drm_crtc_helper_set_config(set);
pm_runtime_forbid(&dev->pdev->dev); pm_runtime_forbid(&dev->pdev->dev);
ret = drm_crtc_helper_set_config(set); ret = drm_crtc_helper_set_config(set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment