drm: atmel-hlcdc: use appropriate enabled flag in suspend/resume
authorSylvain Rochet <sylvain.rochet@finsecur.com>
Thu, 12 Mar 2015 18:47:19 +0000 (19:47 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 16 Mar 2015 15:10:42 +0000 (16:10 +0100)
Unfortunately we used the enabled flag in struct drm_crtc instead of the
enabled flag in struct atmel_hlcdc_crtc. This obviously leads to
discrepancies on crtc enable state.

This patch fixes the issue by using the struct atmel_hlcdc_crtc enabled
flag in PM support.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h

index d55c0c232e1d40c73520220d24a5ef2f5bc25488..f69b92535505b5ae1c899d6f9b08f76501851fa7 100644 (file)
@@ -207,6 +207,27 @@ static void atmel_hlcdc_crtc_enable(struct drm_crtc *c)
        crtc->enabled = true;
 }
 
+void atmel_hlcdc_crtc_suspend(struct drm_crtc *c)
+{
+       struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
+
+       if (crtc->enabled) {
+               atmel_hlcdc_crtc_disable(c);
+               /* save enable state for resume */
+               crtc->enabled = true;
+       }
+}
+
+void atmel_hlcdc_crtc_resume(struct drm_crtc *c)
+{
+       struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c);
+
+       if (crtc->enabled) {
+               crtc->enabled = false;
+               atmel_hlcdc_crtc_enable(c);
+       }
+}
+
 static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c,
                                         struct drm_crtc_state *s)
 {
index c4bb1f9f95c63382250e9f09a95b9a1cf2dd6216..60b0c13d7ff5cc6f4c338c9ed3d7f423d684c84e 100644 (file)
@@ -569,14 +569,8 @@ static int atmel_hlcdc_dc_drm_suspend(struct device *dev)
                return 0;
 
        drm_modeset_lock_all(drm_dev);
-       list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) {
-               struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
-               if (crtc->enabled) {
-                       crtc_funcs->disable(crtc);
-                       /* save enable state for resume */
-                       crtc->enabled = true;
-               }
-       }
+       list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head)
+               atmel_hlcdc_crtc_suspend(crtc);
        drm_modeset_unlock_all(drm_dev);
        return 0;
 }
@@ -590,13 +584,8 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev)
                return 0;
 
        drm_modeset_lock_all(drm_dev);
-       list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) {
-               struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
-               if (crtc->enabled) {
-                       crtc->enabled = false;
-                       crtc_funcs->enable(crtc);
-               }
-       }
+       list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head)
+               atmel_hlcdc_crtc_resume(crtc);
        drm_modeset_unlock_all(drm_dev);
        return 0;
 }
index 1ea9c2ccd8a74f0a1e4918a2a1a3f7127aa0adda..cf6b375bc38d1430c892ea2bf69cdf144047efd8 100644 (file)
@@ -155,6 +155,9 @@ void atmel_hlcdc_crtc_irq(struct drm_crtc *c);
 void atmel_hlcdc_crtc_cancel_page_flip(struct drm_crtc *crtc,
                                       struct drm_file *file);
 
+void atmel_hlcdc_crtc_suspend(struct drm_crtc *crtc);
+void atmel_hlcdc_crtc_resume(struct drm_crtc *crtc);
+
 int atmel_hlcdc_crtc_create(struct drm_device *dev);
 
 int atmel_hlcdc_create_outputs(struct drm_device *dev);