Commit 3b712391 authored by Noralf Trønnes's avatar Noralf Trønnes

drm/fsl-dcu: Use drm_mode_config_helper_suspend/resume()

Replace driver's code with the generic helpers that do the same thing.

Cc: Stefan Agner <stefan@agner.ch>
Cc: Alison Wang <alison.wang@freescale.com>
Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Acked-by: default avatarStefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114212517.23536-5-noralf@tronnes.org
parent e1ef9006
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_modeset_helper.h>
#include "fsl_dcu_drm_crtc.h" #include "fsl_dcu_drm_crtc.h"
#include "fsl_dcu_drm_drv.h" #include "fsl_dcu_drm_drv.h"
...@@ -188,26 +189,17 @@ static struct drm_driver fsl_dcu_drm_driver = { ...@@ -188,26 +189,17 @@ static struct drm_driver fsl_dcu_drm_driver = {
static int fsl_dcu_drm_pm_suspend(struct device *dev) static int fsl_dcu_drm_pm_suspend(struct device *dev)
{ {
struct fsl_dcu_drm_device *fsl_dev = dev_get_drvdata(dev); struct fsl_dcu_drm_device *fsl_dev = dev_get_drvdata(dev);
int ret;
if (!fsl_dev) if (!fsl_dev)
return 0; return 0;
disable_irq(fsl_dev->irq); disable_irq(fsl_dev->irq);
drm_kms_helper_poll_disable(fsl_dev->drm);
console_lock();
drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 1);
console_unlock();
fsl_dev->state = drm_atomic_helper_suspend(fsl_dev->drm);
if (IS_ERR(fsl_dev->state)) {
console_lock();
drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0);
console_unlock();
drm_kms_helper_poll_enable(fsl_dev->drm); ret = drm_mode_config_helper_suspend(fsl_dev->drm);
if (ret) {
enable_irq(fsl_dev->irq); enable_irq(fsl_dev->irq);
return PTR_ERR(fsl_dev->state); return ret;
} }
clk_disable_unprepare(fsl_dev->clk); clk_disable_unprepare(fsl_dev->clk);
...@@ -233,13 +225,8 @@ static int fsl_dcu_drm_pm_resume(struct device *dev) ...@@ -233,13 +225,8 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
fsl_tcon_bypass_enable(fsl_dev->tcon); fsl_tcon_bypass_enable(fsl_dev->tcon);
fsl_dcu_drm_init_planes(fsl_dev->drm); fsl_dcu_drm_init_planes(fsl_dev->drm);
enable_irq(fsl_dev->irq); enable_irq(fsl_dev->irq);
drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
console_lock();
drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0);
console_unlock();
drm_kms_helper_poll_enable(fsl_dev->drm); drm_mode_config_helper_resume(fsl_dev->drm);
return 0; return 0;
} }
......
...@@ -196,7 +196,6 @@ struct fsl_dcu_drm_device { ...@@ -196,7 +196,6 @@ struct fsl_dcu_drm_device {
struct drm_encoder encoder; struct drm_encoder encoder;
struct fsl_dcu_drm_connector connector; struct fsl_dcu_drm_connector connector;
const struct fsl_dcu_soc_data *soc; const struct fsl_dcu_soc_data *soc;
struct drm_atomic_state *state;
}; };
int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev); int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev);
......
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