aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-07-15 13:11:25 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-10-01 09:33:27 -0400
commit583268035825fc5ef0bbc467631fea0358831cbe (patch)
tree26584d63598eb4b0ca053407566a8d6707391201
parentde32301b86030b20a51151a12d81fff6429cad0c (diff)
drm/armada: provide a common helper to disable a plane
Provide a common helper to disable either the overlay or the primary plane. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.c33
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.h3
-rw-r--r--drivers/gpu/drm/armada/armada_overlay.c7
3 files changed, 31 insertions, 12 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index f146fcf6b274..007fc5d3eb54 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -700,18 +700,39 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
700 return 0; 700 return 0;
701} 701}
702 702
703void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
704 struct drm_plane *plane)
705{
706 u32 sram_para1;
707
708 /*
709 * Drop our reference on any framebuffer attached to this plane.
710 * We don't need to NULL this out as drm_plane_force_disable(),
711 * and __setplane_internal() will do so for an overlay plane, and
712 * __drm_helper_disable_unused_functions() will do so for the
713 * primary plane.
714 */
715 if (plane->fb)
716 drm_framebuffer_unreference(plane->fb);
717
718 /* Power down the Y/U/V FIFOs */
719 sram_para1 = CFG_PDWN16x66 | CFG_PDWN32x66;
720
721 /* Power down most RAMs and FIFOs if this is the primary plane */
722 if (plane->type == DRM_PLANE_TYPE_PRIMARY)
723 sram_para1 |= CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 |
724 CFG_PDWN32x32 | CFG_PDWN64x66;
725
726 armada_updatel(sram_para1, 0, dcrtc->base + LCD_SPU_SRAM_PARA1);
727}
728
703/* The mode_config.mutex will be held for this call */ 729/* The mode_config.mutex will be held for this call */
704static void armada_drm_crtc_disable(struct drm_crtc *crtc) 730static void armada_drm_crtc_disable(struct drm_crtc *crtc)
705{ 731{
706 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); 732 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
707 733
708 armada_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); 734 armada_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
709 armada_drm_crtc_finish_fb(dcrtc, crtc->primary->fb, true); 735 armada_drm_crtc_plane_disable(dcrtc, crtc->primary);
710
711 /* Power down most RAMs and FIFOs */
712 writel_relaxed(CFG_PDWN256x32 | CFG_PDWN256x24 | CFG_PDWN256x8 |
713 CFG_PDWN32x32 | CFG_PDWN16x66 | CFG_PDWN32x66 |
714 CFG_PDWN64x66, dcrtc->base + LCD_SPU_SRAM_PARA1);
715} 736}
716 737
717static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = { 738static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h
index 549b5f538266..500ce0f43f64 100644
--- a/drivers/gpu/drm/armada/armada_crtc.h
+++ b/drivers/gpu/drm/armada/armada_crtc.h
@@ -103,6 +103,9 @@ void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
103void armada_drm_crtc_enable_irq(struct armada_crtc *, u32); 103void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
104void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); 104void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
105 105
106void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
107 struct drm_plane *plane);
108
106extern struct platform_driver armada_lcd_platform_driver; 109extern struct platform_driver armada_lcd_platform_driver;
107 110
108#endif 111#endif
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index e5a5b73a08cb..1032f9b3d5f1 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -279,12 +279,7 @@ static int armada_ovl_plane_disable(struct drm_plane *plane)
279 dplane->ctrl0 = 0; 279 dplane->ctrl0 = 0;
280 spin_unlock_irq(&dcrtc->irq_lock); 280 spin_unlock_irq(&dcrtc->irq_lock);
281 281
282 /* Power down the Y/U/V FIFOs */ 282 armada_drm_crtc_plane_disable(dcrtc, plane);
283 armada_updatel(CFG_PDWN16x66 | CFG_PDWN32x66, 0,
284 dcrtc->base + LCD_SPU_SRAM_PARA1);
285
286 if (plane->fb)
287 drm_framebuffer_unreference(plane->fb);
288 283
289 fb = xchg(&dplane->old_fb, NULL); 284 fb = xchg(&dplane->old_fb, NULL);
290 if (fb) 285 if (fb)