Skip to contentSkip to conversation

drm: tegra: fix front_porch <-> back_porch mixup

PATCH In review Lucas Stach 2 participants 2 messages Dec 11, 2012 – Dec 12, 2012 1 message not in the archive

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

PATCH 1/1 drm: tegra: fix front_porch <-> back_porch mixup

Fixes wrong picture offset observed when using HDMI output with a Technisat HD TV.

---
Captions are a bit confusing here. As the porch is always relative to the sync pulse, the left picture margin is actually the back_porch.

---
 drivers/gpu/drm/tegra/dc.c   | 8 ++++----
 drivers/gpu/drm/tegra/hdmi.c | 6 +++---

2 Dateien geändert, 7 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)

drivers/gpu/drm/tegra/dc.c +4 -4
index 0744103..54683e4 100644
@@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,
 		((mode->hsync_end - mode->hsync_start) <<  0);
 	tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH);
 
-	value = ((mode->vsync_start - mode->vdisplay) << 16) |
-		((mode->hsync_start - mode->hdisplay) <<  0);
-	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
-
 	value = ((mode->vtotal - mode->vsync_end) << 16) |
 		((mode->htotal - mode->hsync_end) <<  0);
+	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
+
+	value = ((mode->vsync_start - mode->vdisplay) << 16) |
+		((mode->hsync_start - mode->hdisplay) <<  0);
 	tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);
 
 	value = (mode->vdisplay << 16) | mode->hdisplay;
drivers/gpu/drm/tegra/hdmi.c +3 -3
index ab40164..81ea934 100644
@@ -479,7 +479,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
 		return;
 	}
 
-	h_front_porch = mode->htotal - mode->hsync_end;
+	h_front_porch = mode->hsync_start - mode->hdisplay;
 	memset(&frame, 0, sizeof(frame));
 	frame.r = HDMI_AVI_R_SAME;
 
@@ -634,8 +634,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
 
 	pclk = mode->clock * 1000;
 	h_sync_width = mode->hsync_end - mode->hsync_start;
-	h_front_porch = mode->htotal - mode->hsync_end;
-	h_back_porch = mode->hsync_start - mode->hdisplay;
+	h_back_porch = mode->htotal - mode->hsync_end;
+	h_front_porch = mode->hsync_start - mode->hdisplay;
 
 	err = regulator_enable(hdmi->vdd);
 	if (err < 0) {
Signature · 1 line
1.7.11.7

A message that is not in the archive (sent off-list or not yet received): 1355259101-17815-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org

Acked-by Tested-by
#2 lore raw

On my Tegra 30 cardhu. Thanks, Lucas.

Mark

Quoted 58 lines · Lucas Stach

Fixes wrong picture offset observed when using HDMI output with a Technisat HD TV.

---
Captions are a bit confusing here. As the porch is always relative to the sync pulse, the left picture margin is actually the back_porch.

---
 drivers/gpu/drm/tegra/dc.c   | 8 ++++----
 drivers/gpu/drm/tegra/hdmi.c | 6 +++---

2 Dateien geändert, 7 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)

drivers/gpu/drm/tegra/dc.c +4 -4
index 0744103..54683e4 100644
@@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,
 		((mode->hsync_end - mode->hsync_start) <<  0);
 	tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH);
 
-	value = ((mode->vsync_start - mode->vdisplay) << 16) |
-		((mode->hsync_start - mode->hdisplay) <<  0);
-	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
-
 	value = ((mode->vtotal - mode->vsync_end) << 16) |
 		((mode->htotal - mode->hsync_end) <<  0);
+	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
+
+	value = ((mode->vsync_start - mode->vdisplay) << 16) |
+		((mode->hsync_start - mode->hdisplay) <<  0);
 	tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);
 
 	value = (mode->vdisplay << 16) | mode->hdisplay;
drivers/gpu/drm/tegra/hdmi.c +3 -3
index ab40164..81ea934 100644
@@ -479,7 +479,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
 		return;
 	}
 
-	h_front_porch = mode->htotal - mode->hsync_end;
+	h_front_porch = mode->hsync_start - mode->hdisplay;
 	memset(&frame, 0, sizeof(frame));
 	frame.r = HDMI_AVI_R_SAME;
 
@@ -634,8 +634,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
 
 	pclk = mode->clock * 1000;
 	h_sync_width = mode->hsync_end - mode->hsync_start;
-	h_front_porch = mode->htotal - mode->hsync_end;
-	h_back_porch = mode->hsync_start - mode->hdisplay;
+	h_back_porch = mode->htotal - mode->hsync_end;
+	h_front_porch = mode->hsync_start - mode->hdisplay;
 
 	err = regulator_enable(hdmi->vdd);
 	if (err < 0) {