diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-07-08 05:16:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-12-08 07:18:43 -0500 |
commit | f1f1bffcf01478883f92b69870fd29a4aae6fd64 (patch) | |
tree | b782bc13da97a48f6b8992250f8c039c091782d4 | |
parent | 28b304339900027988ace06bcbda8cd4c6a67883 (diff) |
drm/armada: clean up armada_drm_crtc_plane_disable()
Merge armada_drm_primary_disable() into armada_drm_crtc_plane_disable()
and rename to armada_drm_plane_disable(). Use this to simplify
armada_ovl_plane_disable().
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_overlay.c | 9 |
3 files changed, 14 insertions, 20 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 7f7f21166488..3287b72e48cc 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
@@ -1123,12 +1123,16 @@ static const struct drm_crtc_funcs armada_crtc_funcs = { | |||
1123 | .disable_vblank = armada_drm_crtc_disable_vblank, | 1123 | .disable_vblank = armada_drm_crtc_disable_vblank, |
1124 | }; | 1124 | }; |
1125 | 1125 | ||
1126 | void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, | 1126 | int armada_drm_plane_disable(struct drm_plane *plane, |
1127 | struct drm_plane *plane) | 1127 | struct drm_modeset_acquire_ctx *ctx) |
1128 | { | 1128 | { |
1129 | struct armada_plane *dplane = drm_to_armada_plane(plane); | 1129 | struct armada_plane *dplane = drm_to_armada_plane(plane); |
1130 | struct armada_crtc *dcrtc; | ||
1130 | u32 sram_para1, dma_ctrl0_mask; | 1131 | u32 sram_para1, dma_ctrl0_mask; |
1131 | 1132 | ||
1133 | if (!plane->crtc) | ||
1134 | return 0; | ||
1135 | |||
1132 | /* | 1136 | /* |
1133 | * Drop our reference on any framebuffer attached to this plane. | 1137 | * Drop our reference on any framebuffer attached to this plane. |
1134 | * We don't need to NULL this out as drm_plane_force_disable(), | 1138 | * We don't need to NULL this out as drm_plane_force_disable(), |
@@ -1150,6 +1154,8 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, | |||
1150 | dma_ctrl0_mask = CFG_DMA_ENA; | 1154 | dma_ctrl0_mask = CFG_DMA_ENA; |
1151 | } | 1155 | } |
1152 | 1156 | ||
1157 | dcrtc = drm_to_armada_crtc(plane->crtc); | ||
1158 | |||
1153 | /* Wait for any preceding work to complete, but don't wedge */ | 1159 | /* Wait for any preceding work to complete, but don't wedge */ |
1154 | if (WARN_ON(!armada_drm_plane_work_wait(dplane, HZ))) | 1160 | if (WARN_ON(!armada_drm_plane_work_wait(dplane, HZ))) |
1155 | armada_drm_plane_work_cancel(dcrtc, dplane); | 1161 | armada_drm_plane_work_cancel(dcrtc, dplane); |
@@ -1159,22 +1165,13 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, | |||
1159 | spin_unlock_irq(&dcrtc->irq_lock); | 1165 | spin_unlock_irq(&dcrtc->irq_lock); |
1160 | 1166 | ||
1161 | armada_updatel(sram_para1, 0, dcrtc->base + LCD_SPU_SRAM_PARA1); | 1167 | armada_updatel(sram_para1, 0, dcrtc->base + LCD_SPU_SRAM_PARA1); |
1162 | } | ||
1163 | |||
1164 | static int armada_drm_primary_disable(struct drm_plane *plane, | ||
1165 | struct drm_modeset_acquire_ctx *ctx) | ||
1166 | { | ||
1167 | if (plane->crtc) { | ||
1168 | struct armada_crtc *dcrtc = drm_to_armada_crtc(plane->crtc); | ||
1169 | 1168 | ||
1170 | armada_drm_crtc_plane_disable(dcrtc, plane); | ||
1171 | } | ||
1172 | return 0; | 1169 | return 0; |
1173 | } | 1170 | } |
1174 | 1171 | ||
1175 | static const struct drm_plane_funcs armada_primary_plane_funcs = { | 1172 | static const struct drm_plane_funcs armada_primary_plane_funcs = { |
1176 | .update_plane = drm_primary_helper_update, | 1173 | .update_plane = drm_primary_helper_update, |
1177 | .disable_plane = armada_drm_primary_disable, | 1174 | .disable_plane = armada_drm_plane_disable, |
1178 | .destroy = drm_primary_helper_destroy, | 1175 | .destroy = drm_primary_helper_destroy, |
1179 | }; | 1176 | }; |
1180 | 1177 | ||
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h index c26814c2ce08..521ae5b6ad86 100644 --- a/drivers/gpu/drm/armada/armada_crtc.h +++ b/drivers/gpu/drm/armada/armada_crtc.h | |||
@@ -106,8 +106,8 @@ struct armada_crtc { | |||
106 | 106 | ||
107 | void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); | 107 | void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); |
108 | 108 | ||
109 | void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, | 109 | int armada_drm_plane_disable(struct drm_plane *plane, |
110 | struct drm_plane *plane); | 110 | struct drm_modeset_acquire_ctx *ctx); |
111 | 111 | ||
112 | extern struct platform_driver armada_lcd_platform_driver; | 112 | extern struct platform_driver armada_lcd_platform_driver; |
113 | 113 | ||
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index cf8442583bfc..a53e7dd26b0b 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c | |||
@@ -264,15 +264,12 @@ static int armada_ovl_plane_disable(struct drm_plane *plane, | |||
264 | { | 264 | { |
265 | struct armada_ovl_plane *dplane = drm_to_armada_ovl_plane(plane); | 265 | struct armada_ovl_plane *dplane = drm_to_armada_ovl_plane(plane); |
266 | struct drm_framebuffer *fb; | 266 | struct drm_framebuffer *fb; |
267 | struct armada_crtc *dcrtc; | ||
268 | 267 | ||
269 | if (!dplane->base.base.crtc) | 268 | armada_drm_plane_disable(plane, ctx); |
270 | return 0; | ||
271 | 269 | ||
272 | dcrtc = drm_to_armada_crtc(dplane->base.base.crtc); | 270 | if (dplane->base.base.crtc) |
273 | armada_drm_crtc_plane_disable(dcrtc, plane); | 271 | drm_to_armada_crtc(dplane->base.base.crtc)->plane = NULL; |
274 | 272 | ||
275 | dcrtc->plane = NULL; | ||
276 | dplane->base.state.ctrl0 = 0; | 273 | dplane->base.state.ctrl0 = 0; |
277 | 274 | ||
278 | fb = xchg(&dplane->old_fb, NULL); | 275 | fb = xchg(&dplane->old_fb, NULL); |