From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Loic Poulain <loic.poulain@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
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 [thread overview]
Message-ID: <20220302012931.4107196-2-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20220302012931.4107196-1-bjorn.andersson@linaro.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 <bjorn.andersson@linaro.org>
---
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 <linux/irqchip.h>
#include <linux/irqdesc.h>
#include <linux/irqchip/chained_irq.h>
+#include <linux/reset.h>
#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
next prev parent reply other threads:[~2022-03-02 1:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 1:29 [PATCH v2 1/2] dt-bindings: display: msm: Add optional resets Bjorn Andersson
2022-03-02 1:29 ` Bjorn Andersson [this message]
2022-03-02 1:47 ` [PATCH v2 2/2] drm/msm/dpu: Issue MDSS reset during initialization Dmitry Baryshkov
2022-03-02 2:44 ` Bjorn Andersson
2022-03-02 4:42 ` Dmitry Baryshkov
2022-03-02 18:02 ` [PATCH v2 1/2] dt-bindings: display: msm: Add optional resets Rob Herring
-- strict thread matches above, loose matches on Subject: below --
2022-04-08 21:02 Bjorn Andersson
2022-04-08 21:02 ` [PATCH v2 2/2] drm/msm/dpu: Issue MDSS reset during initialization Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220302012931.4107196-2-bjorn.andersson@linaro.org \
--to=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox