All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jernej Skrabec <jernej.skrabec@siol.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] edid: Set timings flags according to edid
Date: Sat, 29 Apr 2017 14:43:35 +0200	[thread overview]
Message-ID: <20170429124337.16291-2-jernej.skrabec@siol.net> (raw)
In-Reply-To: <20170429124337.16291-1-jernej.skrabec@siol.net>

Timing flags are never set, so they may contain garbage. Since some
drivers check them, video output may be broken on those drivers.

Initialize them to 0 and check for few common flags.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
---

 common/edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common/edid.c b/common/edid.c
index e08e420920..ab7069fdcd 100644
--- a/common/edid.c
+++ b/common/edid.c
@@ -85,6 +85,7 @@ static void decode_timing(u8 *buf, struct display_timing *timing)
 	uint x_mm, y_mm;
 	unsigned int ha, hbl, hso, hspw, hborder;
 	unsigned int va, vbl, vso, vspw, vborder;
+	struct edid_detailed_timing *t = (struct edid_detailed_timing *)buf;
 
 	/* Edid contains pixel clock in terms of 10KHz */
 	set_entry(&timing->pixelclock, (buf[0] + (buf[1] << 8)) * 10000);
@@ -111,6 +112,19 @@ static void decode_timing(u8 *buf, struct display_timing *timing)
 	set_entry(&timing->vback_porch, vbl - vso - vspw);
 	set_entry(&timing->vsync_len, vspw);
 
+	timing->flags = 0;
+	if (EDID_DETAILED_TIMING_FLAG_HSYNC_POLARITY(*t))
+		timing->flags |= DISPLAY_FLAGS_HSYNC_HIGH;
+	else
+		timing->flags |= DISPLAY_FLAGS_HSYNC_LOW;
+	if (EDID_DETAILED_TIMING_FLAG_VSYNC_POLARITY(*t))
+		timing->flags |= DISPLAY_FLAGS_VSYNC_HIGH;
+	else
+		timing->flags |= DISPLAY_FLAGS_VSYNC_LOW;
+
+	if (EDID_DETAILED_TIMING_FLAG_INTERLACED(*t))
+		timing->flags = DISPLAY_FLAGS_INTERLACED;
+
 	debug("Detailed mode clock %u Hz, %d mm x %d mm\n"
 	      "               %04x %04x %04x %04x hborder %x\n"
 	      "               %04x %04x %04x %04x vborder %x\n",
-- 
2.12.2

  reply	other threads:[~2017-04-29 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-29 12:43 [U-Boot] [PATCH 0/3] video: Fix issues with edid parsing Jernej Skrabec
2017-04-29 12:43 ` Jernej Skrabec [this message]
2017-04-30  3:49   ` [U-Boot] [PATCH 1/3] edid: Set timings flags according to edid Simon Glass
2017-05-15 18:31   ` Anatolij Gustschin
2017-04-29 12:43 ` [U-Boot] [PATCH 2/3] edid: Add HDMI flag to timing info Jernej Skrabec
2017-04-30  3:49   ` Simon Glass
2017-05-15 18:37   ` Anatolij Gustschin
2017-04-29 12:43 ` [U-Boot] [PATCH 3/3] video: dw_hdmi: Select HDMI mode only if monitor supports it Jernej Skrabec
2017-04-30  3:49   ` Simon Glass
2017-05-15 18:41   ` Anatolij Gustschin

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=20170429124337.16291-2-jernej.skrabec@siol.net \
    --to=jernej.skrabec@siol.net \
    --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 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.