Commit 52927712 authored by John Stultz's avatar John Stultz Committed by Sam Ravnborg

drm: kirin: Move workqueue to ade_hw_ctx structure

The workqueue used to reset the display when we hit an LDI
underflow error is ADE specific, so since this patch series
works to make the kirin_crtc structure more generic, move the
workqueue to the ade_hw_ctx structure instead.

Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarXinliang Liu <z.liuxinliang@hisilicon.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190820230626.23253-11-john.stultz@linaro.org
parent 36f8d22d
...@@ -52,6 +52,7 @@ struct ade_hw_ctx { ...@@ -52,6 +52,7 @@ struct ade_hw_ctx {
struct clk *media_noc_clk; struct clk *media_noc_clk;
struct clk *ade_pix_clk; struct clk *ade_pix_clk;
struct reset_control *reset; struct reset_control *reset;
struct work_struct display_reset_wq;
bool power_on; bool power_on;
int irq; int irq;
...@@ -61,7 +62,6 @@ struct ade_hw_ctx { ...@@ -61,7 +62,6 @@ struct ade_hw_ctx {
struct kirin_crtc { struct kirin_crtc {
struct drm_crtc base; struct drm_crtc base;
void *hw_ctx; void *hw_ctx;
struct work_struct display_reset_wq;
bool enable; bool enable;
}; };
...@@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) ...@@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
static void drm_underflow_wq(struct work_struct *work) static void drm_underflow_wq(struct work_struct *work)
{ {
struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx,
display_reset_wq); display_reset_wq);
struct drm_device *drm_dev = (&acrtc->base)->dev; struct drm_device *drm_dev = ctx->crtc->dev;
struct drm_atomic_state *state; struct drm_atomic_state *state;
state = drm_atomic_helper_suspend(drm_dev); state = drm_atomic_helper_suspend(drm_dev);
...@@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ...@@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
{ {
struct ade_hw_ctx *ctx = data; struct ade_hw_ctx *ctx = data;
struct drm_crtc *crtc = ctx->crtc; struct drm_crtc *crtc = ctx->crtc;
struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
void __iomem *base = ctx->base; void __iomem *base = ctx->base;
u32 status; u32 status;
...@@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ...@@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data)
ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST,
MASK(1), 1); MASK(1), 1);
DRM_ERROR("LDI underflow!"); DRM_ERROR("LDI underflow!");
schedule_work(&kcrtc->display_reset_wq); schedule_work(&ctx->display_reset_wq);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -1016,6 +1015,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev, ...@@ -1016,6 +1015,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev,
if (ret) if (ret)
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
INIT_WORK(&ctx->display_reset_wq, drm_underflow_wq);
ctx->crtc = crtc; ctx->crtc = crtc;
return ctx; return ctx;
...@@ -1071,8 +1071,6 @@ static int ade_drm_init(struct platform_device *pdev) ...@@ -1071,8 +1071,6 @@ static int ade_drm_init(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment