Skip to contentSkip to conversation

gpu/drm: tegra: add DSI support for Tegra20/Tegra30

PATCH RESEND Applied Svyatoslav Ryhel 2 participants 4 messages May 11 – May 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover gpu/drm: tegra: add DSI support for Tegra20/Tegra30

Tegra20/Tegra30 DSI is quite similar to Tegra114+ apart MIPI calibration logic and clocks. With a few minor tweaks, existing tegra DSI driver should work on Tegra20/Tegra30 devices just fine. Tested on Motorola Atrix 4G (T20) and ASUS VivoTab RT TF600T (T30).

This patchset depends on Tegra20/Tegra30 CSI bringup since both share MIPI calibration logic. Ideally these patches should be picked after CSI bringup but they will not break anything even if picked before CSI patches.

---
Changes in v2:
- removed all MIPI calibration, it is handled within CSI bringup
- added per-soc structures into of_match
- added fix for hang caused by register access with uninited hw

Changes in v3:
- switched from version DSI to boolean flags
- added comment regarding Tegra30 clock configuration
- commits were picked:
"clk: tegra20: reparent dsi clock to pll_d_out0"
"ARM: tegra: adjust DSI nodes for Tegra20/Tegra30"
- commit adapted to recent DSI changes:
"gpu/drm: tegra: dsi: move prepare function at the top of encoder
enable" > "gpu/drm: tegra: dsi: re-add clear enable register if DSI was powered by bootloader"

Changes in v4:
- switched to device_get_match_data and added check
- added comment regarding Tegra124+ quirk
- adjusted commit titles and message formatting
---

Svyatoslav Ryhel (2):
drm/tegra: dsi: add support for Tegra20/Tegra30 drm/tegra: dsi: re-add clear enable register if DSI was powered by
bootloader

 drivers/gpu/drm/tegra/drm.c |   2 +
 drivers/gpu/drm/tegra/dsi.c | 126 +++++++++++++++++++++++++++---------
 drivers/gpu/drm/tegra/dsi.h |  10 +++
 3 files changed, 107 insertions(+), 31 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH RESEND v4 1/2 drm/tegra: dsi: add support for Tegra20/Tegra30

Tegra20 and Tegra30 are fully compatible with existing Tegra DSI driver apart from clock configuration and pad calibration which are addressed by this patch.

---
 drivers/gpu/drm/tegra/drm.c |   2 +
 drivers/gpu/drm/tegra/dsi.c | 117 ++++++++++++++++++++++++++----------
 drivers/gpu/drm/tegra/dsi.h |  10 +++
 3 files changed, 98 insertions(+), 31 deletions(-)
