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: 11102325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2815E1398 for ; Mon, 19 Aug 2019 23:04:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11E1E22CF7 for ; Mon, 19 Aug 2019 23:04:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11E1E22CF7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BE7F6E483; Mon, 19 Aug 2019 23:03:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F6646E45B for ; Mon, 19 Aug 2019 23:03:41 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id m3so2021947pgv.13 for ; Mon, 19 Aug 2019 16:03:41 -0700 (PDT) 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=q5BICbx9bmP6Oyb1vnBlsIS5ulY+RSLTGvz9JGnIL8epo+/fXEBxhm4C/ZF+SP2QoQ gi8N7Z8oj2kWf0QLn3Esu/Jx+kKopGmwYTPHtJBlGOPfFxnBxhIYYNbu8MFxqNhn8orV ioVWNmV/gGES8+ZhEHozTELVGPRgKnWRCr24uVXAX0Blvvy2MoQNMzjz53xZv09ixb6v A1F1fsbMEy5uxTxip++0GZynxDn0ERQcehj1q5rygypaQWA0qCj2ee9NdvE/wXYY+XbE a5tEABhWpbi9K2ZU8Y/bY0f9aKSw/8yTgyRWMqzSF2ThuwFHgfyz8OYB2jS5o/8eKDtN Cz4w== X-Gm-Message-State: APjAAAViCM7Am2W9vZlu1BQoTacGAsjdE1U19Ga2UZbs/Bvo588oroOJ wsC/3qkoQP6Iaqy3Wc0P0XLJyA== 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) 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 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> X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , dri-devel , Xinliang Liu , Rongrong Zou , Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-) 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; }