Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp645039pxm; Wed, 2 Mar 2022 05:52:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrJyHzWGm60RR4ko5Z6JCN9r3FrNZxFBHSXR3CI4EGXpojDXrJ3lCVyO+joI1+R4GXML18 X-Received: by 2002:a05:6402:b37:b0:400:500f:f26 with SMTP id bo23-20020a0564020b3700b00400500f0f26mr29076762edb.301.1646229145859; Wed, 02 Mar 2022 05:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646229145; cv=none; d=google.com; s=arc-20160816; b=mkAivbjExHpmHQIMxqR3aic2KfD7H7ghEGjT+2IDw7lC4zP7xsSGnDrJzD+DF4UCtP TQHULWyq8CzciHn7c7SsSeb+UiUl9PxcPKGTE2P5mX9gcjg/BWPjgcX6fdRB3opd3Xz/ d9E9rHhqirn9yu48JNIQPnGJLuW9FE710+f96Qs1CfGjvb2GMpFLxItMyDBRQPF2rDeT BAMR5s8cUk8DAt+GvIDR9ZTm5v14+rOd3eL0nLbgiH2l5l2hOEvaT1/K5neByG8K2vaW 5+lOW/p+QqPeg5R7Xn2XucZhpTeVL/bAW3nAd7RV/JFCE7RMqwbP7rQQQCRzapdzbjLV I97Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Tv+YgwvAaGuJMMXzyf8UKPqJBKWn/rWVKPq429RSyAw=; b=sR8fIOr2BElRYBukt4uKta+yYnjTReEgQUROrSRJ3zpl+WEFxQIO4YjDvLLxaEM4YL zGacXphwloDh3yopFU0jqX24ToeafiRpDY+3RsRCwx3xCDEKNe3haP1yAo2qmievDLh2 fc1RSFKT/rckhjE3ovaJ8bo0j8tq7obNfyZR4C8CdMxUHw16MbTJY+UMV72evOSaU5EQ 5pMBrdVRiRojgVCoRw8hE8IWcQlZFDmrBIVK01W6swFG5XkEBm/3Eh2LoHuPIalMrNOc YtkeIwGiNcCgRFLiO2KWAst9xKu14f3MhodfX9hb+UnuyD55vY6M/sOithduUMqSnfGK +KQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3LtYqtK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a170906838a00b006d00ace0297si9150723ejx.968.2022.03.02.05.52.02; Wed, 02 Mar 2022 05:52:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3LtYqtK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238902AbiCBB23 (ORCPT + 99 others); Tue, 1 Mar 2022 20:28:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236091AbiCBB2Y (ORCPT ); Tue, 1 Mar 2022 20:28:24 -0500 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA7223B019 for ; Tue, 1 Mar 2022 17:27:40 -0800 (PST) Received: by mail-oi1-x235.google.com with SMTP id s5so424856oic.10 for ; Tue, 01 Mar 2022 17:27:40 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=Tv+YgwvAaGuJMMXzyf8UKPqJBKWn/rWVKPq429RSyAw=; b=x3LtYqtKWT+YwkG6aAomkFJqE6JU/MeXuxpFJ2KtyAYFGYKoKOeI40r8rnf/ayswII E47xrummwGUAXr1NOPjw4BOQY0pDjWlpO58zJuELtiacrBW/iJFYzzd9s1X5t5EM11q1 09kpz+lXNSepjtrEr3XjDD5D7usBJ7ZJOKN/ttIZC0AzyNoVFcM7YRhBWsB4dZOASqg5 T/bdPwwM3Nw8IhMqH9O7rYIvI4y02rvoj7RAZFy2pWkTf6rWbQRQvIs5ltlBMzMAYmcm uX/hyel18lnuhsEddrvP0SUcJBP+3lZ/gAsd5DZtrCLGAaDhjlr9tUQ1U7TqWPd1LDjH z1fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tv+YgwvAaGuJMMXzyf8UKPqJBKWn/rWVKPq429RSyAw=; b=nkChftCLDccr97z7hhHbc9YjY3pwk/Pfduz5mtpRQ3TUC51b/Gu6IK8DcA38sf84rT 56hPgX2iffe83wTqRf4sYH8Usqx/vQwZLW0a4dn1l+rMOLC94dXyiiNiPG4TVJWmQ7MB /5EJj0UIGbVhn++TdP7FB3JB3CyU0IhNmHB6LN2HNXyup31dsFxs62d4jT6ykn6pQfTI AUOiNFayeflC6i83Lhls1pVTsWOF878mFF1zGFw4SWjZqRVR5MMK1yYzf5r6Ju0bvMNr frP63fqpo/4YpP853m6sRSVpBZ8kIoy645fmvWzohwgPHDmGgCSZT+AHe8AX4zwYJtWX Qm5g== X-Gm-Message-State: AOAM530tYXJ1Yl05EG075AkPpig/tUjJBV1pJljhDZ0rmblO4Yxbl/nr kIWnyz4CvEzXJriNGRwpMB6gog== X-Received: by 2002:a05:6808:e89:b0:2cf:cad3:e427 with SMTP id k9-20020a0568080e8900b002cfcad3e427mr15963208oil.20.1646184460000; Tue, 01 Mar 2022 17:27:40 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id t9-20020a056871054900b000c53354f98esm6728948oal.13.2022.03.01.17.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 17:27:39 -0800 (PST) From: Bjorn Andersson To: Rob Clark , Abhinav Kumar , Philipp Zabel , Dmitry Baryshkov , Loic Poulain Cc: Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] drm/msm/dpu: Issue MDSS reset during initialization Date: Tue, 1 Mar 2022 17:29:31 -0800 Message-Id: <20220302012931.4107196-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220302012931.4107196-1-bjorn.andersson@linaro.org> References: <20220302012931.4107196-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's typical for the bootloader to bring up the display for showing a boot splash or efi framebuffer. But in some cases the kernel driver ends up only partially configuring (in particular) the DPU, which might result in e.g. that two different data paths attempts to push data to the interface - with resulting graphical artifacts. Naturally the end goal would be to inherit the bootloader's configuration and provide the user with a glitch free handover from the boot configuration to a running DPU. But as implementing seamless transition from the bootloader configuration to the running OS will be a considerable effort, start by simply resetting the entire MDSS to its power-on state, to avoid the partial configuration. Signed-off-by: Bjorn Andersson --- Changes since v1: - Rather than trying to deconfigure individual pieces of the DPU, reset the entire block. drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 18 ++++++++++++++++++ drivers/gpu/drm/msm/msm_drv.c | 4 ++++ drivers/gpu/drm/msm/msm_kms.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c index b10ca505f9ac..419eaaefe606 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "dpu_kms.h" #define to_dpu_mdss(x) container_of(x, struct dpu_mdss, base) @@ -31,6 +32,7 @@ struct dpu_mdss { void __iomem *mmio; struct clk_bulk_data *clocks; size_t num_clocks; + struct reset_control *reset; struct dpu_irq_controller irq_controller; }; @@ -197,10 +199,18 @@ static void dpu_mdss_destroy(struct msm_mdss *mdss) dpu_mdss->mmio = NULL; } +static int dpu_mdss_reset(struct msm_mdss *mdss) +{ + struct dpu_mdss *dpu_mdss = to_dpu_mdss(mdss); + + return reset_control_reset(dpu_mdss->reset); +} + static const struct msm_mdss_funcs mdss_funcs = { .enable = dpu_mdss_enable, .disable = dpu_mdss_disable, .destroy = dpu_mdss_destroy, + .reset = dpu_mdss_reset, }; int dpu_mdss_init(struct platform_device *pdev) @@ -227,6 +237,13 @@ int dpu_mdss_init(struct platform_device *pdev) } dpu_mdss->num_clocks = ret; + dpu_mdss->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(dpu_mdss->reset)) { + ret = PTR_ERR(dpu_mdss->reset); + DPU_ERROR("failed to acquire mdss reset, ret=%d", ret); + goto reset_parse_err; + } + dpu_mdss->base.dev = &pdev->dev; dpu_mdss->base.funcs = &mdss_funcs; @@ -252,6 +269,7 @@ int dpu_mdss_init(struct platform_device *pdev) irq_error: _dpu_mdss_irq_domain_fini(dpu_mdss); irq_domain_error: +reset_parse_err: clk_parse_err: if (dpu_mdss->mmio) devm_iounmap(&pdev->dev, dpu_mdss->mmio); diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 129fa841ac22..7595f83da3f1 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -388,6 +388,10 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) if (ret) return ret; + /* Issue a reset of the entire MDSS */ + if (priv->mdss && priv->mdss->funcs->reset) + priv->mdss->funcs->reset(priv->mdss); + /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); if (ret) diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 2a4f0526cb98..716a34fca1cd 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -205,6 +205,7 @@ struct msm_mdss_funcs { int (*enable)(struct msm_mdss *mdss); int (*disable)(struct msm_mdss *mdss); void (*destroy)(struct msm_mdss *mdss); + int (*reset)(struct msm_mdss *mdss); }; struct msm_mdss { -- 2.33.1