drivers/gpu/drm/tegra/drm.c +2 -0
index 1dcef4e7d104..b73d65cd0ac6 100644
@@ -1358,10 +1358,12 @@ static SIMPLE_DEV_PM_OPS(host1x_drm_pm_ops, host1x_drm_suspend,
 
 static const struct of_device_id host1x_drm_subdevs[] = {
 	{ .compatible = "nvidia,tegra20-dc", },
+	{ .compatible = "nvidia,tegra20-dsi", },
 	{ .compatible = "nvidia,tegra20-hdmi", },
 	{ .compatible = "nvidia,tegra20-gr2d", },
 	{ .compatible = "nvidia,tegra20-gr3d", },
 	{ .compatible = "nvidia,tegra30-dc", },
+	{ .compatible = "nvidia,tegra30-dsi", },
 	{ .compatible = "nvidia,tegra30-hdmi", },
 	{ .compatible = "nvidia,tegra30-gr2d", },
 	{ .compatible = "nvidia,tegra30-gr3d", },
drivers/gpu/drm/tegra/dsi.c +86 -31

177 lines not on this page · raw message

drivers/gpu/drm/tegra/dsi.h +10 -0
index f39594e65e97..d834ac0c47ab 100644
@@ -95,6 +95,16 @@
 #define DSI_TALLY_LRX(x)		(((x) & 0xff) <<  8)
 #define DSI_TALLY_HTX(x)		(((x) & 0xff) <<  0)
 #define DSI_PAD_CONTROL_0		0x4b
+/* Tegra20/Tegra30 */
+#define DSI_PAD_CONTROL_PULLDN_ENAB(x)	(((x) & 0x1) << 28)
+#define DSI_PAD_CONTROL_SLEWUPADJ(x)	(((x) & 0x7) << 24)
+#define DSI_PAD_CONTROL_SLEWDNADJ(x)	(((x) & 0x7) << 20)
+#define DSI_PAD_CONTROL_PREEMP_EN(x)	(((x) & 0x1) << 19)
+#define DSI_PAD_CONTROL_PDIO_CLK(x)	(((x) & 0x1) << 18)
+#define DSI_PAD_CONTROL_PDIO(x)		(((x) & 0x3) << 16)
+#define DSI_PAD_CONTROL_LPUPADJ(x)	(((x) & 0x3) << 14)
+#define DSI_PAD_CONTROL_LPDNADJ(x)	(((x) & 0x3) << 12)
+/* Tegra114+ */
 #define DSI_PAD_CONTROL_VS1_PDIO(x)	(((x) & 0xf) <<  0)
 #define DSI_PAD_CONTROL_VS1_PDIO_CLK	(1 <<  8)
 #define DSI_PAD_CONTROL_VS1_PULLDN(x)	(((x) & 0xf) << 16)
Signature · 1 line
2.51.0
#2 lore raw

PATCH RESEND v4 2/2 drm/tegra: dsi: re-add clear enable register if DSI was powered by bootloader

In reply to Svyatoslav Ryhel

Original commit b22fd0b9639e ("drm/tegra: dsi: Clear enable register if powered by bootloader") was added to address the issue of DSI being in an unknown state after the bootloader, ensuring correct panel configuration. This worked fairly well under the assumption that the bootloader had set up DSI; however, in cases where it did not, the device would hang because a DSI read was called before the DSI hardware was ready.

Removing this workaround results in the issue described in the original
fix: the panel initialization sequence fails and the panel gets stuck in an undefined state. This is especially noticeable with command mode panels

In order to properly address this issue, the original workaround is restored and placed after the DSI hardware is prepared for R/W operations. This fixes behavior for both cases: where DSI is set by the bootloader and where DSI is untouched.

I have tested this change on Tegra20 (Motorola Atrix 4G), Tegra114 (NVIDIA Tegra Note 7 and ASUS Transformer Pad TF701T), and Tegra124 (Xiaomi Mi Pad) with U-Boot, using both bootloader-initialized DSI and untouched DSI.

Fixes b22fd0b9639e ("drm/tegra: dsi: Clear enable register if powered by bootloader")
Fixes 660b299bed2a ("Revert "drm/tegra: dsi: Clear enable register if powered by bootloader"")
---
 drivers/gpu/drm/tegra/dsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/tegra/dsi.c +9 -0
index fbab10bc5c41..e7fdd8c7ac12 100644
@@ -936,6 +936,15 @@ static void tegra_dsi_encoder_enable(struct drm_encoder *encoder)
 		return;
 	}
 
+	/* 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);
+
 	state = tegra_dsi_get_state(dsi);
 
 	tegra_dsi_set_timeout(dsi, state->bclk, state->vrefresh);
Signature · 1 line
2.51.0
#3 lore raw
In reply to Svyatoslav Ryhel
Quoted 38 lines · Svyatoslav Ryhel

Tegra20/Tegra30 DSI is quite similar to Tegra114+ apart MIPI calibration logic and clocks. With a few minor tweaks, existing tegra DSI driver should work on Tegra20/Tegra30 devices just fine. Tested on Motorola Atrix 4G (T20) and ASUS VivoTab RT TF600T (T30).

This patchset depends on Tegra20/Tegra30 CSI bringup since both share MIPI calibration logic. Ideally these patches should be picked after CSI bringup but they will not break anything even if picked before CSI patches.

---
Changes in v2:
- removed all MIPI calibration, it is handled within CSI bringup
- added per-soc structures into of_match
- added fix for hang caused by register access with uninited hw

Changes in v3:
- switched from version DSI to boolean flags
- added comment regarding Tegra30 clock configuration
- commits were picked:
"clk: tegra20: reparent dsi clock to pll_d_out0"
"ARM: tegra: adjust DSI nodes for Tegra20/Tegra30"
- commit adapted to recent DSI changes:
"gpu/drm: tegra: dsi: move prepare function at the top of encoder
enable" > "gpu/drm: tegra: dsi: re-add clear enable register if DSI was powered by bootloader"

Changes in v4:
- switched to device_get_match_data and added check
- added comment regarding Tegra124+ quirk
- adjusted commit titles and message formatting
---

Svyatoslav Ryhel (2):
drm/tegra: dsi: add support for Tegra20/Tegra30 drm/tegra: dsi: re-add clear enable register if DSI was powered by
bootloader

Quoted 4 lines
 drivers/gpu/drm/tegra/drm.c |   2 +
 drivers/gpu/drm/tegra/dsi.c | 126 +++++++++++++++++++++++++++---------
 drivers/gpu/drm/tegra/dsi.h |  10 +++
 3 files changed, 107 insertions(+), 31 deletions(-)

Applied, thanks.

Thierry