aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/stm/drv.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2019-06-25 08:42:25 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-06-25 08:42:25 -0500
commitd7929c1e13e3788e7cb741d75b5baec5e53eff21 (patch)
treecf513071edfc4499b4e025e4846244c9d0e4c6bd /drivers/gpu/drm/stm/drv.c
parentdrm/amdgpu: disable gfxoff on navi10 (diff)
parentdrm/edid: use for_each_displayid_db where applicable (diff)
downloadlinux-dev-d7929c1e13e3788e7cb741d75b5baec5e53eff21.tar.xz
linux-dev-d7929c1e13e3788e7cb741d75b5baec5e53eff21.zip
Merge branch 'drm-next' into drm-next-5.3
Backmerge drm-next and fix up conflicts due to drmP.h removal. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/stm/drv.c')
-rw-r--r--drivers/gpu/drm/stm/drv.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 5834ef56fbaa..9dee4e430de5 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -12,6 +12,7 @@
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
@@ -135,14 +136,14 @@ static __maybe_unused int drv_suspend(struct device *dev)
struct ltdc_device *ldev = ddev->dev_private;
struct drm_atomic_state *state;
- drm_kms_helper_poll_disable(ddev);
+ WARN_ON(ldev->suspend_state);
+
state = drm_atomic_helper_suspend(ddev);
- if (IS_ERR(state)) {
- drm_kms_helper_poll_enable(ddev);
+ if (IS_ERR(state))
return PTR_ERR(state);
- }
+
ldev->suspend_state = state;
- ltdc_suspend(ddev);
+ pm_runtime_force_suspend(dev);
return 0;
}
@@ -151,16 +152,43 @@ static __maybe_unused int drv_resume(struct device *dev)
{
struct drm_device *ddev = dev_get_drvdata(dev);
struct ltdc_device *ldev = ddev->dev_private;
+ int ret;
+
+ if (WARN_ON(!ldev->suspend_state))
+ return -ENOENT;
+
+ pm_runtime_force_resume(dev);
+ ret = drm_atomic_helper_resume(ddev, ldev->suspend_state);
+ if (ret)
+ pm_runtime_force_suspend(dev);
+
+ ldev->suspend_state = NULL;
+
+ return ret;
+}
- ltdc_resume(ddev);
- drm_atomic_helper_resume(ddev, ldev->suspend_state);
- drm_kms_helper_poll_enable(ddev);
+static __maybe_unused int drv_runtime_suspend(struct device *dev)
+{
+ struct drm_device *ddev = dev_get_drvdata(dev);
+
+ DRM_DEBUG_DRIVER("\n");
+ ltdc_suspend(ddev);
return 0;
}
+static __maybe_unused int drv_runtime_resume(struct device *dev)
+{
+ struct drm_device *ddev = dev_get_drvdata(dev);
+
+ DRM_DEBUG_DRIVER("\n");
+ return ltdc_resume(ddev);
+}
+
static const struct dev_pm_ops drv_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(drv_suspend, drv_resume)
+ SET_RUNTIME_PM_OPS(drv_runtime_suspend,
+ drv_runtime_resume, NULL)
};
static int stm_drm_platform_probe(struct platform_device *pdev)