diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-03-01 07:31:01 -0500 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-03-16 06:23:59 -0400 |
commit | 99ed4d7eb2870ef114b3a1309836d021005e4292 (patch) | |
tree | 07635d2867ad18187ca2bcc8bb22709e33fb6656 /drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | |
parent | 82c8e025b577a4b9b87fbbc2a1c4dd401e3a2521 (diff) |
drm/atmel-hlcdc: Fix suspend/resume implementation
The current suspend resume implementation is assuming register values are
kept when entering suspend, which is no longer the case with the
suspend-to-RAM on the sama5d2.
While at it, switch to the generic infrastructure to enter suspend mode
(drm_atomic_helper_suspend/resume()).
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488371461-22243-1-git-send-email-boris.brezillon@free-electrons.com
Diffstat (limited to 'drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c')
-rw-r--r-- | drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 178acbf5f6c5..f4a3065f7f51 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | |||
@@ -800,31 +800,32 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) | |||
800 | static int atmel_hlcdc_dc_drm_suspend(struct device *dev) | 800 | static int atmel_hlcdc_dc_drm_suspend(struct device *dev) |
801 | { | 801 | { |
802 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 802 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
803 | struct drm_crtc *crtc; | 803 | struct atmel_hlcdc_dc *dc = drm_dev->dev_private; |
804 | struct regmap *regmap = dc->hlcdc->regmap; | ||
805 | struct drm_atomic_state *state; | ||
806 | |||
807 | state = drm_atomic_helper_suspend(drm_dev); | ||
808 | if (IS_ERR(state)) | ||
809 | return PTR_ERR(state); | ||
804 | 810 | ||
805 | if (pm_runtime_suspended(dev)) | 811 | dc->suspend.state = state; |
806 | return 0; | 812 | |
813 | regmap_read(regmap, ATMEL_HLCDC_IMR, &dc->suspend.imr); | ||
814 | regmap_write(regmap, ATMEL_HLCDC_IDR, dc->suspend.imr); | ||
815 | clk_disable_unprepare(dc->hlcdc->periph_clk); | ||
807 | 816 | ||
808 | drm_modeset_lock_all(drm_dev); | ||
809 | list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) | ||
810 | atmel_hlcdc_crtc_suspend(crtc); | ||
811 | drm_modeset_unlock_all(drm_dev); | ||
812 | return 0; | 817 | return 0; |
813 | } | 818 | } |
814 | 819 | ||
815 | static int atmel_hlcdc_dc_drm_resume(struct device *dev) | 820 | static int atmel_hlcdc_dc_drm_resume(struct device *dev) |
816 | { | 821 | { |
817 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 822 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
818 | struct drm_crtc *crtc; | 823 | struct atmel_hlcdc_dc *dc = drm_dev->dev_private; |
819 | 824 | ||
820 | if (pm_runtime_suspended(dev)) | 825 | clk_prepare_enable(dc->hlcdc->periph_clk); |
821 | return 0; | 826 | regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, dc->suspend.imr); |
822 | 827 | ||
823 | drm_modeset_lock_all(drm_dev); | 828 | return drm_atomic_helper_resume(drm_dev, dc->suspend.state); |
824 | list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) | ||
825 | atmel_hlcdc_crtc_resume(crtc); | ||
826 | drm_modeset_unlock_all(drm_dev); | ||
827 | return 0; | ||
828 | } | 829 | } |
829 | #endif | 830 | #endif |
830 | 831 | ||