public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] sunxi: video: Set input sync enable
Date: Sat, 20 Dec 2014 15:42:05 +0100	[thread overview]
Message-ID: <1419086525-7735-7-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1419086525-7735-1-git-send-email-hdegoede@redhat.com>

Add a write to the "unknown" (*) register to enable auto input sync, when
initially adding sunxi hdmi output support this magic write from the android
kernel code was missed, causing lcdc -> hdmi encoder sync problems.

With this write added, we can drop the modesetting retries and the extra
delays added to work around these sync problems.

*) "unknown" is the actual name of this register in the android kernel sources

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/include/asm/arch-sunxi/display.h |  1 +
 drivers/video/sunxi_display.c             | 23 ++++-------------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/display.h b/arch/arm/include/asm/arch-sunxi/display.h
index 838b217..00e3466 100644
--- a/arch/arm/include/asm/arch-sunxi/display.h
+++ b/arch/arm/include/asm/arch-sunxi/display.h
@@ -236,6 +236,7 @@ struct sunxi_hdmi_reg {
 
 #define SUNXI_HDMI_PKT_CTRL0			0x00000f21
 #define SUNXI_HDMI_PKT_CTRL1			0x0000000f
+#define SUNXI_HDMI_UNKNOWN_INPUT_SYNC		0x08000000
 
 #ifdef CONFIG_MACH_SUN6I
 #define SUNXI_HMDI_DDC_CTRL_ENABLE		(1 << 0)
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 5a14785..a0a0613 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -501,6 +501,9 @@ static void sunxi_hdmi_mode_set(const struct ctfb_res_modes *mode,
 	if (hdmi_mode)
 		sunxi_hdmi_setup_info_frames(mode);
 
+	/* Set input sync enable */
+	writel(SUNXI_HDMI_UNKNOWN_INPUT_SYNC, &hdmi->unknown);
+
 	/* Init various registers, select pll3 as clock source */
 	writel(SUNXI_HDMI_VIDEO_POL_TX_CLK, &hdmi->video_polarity);
 	writel(SUNXI_HDMI_PAD_CTRL0_RUN, &hdmi->pad_ctrl0);
@@ -556,10 +559,8 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode, char *monitor,
 	struct sunxi_hdmi_reg * const hdmi =
 		(struct sunxi_hdmi_reg *)SUNXI_HDMI_BASE;
 	int clk_div, clk_double;
-	int retries = 3;
 	bool hdmi_mode = strcmp(monitor, "hdmi") == 0;
 
-retry:
 	clrbits_le32(&hdmi->video_ctrl, SUNXI_HDMI_VIDEO_CTRL_ENABLE);
 	clrbits_le32(&lcdc->ctrl, SUNXI_LCDC_CTRL_TCON_ENABLE);
 	clrbits_le32(&de_be->mode, SUNXI_DE_BE_MODE_START);
@@ -570,27 +571,11 @@ retry:
 
 	setbits_le32(&de_be->reg_ctrl, SUNXI_DE_BE_REG_CTRL_LOAD_REGS);
 	setbits_le32(&de_be->mode, SUNXI_DE_BE_MODE_START);
-
-	udelay(1000000 / mode->refresh + 500);
-
 	setbits_le32(&lcdc->ctrl, SUNXI_LCDC_CTRL_TCON_ENABLE);
 
-	udelay(1000000 / mode->refresh + 500);
+	udelay(100);
 
 	setbits_le32(&hdmi->video_ctrl, SUNXI_HDMI_VIDEO_CTRL_ENABLE);
-
-	udelay(1000000 / mode->refresh + 500);
-
-	/*
-	 * Sometimes the display pipeline does not sync up properly, if
-	 * this happens the hdmi fifo underrun or overrun bits are set.
-	 */
-	if (readl(&hdmi->irq) &
-	    (SUNXI_HDMI_IRQ_STATUS_FIFO_UF | SUNXI_HDMI_IRQ_STATUS_FIFO_OF)) {
-		if (retries--)
-			goto retry;
-		printf("HDMI fifo under or overrun\n");
-	}
 }
 
 void *video_hw_init(void)
-- 
2.1.0

  parent reply	other threads:[~2014-12-20 14:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-20 14:41 [U-Boot] [PATCH 0/6] sunxi: video: Add hdmi output fmt support + misc fixes Hans de Goede
2014-12-20 14:42 ` [U-Boot] [PATCH 1/6] edid: Add struct and defines for cea681 extension blocks Hans de Goede
2015-01-08 16:38   ` Anatolij Gustschin
2015-01-08 16:39   ` Anatolij Gustschin
2014-12-20 14:42 ` [U-Boot] [PATCH 2/6] sunxi: video: Add hdmi support Hans de Goede
2014-12-22 12:44   ` Ian Campbell
2015-01-08 16:51   ` Anatolij Gustschin
2014-12-20 14:42 ` [U-Boot] [PATCH 3/6] sunxi: video: Add sunxi_hdmi_edid_get_block helper function Hans de Goede
2014-12-22 12:46   ` Ian Campbell
2015-01-08 16:54   ` Anatolij Gustschin
2014-12-20 14:42 ` [U-Boot] [PATCH 4/6] sunxi: video: When using edid use CEA681 extension blocks to select hdmi output Hans de Goede
2014-12-22 12:47   ` Ian Campbell
2015-01-08 16:59   ` Anatolij Gustschin
2014-12-20 14:42 ` [U-Boot] [PATCH 5/6] sunxi: video: Give hotplug-detect (hpd) signal some time to show up Hans de Goede
2014-12-22 12:48   ` Ian Campbell
2014-12-24  2:25   ` B.R. Oake
2014-12-24 16:13     ` Hans de Goede
2014-12-24 18:29       ` B.R. Oake
2014-12-28  8:40         ` Hans de Goede
2015-01-03 16:43           ` B.R. Oake
2015-01-08 17:08   ` Anatolij Gustschin
2014-12-20 14:42 ` Hans de Goede [this message]
2014-12-22 12:48   ` [U-Boot] [PATCH 6/6] sunxi: video: Set input sync enable Ian Campbell
2015-01-08 17:11   ` Anatolij Gustschin
2014-12-22 12:49 ` [U-Boot] [PATCH 0/6] sunxi: video: Add hdmi output fmt support + misc fixes Ian Campbell

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=1419086525-7735-7-git-send-email-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /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