From patchwork Mon Sep 4 02:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF5B8C83F2D for ; Mon, 4 Sep 2023 02:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240586AbjIDCFC (ORCPT ); Sun, 3 Sep 2023 22:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350357AbjIDCFC (ORCPT ); Sun, 3 Sep 2023 22:05:02 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BDE3106 for ; Sun, 3 Sep 2023 19:04:58 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2bcc331f942so11423851fa.0 for ; Sun, 03 Sep 2023 19:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693793096; x=1694397896; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RxIfvevq87WVmZljmdsOUb7zNfjaAH8j0tUqxn+e9Jw=; b=ekGUgxQTGQQTsHFTPSuIc63sHUljD7KVmxrpIfOphx0HhXOlxHuk+eM12IrfODeJCm o3/GgLhtuOoOUauvZkUZrR/cYU7Ti37dgLuqNCdtCWwMD9l6sCAFkpyjwM25FmzHDeU1 GfF0+AG+C5UieGxzFd++fnrqDpbuEuwTKe/kUOw9ZWp9utxf8QOCO6gVgTK5BadDlr/L OOoXis/SO69L2e9CMTBCs+BP6ew4L7R/Bzz49mf5wjn0llMfxOiaNQ++JiAFY+2Z7Un9 TsCmp0hHhz56zURpszII/iwtLnjVKTYNj2iWa4Jyc9UFphUNeZcvhMnpJk9XHMCLRmfq 6C2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693793096; x=1694397896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RxIfvevq87WVmZljmdsOUb7zNfjaAH8j0tUqxn+e9Jw=; b=FaEeaycLtfWdV3KDgttBE+DYCgNUDngLhr5KblwJuFhn+DCmwdTjWCUBzr+LWpQYx4 glqD0+O/UdeFI0b5i5V21hZuJXM0S/GHf2TZoq4eNCElh1VCM83XhDg45z2VgOvgD9jQ cuPOBX2LpMMGMEcAPHmUjVeGumiKe4P32Xv1bArqvP313QLoyk2S9RWKLuEjE+hHiSNV bEHuh2tebOlYo+3FKK/6+LwEtBLQFwZBu5c0XbG1h/lZObnF+407k80m+oR6oMFCd2PP RNgv5y9Sdo0hGTcC6YEdebnDOZIDLv1Lr01U8KiI0Rb1ma72b++cLHSSPtJL01DsUMB2 k7IA== X-Gm-Message-State: AOJu0Yx8FHeRc/Y8zAmHFPy1xEUWG2J2Zv95TCh9WjpTZdqAHazTR0rU ShYWaI2X8HX/G27a6ciFwp33sQ== X-Google-Smtp-Source: AGHT+IF4AL00qrBYG914cfs2MtjwiEgixFaAhw+pEt4e47Fkg5dl2OorMKe4mVmiFeBh/XLwZZN5NQ== X-Received: by 2002:a2e:910b:0:b0:2bd:d31:d1ee with SMTP id m11-20020a2e910b000000b002bd0d31d1eemr2456620ljg.14.1693793096654; Sun, 03 Sep 2023 19:04:56 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t13-20020a2e9c4d000000b002bce0e9385asm1818237ljj.9.2023.09.03.19.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 19:04:56 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar , Marijn Suijten Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v3 2/8] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW Date: Mon, 4 Sep 2023 05:04:48 +0300 Message-Id: <20230904020454.2945667-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230904020454.2945667-1-dmitry.baryshkov@linaro.org> References: <20230904020454.2945667-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line. Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 6 ++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 9298c166b213..057cac7f5d93 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -282,7 +282,7 @@ static int dpu_hw_pp_setup_dsc(struct dpu_hw_pingpong *pp) } struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, - void __iomem *addr) + void __iomem *addr, const struct dpu_mdss_version *mdss_rev) { struct dpu_hw_pingpong *c; @@ -296,7 +296,9 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, c->idx = cfg->id; c->caps = cfg; - if (test_bit(DPU_PINGPONG_TE, &cfg->features)) { + if (mdss_rev->core_major_ver < 5) { + WARN_ON(!cfg->intr_rdptr); + c->ops.enable_tearcheck = dpu_hw_pp_enable_te; c->ops.disable_tearcheck = dpu_hw_pp_disable_te; c->ops.connect_external_te = dpu_hw_pp_connect_external_te; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h index d3246a9a5808..0d541ca5b056 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -123,10 +123,11 @@ static inline struct dpu_hw_pingpong *to_dpu_hw_pingpong(struct dpu_hw_blk *hw) * pingpong catalog entry. * @cfg: Pingpong catalog entry for which driver object is required * @addr: Mapped register io address of MDP + * @mdss_rev: dpu core's major and minor versions * Return: Error code or allocated dpu_hw_pingpong context */ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, - void __iomem *addr); + void __iomem *addr, const struct dpu_mdss_version *mdss_rev); /** * dpu_hw_pingpong_destroy - destroys pingpong driver context diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index f9215643c71a..f3aff605554d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -146,7 +146,7 @@ int dpu_rm_init(struct dpu_rm *rm, struct dpu_hw_pingpong *hw; const struct dpu_pingpong_cfg *pp = &cat->pingpong[i]; - hw = dpu_hw_pingpong_init(pp, mmio); + hw = dpu_hw_pingpong_init(pp, mmio, cat->mdss_ver); if (IS_ERR(hw)) { rc = PTR_ERR(hw); DPU_ERROR("failed pingpong object creation: err %d\n",