diff mbox series

[10/25] drm: kirin: Move workqueue to ade_hw_ctx structure

Message ID 1556061656-1733-11-git-send-email-john.stultz@linaro.org
State Superseded
Headers show
Series drm: Kirin driver cleanups to prep for Kirin960 support | expand

Commit Message

John Stultz April 23, 2019, 11:20 p.m. UTC
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: Xinliang Liu <z.liuxinliang@hisilicon.com>
Cc: Rongrong Zou <zourongrong@gmail.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

-- 
2.7.4

Comments

John Stultz April 24, 2019, 4:51 p.m. UTC | #1
On Wed, Apr 24, 2019 at 9:46 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>

> Hi John.

>

> On Tue, Apr 23, 2019 at 04:20:41PM -0700, John Stultz wrote:

> > 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: Xinliang Liu <z.liuxinliang@hisilicon.com>

> > Cc: Rongrong Zou <zourongrong@gmail.com>

> > Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>

> > Cc: Chen Feng <puck.chen@hisilicon.com>

> > Cc: David Airlie <airlied@linux.ie>

> > Cc: Daniel Vetter <daniel@ffwll.ch>

> > Cc: dri-devel <dri-devel@lists.freedesktop.org>

> > Signed-off-by: John Stultz <john.stultz@linaro.org>

> > ---

> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++-------

> >  1 file changed, 5 insertions(+), 7 deletions(-)

> >

> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c

> > index 94dcad0..f54cf99 100644

> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c

> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c

> > @@ -52,6 +52,7 @@ struct ade_hw_ctx {

> >       struct clk *media_noc_clk;

> >       struct clk *ade_pix_clk;

> >       struct reset_control *reset;

> > +     struct work_struct drm_device_wq;

>

> The comment probarly belongs to 01/25...

> The name drm_device_wq is not at all descriptive.

> Consider something like: display_reset_wq


I agree, that sounds like a nice improvement! I'll tweak it in patch 1/25.

thanks for the review and feedback!
-john
diff mbox series

Patch

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 94dcad0..f54cf99 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -52,6 +52,7 @@  struct ade_hw_ctx {
 	struct clk *media_noc_clk;
 	struct clk *ade_pix_clk;
 	struct reset_control *reset;
+	struct work_struct drm_device_wq;
 	bool power_on;
 	int irq;
 
@@ -61,7 +62,6 @@  struct ade_hw_ctx {
 struct kirin_crtc {
 	struct drm_crtc base;
 	void *hw_ctx;
-	struct work_struct drm_device_wq;
 	bool enable;
 };
 
@@ -349,9 +349,9 @@  static void ade_crtc_disable_vblank(struct drm_crtc *crtc)
 
 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,
 					      drm_device_wq);
-	struct drm_device *drm_dev = (&acrtc->base)->dev;
+	struct drm_device *drm_dev = ctx->crtc->dev;
 	struct drm_atomic_state *state;
 
 	state = drm_atomic_helper_suspend(drm_dev);
@@ -362,7 +362,6 @@  static irqreturn_t ade_irq_handler(int irq, void *data)
 {
 	struct ade_hw_ctx *ctx = data;
 	struct drm_crtc *crtc = ctx->crtc;
-	struct kirin_crtc *kcrtc = to_kirin_crtc(crtc);
 	void __iomem *base = ctx->base;
 	u32 status;
 
@@ -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,
 				MASK(1), 1);
 		DRM_ERROR("LDI underflow!");
-		schedule_work(&kcrtc->drm_device_wq);
+		schedule_work(&ctx->drm_device_wq);
 	}
 
 	return IRQ_HANDLED;
@@ -1016,6 +1015,7 @@  static void *ade_hw_ctx_alloc(struct platform_device *pdev,
 	if (ret)
 		return ERR_PTR(-EIO);
 
+	INIT_WORK(&ctx->drm_device_wq, drm_underflow_wq);
 	ctx->crtc = crtc;
 
 	return ctx;
@@ -1071,8 +1071,6 @@  static int ade_drm_init(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	INIT_WORK(&kcrtc->drm_device_wq, drm_underflow_wq);
-
 	return 0;
 }