aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index fe4172e48ad2..95c621018443 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -181,6 +181,9 @@ static void fimd_commit(struct device *dev)
181 struct fb_videomode *timing = ctx->timing; 181 struct fb_videomode *timing = ctx->timing;
182 u32 val; 182 u32 val;
183 183
184 if (ctx->suspended)
185 return;
186
184 DRM_DEBUG_KMS("%s\n", __FILE__); 187 DRM_DEBUG_KMS("%s\n", __FILE__);
185 188
186 /* setup polarity values from machine code. */ 189 /* setup polarity values from machine code. */
@@ -414,6 +417,9 @@ static void fimd_win_commit(struct device *dev, int zpos)
414 417
415 DRM_DEBUG_KMS("%s\n", __FILE__); 418 DRM_DEBUG_KMS("%s\n", __FILE__);
416 419
420 if (ctx->suspended)
421 return;
422
417 if (win == DEFAULT_ZPOS) 423 if (win == DEFAULT_ZPOS)
418 win = ctx->default_win; 424 win = ctx->default_win;
419 425
@@ -885,6 +891,51 @@ out:
885 return 0; 891 return 0;
886} 892}
887 893
894#ifdef CONFIG_PM_SLEEP
895static int fimd_suspend(struct device *dev)
896{
897 struct fimd_context *ctx = get_fimd_context(dev);
898 int ret;
899
900 if (pm_runtime_suspended(dev))
901 return 0;
902
903 ret = pm_runtime_suspend(dev);
904 if (ret < 0)
905 return ret;
906
907 ctx->suspended = true;
908 return 0;
909}
910
911static int fimd_resume(struct device *dev)
912{
913 struct fimd_context *ctx = get_fimd_context(dev);
914 int ret;
915
916 ret = pm_runtime_resume(dev);
917 if (ret < 0) {
918 DRM_ERROR("failed to resume runtime pm.\n");
919 return ret;
920 }
921
922 pm_runtime_disable(dev);
923
924 ret = pm_runtime_set_active(dev);
925 if (ret < 0) {
926 DRM_ERROR("failed to active runtime pm.\n");
927 pm_runtime_enable(dev);
928 pm_runtime_suspend(dev);
929 return ret;
930 }
931
932 pm_runtime_enable(dev);
933
934 ctx->suspended = false;
935 return 0;
936}
937#endif
938
888#ifdef CONFIG_PM_RUNTIME 939#ifdef CONFIG_PM_RUNTIME
889static int fimd_runtime_suspend(struct device *dev) 940static int fimd_runtime_suspend(struct device *dev)
890{ 941{
@@ -917,11 +968,19 @@ static int fimd_runtime_resume(struct device *dev)
917 } 968 }
918 969
919 ctx->suspended = false; 970 ctx->suspended = false;
971
972 /* if vblank was enabled status, enable it again. */
973 if (test_and_clear_bit(0, &ctx->irq_flags))
974 fimd_enable_vblank(dev);
975
976 fimd_apply(dev);
977
920 return 0; 978 return 0;
921} 979}
922#endif 980#endif
923 981
924static const struct dev_pm_ops fimd_pm_ops = { 982static const struct dev_pm_ops fimd_pm_ops = {
983 SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
925 SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) 984 SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
926}; 985};
927 986