aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/imx/imx-drm-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/imx/imx-drm-core.c')
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index f0122afcf2a8..5ea0c82f9957 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -35,11 +35,6 @@
35 35
36#define MAX_CRTC 4 36#define MAX_CRTC 4
37 37
38struct imx_drm_device {
39 struct drm_device *drm;
40 struct drm_atomic_state *state;
41};
42
43#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) 38#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
44static int legacyfb_depth = 16; 39static int legacyfb_depth = 16;
45module_param(legacyfb_depth, int, 0444); 40module_param(legacyfb_depth, int, 0444);
@@ -218,22 +213,12 @@ static int compare_of(struct device *dev, void *data)
218static int imx_drm_bind(struct device *dev) 213static int imx_drm_bind(struct device *dev)
219{ 214{
220 struct drm_device *drm; 215 struct drm_device *drm;
221 struct imx_drm_device *imxdrm;
222 int ret; 216 int ret;
223 217
224 drm = drm_dev_alloc(&imx_drm_driver, dev); 218 drm = drm_dev_alloc(&imx_drm_driver, dev);
225 if (IS_ERR(drm)) 219 if (IS_ERR(drm))
226 return PTR_ERR(drm); 220 return PTR_ERR(drm);
227 221
228 imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL);
229 if (!imxdrm) {
230 ret = -ENOMEM;
231 goto err_put;
232 }
233
234 imxdrm->drm = drm;
235 drm->dev_private = imxdrm;
236
237 /* 222 /*
238 * enable drm irq mode. 223 * enable drm irq mode.
239 * - with irq_enabled = true, we can use the vblank feature. 224 * - with irq_enabled = true, we can use the vblank feature.
@@ -305,7 +290,6 @@ err_unbind:
305 component_unbind_all(drm->dev, drm); 290 component_unbind_all(drm->dev, drm);
306err_kms: 291err_kms:
307 drm_mode_config_cleanup(drm); 292 drm_mode_config_cleanup(drm);
308err_put:
309 drm_dev_put(drm); 293 drm_dev_put(drm);
310 294
311 return ret; 295 return ret;
@@ -354,37 +338,15 @@ static int imx_drm_platform_remove(struct platform_device *pdev)
354static int imx_drm_suspend(struct device *dev) 338static int imx_drm_suspend(struct device *dev)
355{ 339{
356 struct drm_device *drm_dev = dev_get_drvdata(dev); 340 struct drm_device *drm_dev = dev_get_drvdata(dev);
357 struct imx_drm_device *imxdrm;
358
359 /* The drm_dev is NULL before .load hook is called */
360 if (drm_dev == NULL)
361 return 0;
362
363 drm_kms_helper_poll_disable(drm_dev);
364 341
365 imxdrm = drm_dev->dev_private; 342 return drm_mode_config_helper_suspend(drm_dev);
366 imxdrm->state = drm_atomic_helper_suspend(drm_dev);
367 if (IS_ERR(imxdrm->state)) {
368 drm_kms_helper_poll_enable(drm_dev);
369 return PTR_ERR(imxdrm->state);
370 }
371
372 return 0;
373} 343}
374 344
375static int imx_drm_resume(struct device *dev) 345static int imx_drm_resume(struct device *dev)
376{ 346{
377 struct drm_device *drm_dev = dev_get_drvdata(dev); 347 struct drm_device *drm_dev = dev_get_drvdata(dev);
378 struct imx_drm_device *imx_drm;
379 348
380 if (drm_dev == NULL) 349 return drm_mode_config_helper_resume(drm_dev);
381 return 0;
382
383 imx_drm = drm_dev->dev_private;
384 drm_atomic_helper_resume(drm_dev, imx_drm->state);
385 drm_kms_helper_poll_enable(drm_dev);
386
387 return 0;
388} 350}
389#endif 351#endif
390 352