From 1dc3517d2fe854f1d174567f8410c3e20ebc3bcb Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Thu, 25 May 2017 09:40:34 +0800 Subject: [PATCH] drm/rockchip: vop: add error irq handle Change-Id: I84a3bc5c9798bbd4e0b11bc499f4df5ca1907cb7 Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index f45ce3277422..8be416d99a84 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -939,6 +939,7 @@ err_disable_hclk: static void vop_initial(struct drm_crtc *crtc) { struct vop *vop = to_vop(crtc); + uint32_t irqs; int i; vop_power_enable(crtc); @@ -972,6 +973,12 @@ static void vop_initial(struct drm_crtc *crtc) VOP_WIN_SET(vop, win, gate, 1); } VOP_CTRL_SET(vop, afbdc_en, 0); + + irqs = BUS_ERROR_INTR | WIN0_EMPTY_INTR | WIN1_EMPTY_INTR | + WIN2_EMPTY_INTR | WIN3_EMPTY_INTR | HWC_EMPTY_INTR | + POST_BUF_EMPTY_INTR; + VOP_INTR_SET_TYPE(vop, clear, irqs, 1); + VOP_INTR_SET_TYPE(vop, enable, irqs, 1); } static void vop_crtc_disable(struct drm_crtc *crtc) @@ -2609,6 +2616,23 @@ static irqreturn_t vop_isr(int irq, void *data) ret = IRQ_HANDLED; } +#define ERROR_HANDLER(x) \ + do { \ + if (active_irqs & x##_INTR) {\ + DRM_DEV_ERROR_RATELIMITED(vop->dev, #x " irq err\n"); \ + active_irqs &= ~x##_INTR; \ + ret = IRQ_HANDLED; \ + } \ + } while (0) + + ERROR_HANDLER(BUS_ERROR); + ERROR_HANDLER(WIN0_EMPTY); + ERROR_HANDLER(WIN1_EMPTY); + ERROR_HANDLER(WIN2_EMPTY); + ERROR_HANDLER(WIN3_EMPTY); + ERROR_HANDLER(HWC_EMPTY); + ERROR_HANDLER(POST_BUF_EMPTY); + /* Unhandled irqs are spurious. */ if (active_irqs) DRM_ERROR("Unknown VOP IRQs: %#02x\n", active_irqs); -- 2.34.1