drm/arm/mali: Use drm_mode_config_helper_suspend/resume()
authorNoralf Trønnes <noralf@tronnes.org>
Mon, 6 Nov 2017 19:18:09 +0000 (20:18 +0100)
committerNoralf Trønnes <noralf@tronnes.org>
Thu, 30 Nov 2017 17:18:33 +0000 (18:18 +0100)
Replace driver's code with the generic helpers that do the same thing.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171106191812.38927-4-noralf@tronnes.org
drivers/gpu/drm/arm/malidp_drv.c
drivers/gpu/drm/arm/malidp_drv.h

index b8944666a18f0e72ea4715ff8742c5675b90d8a4..75f0bce3394182160b52b3b3c15866e63ccabcdc 100644 (file)
@@ -27,6 +27,7 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 
 #include "malidp_drv.h"
@@ -749,34 +750,15 @@ static int malidp_platform_remove(struct platform_device *pdev)
 static int __maybe_unused malidp_pm_suspend(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct malidp_drm *malidp = drm->dev_private;
-
-       drm_kms_helper_poll_disable(drm);
-       console_lock();
-       drm_fbdev_cma_set_suspend(malidp->fbdev, 1);
-       console_unlock();
-       malidp->pm_state = drm_atomic_helper_suspend(drm);
-       if (IS_ERR(malidp->pm_state)) {
-               console_lock();
-               drm_fbdev_cma_set_suspend(malidp->fbdev, 0);
-               console_unlock();
-               drm_kms_helper_poll_enable(drm);
-               return PTR_ERR(malidp->pm_state);
-       }
 
-       return 0;
+       return drm_mode_config_helper_suspend(drm);
 }
 
 static int __maybe_unused malidp_pm_resume(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct malidp_drm *malidp = drm->dev_private;
 
-       drm_atomic_helper_resume(drm, malidp->pm_state);
-       console_lock();
-       drm_fbdev_cma_set_suspend(malidp->fbdev, 0);
-       console_unlock();
-       drm_kms_helper_poll_enable(drm);
+       drm_mode_config_helper_resume(drm);
 
        return 0;
 }
index 2e2033140efc0be4f4557ae3f05c6dafa0a67cf5..70ed6aeccf052192c50c3b9f48f3c135d112e786 100644 (file)
@@ -24,7 +24,6 @@ struct malidp_drm {
        struct drm_crtc crtc;
        wait_queue_head_t wq;
        atomic_t config_valid;
-       struct drm_atomic_state *pm_state;
        u32 core_id;
 };