diff options
| -rw-r--r-- | drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 40 | ||||
| -rw-r--r-- | drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 |
2 files changed, 35 insertions, 6 deletions
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 06a4d01c7e00..2bc4fa21cabf 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
| 13 | #include <linux/clk-provider.h> | 13 | #include <linux/clk-provider.h> |
| 14 | #include <linux/console.h> | ||
| 14 | #include <linux/io.h> | 15 | #include <linux/io.h> |
| 15 | #include <linux/mfd/syscon.h> | 16 | #include <linux/mfd/syscon.h> |
| 16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
| @@ -22,6 +23,7 @@ | |||
| 22 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
| 23 | 24 | ||
| 24 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
| 26 | #include <drm/drm_atomic_helper.h> | ||
| 25 | #include <drm/drm_crtc_helper.h> | 27 | #include <drm/drm_crtc_helper.h> |
| 26 | #include <drm/drm_fb_cma_helper.h> | 28 | #include <drm/drm_fb_cma_helper.h> |
| 27 | #include <drm/drm_gem_cma_helper.h> | 29 | #include <drm/drm_gem_cma_helper.h> |
| @@ -42,10 +44,8 @@ static const struct regmap_config fsl_dcu_regmap_config = { | |||
| 42 | .reg_bits = 32, | 44 | .reg_bits = 32, |
| 43 | .reg_stride = 4, | 45 | .reg_stride = 4, |
| 44 | .val_bits = 32, | 46 | .val_bits = 32, |
| 45 | .cache_type = REGCACHE_FLAT, | ||
| 46 | 47 | ||
| 47 | .volatile_reg = fsl_dcu_drm_is_volatile_reg, | 48 | .volatile_reg = fsl_dcu_drm_is_volatile_reg, |
| 48 | .max_register = 0x11fc, | ||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static int fsl_dcu_drm_irq_init(struct drm_device *dev) | 51 | static int fsl_dcu_drm_irq_init(struct drm_device *dev) |
| @@ -229,9 +229,25 @@ static int fsl_dcu_drm_pm_suspend(struct device *dev) | |||
| 229 | if (!fsl_dev) | 229 | if (!fsl_dev) |
| 230 | return 0; | 230 | return 0; |
| 231 | 231 | ||
| 232 | disable_irq(fsl_dev->irq); | ||
| 232 | drm_kms_helper_poll_disable(fsl_dev->drm); | 233 | drm_kms_helper_poll_disable(fsl_dev->drm); |
| 233 | regcache_cache_only(fsl_dev->regmap, true); | 234 | |
| 234 | regcache_mark_dirty(fsl_dev->regmap); | 235 | console_lock(); |
| 236 | drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 1); | ||
| 237 | console_unlock(); | ||
| 238 | |||
| 239 | fsl_dev->state = drm_atomic_helper_suspend(fsl_dev->drm); | ||
| 240 | if (IS_ERR(fsl_dev->state)) { | ||
| 241 | console_lock(); | ||
| 242 | drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0); | ||
| 243 | console_unlock(); | ||
| 244 | |||
| 245 | drm_kms_helper_poll_enable(fsl_dev->drm); | ||
| 246 | enable_irq(fsl_dev->irq); | ||
| 247 | return PTR_ERR(fsl_dev->state); | ||
| 248 | } | ||
| 249 | |||
| 250 | clk_disable_unprepare(fsl_dev->pix_clk); | ||
| 235 | clk_disable_unprepare(fsl_dev->clk); | 251 | clk_disable_unprepare(fsl_dev->clk); |
| 236 | 252 | ||
| 237 | return 0; | 253 | return 0; |
| @@ -251,9 +267,21 @@ static int fsl_dcu_drm_pm_resume(struct device *dev) | |||
| 251 | return ret; | 267 | return ret; |
| 252 | } | 268 | } |
| 253 | 269 | ||
| 270 | ret = clk_prepare_enable(fsl_dev->pix_clk); | ||
| 271 | if (ret < 0) { | ||
| 272 | dev_err(dev, "failed to enable pix clk\n"); | ||
| 273 | return ret; | ||
| 274 | } | ||
| 275 | |||
| 276 | fsl_dcu_drm_init_planes(fsl_dev->drm); | ||
| 277 | drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state); | ||
| 278 | |||
| 279 | console_lock(); | ||
| 280 | drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0); | ||
| 281 | console_unlock(); | ||
| 282 | |||
| 254 | drm_kms_helper_poll_enable(fsl_dev->drm); | 283 | drm_kms_helper_poll_enable(fsl_dev->drm); |
| 255 | regcache_cache_only(fsl_dev->regmap, false); | 284 | enable_irq(fsl_dev->irq); |
| 256 | regcache_sync(fsl_dev->regmap); | ||
| 257 | 285 | ||
| 258 | return 0; | 286 | return 0; |
| 259 | } | 287 | } |
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h index b1bba3ad79fc..3b371fe7491e 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | |||
| @@ -194,6 +194,7 @@ struct fsl_dcu_drm_device { | |||
| 194 | struct drm_encoder encoder; | 194 | struct drm_encoder encoder; |
| 195 | struct fsl_dcu_drm_connector connector; | 195 | struct fsl_dcu_drm_connector connector; |
| 196 | const struct fsl_dcu_soc_data *soc; | 196 | const struct fsl_dcu_soc_data *soc; |
| 197 | struct drm_atomic_state *state; | ||
| 197 | }; | 198 | }; |
| 198 | 199 | ||
| 199 | void fsl_dcu_fbdev_init(struct drm_device *dev); | 200 | void fsl_dcu_fbdev_init(struct drm_device *dev); |
