From patchwork Mon Aug 19 23:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171739 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595919ily; Mon, 19 Aug 2019 16:03:41 -0700 (PDT) X-Received: by 2002:a65:6891:: with SMTP id e17mr22557450pgt.305.1566255821370; Mon, 19 Aug 2019 16:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255821; cv=none; d=google.com; s=arc-20160816; b=eZM5oflTEi/F6VT8qHXK3UvL8rtH/9kxqqhDBJzQnP3PhC1G3kkIRsF0QTlA29Zor5 ECr4a2RdSm6rEOryCRQdfBh5PqDQbwTZxf1Xp1wTPQ5I4aCxkdQLqFl0fadhIVGcArT0 xpXAjy4q9xDyP2cho5Ost+Y4xp6FfUiTF9Yv+f2Vho+aLoUIfcG9rJv/AtLtmKVxM6Sq dKM3KtH7A7g0kmzbL5POBiUNqrGPFFPA9ZP4KuuCDzgC9/UKJRb3fE+fHs7LGOXD2ZJU glXy0pURjY6U15awgPbTLCJLXy/X/0K1vfKbWfMD+DnKKeUo9/xTssRjJo3AqegM2EqZ hUsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=B+pwIVmz2q+CRTZx5FVGmPIEnUSkUD9OEUWq4o6ZKy5o+83mbHm0s+/xI3D0UP+any XmqEI48RhPs1N+Nds07OjJsQtw29cLm8CIvm4QYdBgr6Qxku6ceVq58G5q1OMeQrKdXH RCFXnUiJcOnbRjx39dmGsec40CdHJHJppctTU4HEF5nKceBthPWEOZr5+4zkwU+iSIyR qVUeK1hFWlkkVEVf5feOuqTjJhXn9UyQtAE63A8r0FG6gILcG+mHEz1/x4SqIRMyWbAl 4kN5mykUz94jgJKNst32t7pJZjWg+a8UfeUviw3hsc4Mch9SKMmFk4pCMM0Nzfa2+Bn1 LliQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2V9cPKg; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id bt15sor2450152pjb.26.2019.08.19.16.03.41 for (Google Transport Security); Mon, 19 Aug 2019 16:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2V9cPKg; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=l2V9cPKgC+xQf+M9Eq7V3R8A3hyhWD12bHUmsJxWIyt0fstaXxqCmLfeGxRgmVOXqy 7B1Apsgv8PJHo4NM/w9wVyo2A83K3EejfwDWpzf/9jW7IpeJTjDRkJKdwAvN4ABQVs/T fVyIrAOR44GEq3ZqXg6hS5HgyrNA1aO74nqpvIdI2IG9dSUUkVeBZtCx9SCoI3eEe25L AYrm9KmrTi6I0zf05rvkRW/Qcdwl8mYmmX0sGPiRfgn10oRr9LFfYeWsQjU6v3kbpzvT xAWummgxsvsYfQWrtNRvuIYBsP92PNtkufKW7vNvuhVChCUj0Bmg+T+zSHkPFrlvsBEz yTLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=YD4LnYXrV7w+NN5nQkT+Sjg6UK1yufPT6udDDJbcmec4rL3Ahly9ihs/cxQRa3gnSM chLCyypJYKMJ2Y07uU5iEocgSzngWS34pFIZUjueHC1AjZ7xSSKEhZg3vSV6tksuxMI2 2ESr3kMjDmgKl9a25c9YeVIOA/e1R6ATQmUlqJEDV7M8zPXp0JInHWj6SLE0hFVLjJCW tAFPonpQBmRbtwxICn3Ems451gwAphs3ejm7lnl0Bx+kchueM78bE4MHDGQZxh1wsa8T snZmFOg2rkMUhU5NhhbTIuWRzObUOCtNR8HO+2bSt0I7LBmT2dLBqrLGVPOnnh91GQWs 2y1g== X-Gm-Message-State: APjAAAWcR0vt3p9mO0nmCpc9TWPuKZ7+MZlMwDtSpEmytOqdwjWxlxUa AQIuN6agx2dD/uu2RQaiqLmr6hCy X-Google-Smtp-Source: APXvYqyw7LbadLphD6JSmUioN4e4iV4Ibw8oT+is92wCfKEWMmhG+Ndg2xlLGksLs39nRlBJXygTng== X-Received: by 2002:a17:90b:8c5:: with SMTP id ds5mr23549322pjb.142.1566255820961; Mon, 19 Aug 2019 16:03:40 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:40 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [PATCH v4 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Mon, 19 Aug 2019 23:03:06 +0000 Message-Id: <20190819230321.56480-11-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> 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 Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 8f50115a22d8..191ee59f68b6 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 display_reset_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 display_reset_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, display_reset_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->display_reset_wq); + schedule_work(&ctx->display_reset_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->display_reset_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->display_reset_wq, drm_underflow_wq); - return 0; }