Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: atmel-hlcdc: use appropriate enabled flag in suspend/resume

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>

authored by

Sylvain Rochet and committed by
Boris Brezillon
f026eb6e 03be7005

+28 -15
+21
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 207 207 crtc->enabled = true; 208 208 } 209 209 210 + void atmel_hlcdc_crtc_suspend(struct drm_crtc *c) 211 + { 212 + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); 213 + 214 + if (crtc->enabled) { 215 + atmel_hlcdc_crtc_disable(c); 216 + /* save enable state for resume */ 217 + crtc->enabled = true; 218 + } 219 + } 220 + 221 + void atmel_hlcdc_crtc_resume(struct drm_crtc *c) 222 + { 223 + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); 224 + 225 + if (crtc->enabled) { 226 + crtc->enabled = false; 227 + atmel_hlcdc_crtc_enable(c); 228 + } 229 + } 230 + 210 231 static int atmel_hlcdc_crtc_atomic_check(struct drm_crtc *c, 211 232 struct drm_crtc_state *s) 212 233 {
+4 -15
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
··· 569 569 return 0; 570 570 571 571 drm_modeset_lock_all(drm_dev); 572 - list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) { 573 - struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 574 - if (crtc->enabled) { 575 - crtc_funcs->disable(crtc); 576 - /* save enable state for resume */ 577 - crtc->enabled = true; 578 - } 579 - } 572 + list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) 573 + atmel_hlcdc_crtc_suspend(crtc); 580 574 drm_modeset_unlock_all(drm_dev); 581 575 return 0; 582 576 } ··· 584 590 return 0; 585 591 586 592 drm_modeset_lock_all(drm_dev); 587 - list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) { 588 - struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 589 - if (crtc->enabled) { 590 - crtc->enabled = false; 591 - crtc_funcs->enable(crtc); 592 - } 593 - } 593 + list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) 594 + atmel_hlcdc_crtc_resume(crtc); 594 595 drm_modeset_unlock_all(drm_dev); 595 596 return 0; 596 597 }
+3
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
··· 155 155 void atmel_hlcdc_crtc_cancel_page_flip(struct drm_crtc *crtc, 156 156 struct drm_file *file); 157 157 158 + void atmel_hlcdc_crtc_suspend(struct drm_crtc *crtc); 159 + void atmel_hlcdc_crtc_resume(struct drm_crtc *crtc); 160 + 158 161 int atmel_hlcdc_crtc_create(struct drm_device *dev); 159 162 160 163 int atmel_hlcdc_create_outputs(struct drm_device *dev);