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 3/6] sunxi: video: Add sunxi_hdmi_edid_get_block helper function
Date: Sat, 20 Dec 2014 15:42:02 +0100	[thread overview]
Message-ID: <1419086525-7735-4-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1419086525-7735-1-git-send-email-hdegoede@redhat.com>

Add a sunxi_hdmi_edid_get_block helper function, this is a preparation patch
for adding support for parsing EDID extension blocks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/video/sunxi_display.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 394153a..3048410 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -137,6 +137,24 @@ static int sunxi_hdmi_ddc_read(int offset, u8 *buf, int count)
 	return 0;
 }
 
+static int sunxi_hdmi_edid_get_block(int block, u8 *buf)
+{
+	int r, retries = 2;
+
+	do {
+		r = sunxi_hdmi_ddc_read(block * 128, buf, 128);
+		if (r)
+			continue;
+		r = edid_check_checksum(buf);
+		if (r) {
+			printf("EDID block %d: checksum error%s\n",
+			       block, retries ? ", retrying" : "");
+		}
+	} while (r && retries--);
+
+	return r;
+}
+
 static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode)
 {
 	struct edid1_info edid1;
@@ -146,7 +164,7 @@ static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode)
 		(struct sunxi_hdmi_reg *)SUNXI_HDMI_BASE;
 	struct sunxi_ccm_reg * const ccm =
 		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
-	int i, r, retries = 2;
+	int i, r;
 
 	/* SUNXI_HDMI_CTRL_ENABLE & PAD_CTRL0 are already set by hpd_detect */
 	writel(SUNXI_HDMI_PAD_CTRL1 | SUNXI_HDMI_PAD_CTRL1_HALVE,
@@ -170,16 +188,7 @@ static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode)
 	       SUNXI_HMDI_DDC_LINE_CTRL_SCL_ENABLE, &hdmi->ddc_line_ctrl);
 #endif
 
-	do {
-		r = sunxi_hdmi_ddc_read(0, (u8 *)&edid1, 128);
-		if (r)
-			continue;
-		r = edid_check_checksum((u8 *)&edid1);
-		if (r) {
-			printf("EDID: checksum error%s\n",
-			       retries ? ", retrying" : "");
-		}
-	} while (r && retries--);
+	r = sunxi_hdmi_edid_get_block(0, (u8 *)&edid1);
 
 	/* Disable DDC engine, no longer needed */
 	clrbits_le32(&hdmi->ddc_ctrl, SUNXI_HMDI_DDC_CTRL_ENABLE);
-- 
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 ` Hans de Goede [this message]
2014-12-22 12:46   ` [U-Boot] [PATCH 3/6] sunxi: video: Add sunxi_hdmi_edid_get_block helper function 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 ` [U-Boot] [PATCH 6/6] sunxi: video: Set input sync enable Hans de Goede
2014-12-22 12:48   ` 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-4-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