All of lore.kernel.org
 help / color / mirror / Atom feed
From: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
To: unlisted-recipients:; (no To-header on input)
Cc: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>,
	thierry.reding@gmail.com, sam@ravnborg.org, airlied@linux.ie,
	daniel@ffwll.ch, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, jonathanh@nvidia.com,
	arnd@arndb.de, dri-devel@lists.freedesktop.org,
	devicetree@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCH v2 2/4] drm/tegra: dsi: Clear enable register if powered by bootloader
Date: Tue, 25 Oct 2022 16:37:47 +0100	[thread overview]
Message-ID: <20221025153746.101278-3-diogo.ivo@tecnico.ulisboa.pt> (raw)
In-Reply-To: <20221025153746.101278-1-diogo.ivo@tecnico.ulisboa.pt>

In cases where the DSI module is left on by the bootloader
some panels may fail to initialize if the enable register is not cleared
before the panel's initialization sequence is sent, so clear it if that
is the case. 

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
Changes in v2:
 - detect if the DSI module is on based on the register value,
   instead of a DT property.
 - remove Display Controller clear, since it is redundant.

 drivers/gpu/drm/tegra/dsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index de1333dc0d86..5954676a7ab1 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -912,6 +912,15 @@ static void tegra_dsi_encoder_enable(struct drm_encoder *encoder)
 	u32 value;
 	int err;
 
+	/* If the bootloader enabled DSI it needs to be disabled
+	 * in order for the panel initialization commands to be
+	 * properly sent.
+	 */
+	value = tegra_dsi_readl(dsi, DSI_POWER_CONTROL);
+
+	if (value & DSI_POWER_CONTROL_ENABLE)
+		tegra_dsi_disable(dsi);
+
 	err = tegra_dsi_prepare(dsi);
 	if (err < 0) {
 		dev_err(dsi->dev, "failed to prepare: %d\n", err);
-- 
2.38.1


WARNING: multiple messages have this Message-ID (diff)
From: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Cc: devicetree@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org,
	arnd@arndb.de, airlied@linux.ie, dri-devel@lists.freedesktop.org,
	jonathanh@nvidia.com, Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>,
	robh+dt@kernel.org, thierry.reding@gmail.com,
	linux-tegra@vger.kernel.org, sam@ravnborg.org
Subject: [PATCH v2 2/4] drm/tegra: dsi: Clear enable register if powered by bootloader
Date: Tue, 25 Oct 2022 16:37:47 +0100	[thread overview]
Message-ID: <20221025153746.101278-3-diogo.ivo@tecnico.ulisboa.pt> (raw)
In-Reply-To: <20221025153746.101278-1-diogo.ivo@tecnico.ulisboa.pt>

In cases where the DSI module is left on by the bootloader
some panels may fail to initialize if the enable register is not cleared
before the panel's initialization sequence is sent, so clear it if that
is the case. 

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
Changes in v2:
 - detect if the DSI module is on based on the register value,
   instead of a DT property.
 - remove Display Controller clear, since it is redundant.

 drivers/gpu/drm/tegra/dsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index de1333dc0d86..5954676a7ab1 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -912,6 +912,15 @@ static void tegra_dsi_encoder_enable(struct drm_encoder *encoder)
 	u32 value;
 	int err;
 
+	/* If the bootloader enabled DSI it needs to be disabled
+	 * in order for the panel initialization commands to be
+	 * properly sent.
+	 */
+	value = tegra_dsi_readl(dsi, DSI_POWER_CONTROL);
+
+	if (value & DSI_POWER_CONTROL_ENABLE)
+		tegra_dsi_disable(dsi);
+
 	err = tegra_dsi_prepare(dsi);
 	if (err < 0) {
 		dev_err(dsi->dev, "failed to prepare: %d\n", err);
-- 
2.38.1


  parent reply	other threads:[~2022-10-25 15:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 15:37 [PATCH v2 0/4] Add JDI LPM102A188A display panel support Diogo Ivo
2022-10-25 15:37 ` Diogo Ivo
2022-10-25 15:37 ` [PATCH v2 1/4] dt-bindings: display: Add bindings for JDI LPM102A188A Diogo Ivo
2022-10-25 15:37   ` Diogo Ivo
2022-10-26 14:57   ` Krzysztof Kozlowski
2022-10-26 14:57     ` Krzysztof Kozlowski
2022-10-25 15:37 ` Diogo Ivo [this message]
2022-10-25 15:37   ` [PATCH v2 2/4] drm/tegra: dsi: Clear enable register if powered by bootloader Diogo Ivo
2022-10-25 15:37 ` [PATCH v2 3/4] drm/panel: Add driver for JDI LPM102A188A Diogo Ivo
2022-10-25 15:37   ` Diogo Ivo
2022-12-23 15:33   ` [v2,3/4] " Rayyan Ansari
2022-12-23 15:33     ` Rayyan Ansari
2022-12-27 11:58     ` Diogo Ivo
2022-12-27 11:58       ` Diogo Ivo
2022-10-25 15:37 ` [PATCH v2 4/4] arm64: dts: smaug: Add display panel node Diogo Ivo
2022-10-25 15:37   ` Diogo Ivo
2023-01-09 15:09 ` [PATCH v2 0/4] Add JDI LPM102A188A display panel support Diogo Ivo

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=20221025153746.101278-3-diogo.ivo@tecnico.ulisboa.pt \
    --to=diogo.ivo@tecnico.ulisboa.pt \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.