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>
This commit is contained in:
Russell King 2017-07-08 10:16:42 +01:00
parent 28b3043399
commit f1f1bffcf0
3 changed files with 14 additions and 20 deletions

View File

@ -1123,12 +1123,16 @@ static const struct drm_crtc_funcs armada_crtc_funcs = {
.disable_vblank = armada_drm_crtc_disable_vblank,
};
void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
struct drm_plane *plane)
int armada_drm_plane_disable(struct drm_plane *plane,
struct drm_modeset_acquire_ctx *ctx)
{
struct armada_plane *dplane = drm_to_armada_plane(plane);
struct armada_crtc *dcrtc;
u32 sram_para1, dma_ctrl0_mask;
if (!plane->crtc)
return 0;
/*
* Drop our reference on any framebuffer attached to this plane.
* 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,
dma_ctrl0_mask = CFG_DMA_ENA;
}
dcrtc = drm_to_armada_crtc(plane->crtc);
/* Wait for any preceding work to complete, but don't wedge */
if (WARN_ON(!armada_drm_plane_work_wait(dplane, HZ)))
armada_drm_plane_work_cancel(dcrtc, dplane);
@ -1159,22 +1165,13 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
spin_unlock_irq(&dcrtc->irq_lock);
armada_updatel(sram_para1, 0, dcrtc->base + LCD_SPU_SRAM_PARA1);
}
static int armada_drm_primary_disable(struct drm_plane *plane,
struct drm_modeset_acquire_ctx *ctx)
{
if (plane->crtc) {
struct armada_crtc *dcrtc = drm_to_armada_crtc(plane->crtc);
armada_drm_crtc_plane_disable(dcrtc, plane);
}
return 0;
}
static const struct drm_plane_funcs armada_primary_plane_funcs = {
.update_plane = drm_primary_helper_update,
.disable_plane = armada_drm_primary_disable,
.disable_plane = armada_drm_plane_disable,
.destroy = drm_primary_helper_destroy,
};

View File

@ -106,8 +106,8 @@ struct armada_crtc {
void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
struct drm_plane *plane);
int armada_drm_plane_disable(struct drm_plane *plane,
struct drm_modeset_acquire_ctx *ctx);
extern struct platform_driver armada_lcd_platform_driver;

View File

@ -264,15 +264,12 @@ static int armada_ovl_plane_disable(struct drm_plane *plane,
{
struct armada_ovl_plane *dplane = drm_to_armada_ovl_plane(plane);
struct drm_framebuffer *fb;
struct armada_crtc *dcrtc;
if (!dplane->base.base.crtc)
return 0;
armada_drm_plane_disable(plane, ctx);
dcrtc = drm_to_armada_crtc(dplane->base.base.crtc);
armada_drm_crtc_plane_disable(dcrtc, plane);
if (dplane->base.base.crtc)
drm_to_armada_crtc(dplane->base.base.crtc)->plane = NULL;
dcrtc->plane = NULL;
dplane->base.state.ctrl0 = 0;
fb = xchg(&dplane->old_fb, NULL);