public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: reimth@googlemail.com
To: Dave Airlie <airlied@redhat.com>,
	Alex Deucher <alexdeucher@gmail.com>,
	Mario Kleiner <mario.kleiner@tuebingen.mpg.de>,
	Jean Delvare <khali@linux-fr.org>,
	Tyson Whitehead <twhitehead@gmail.com>,
	Jason Wessel <jason.wessel@windriver.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	stable@kernel.org, Thomas Reim <rdratlos@yahoo.co.uk>
Subject: [PATCH 1/3] drm: Separate EDID Header Check from EDID Block Check
Date: Thu,  7 Jul 2011 01:30:12 +0200	[thread overview]
Message-ID: <1309995012-5873-4-git-send-email-reimth@gmail.com> (raw)
In-Reply-To: <1309995012-5873-1-git-send-email-reimth@gmail.com>
In-Reply-To: <CADnq5_M5NAd2PVbS0FPB_VSmg8+41HUsDL1TcbKK94GK6MF_jA@mail.gmail.com>

From: Thomas Reim <rdratlos@yahoo.co.uk>

    Provides function drm_edid_header_is_valid() for EDID header check
    and replaces EDID header check part of function drm_edid_block_valid()
    by a call of drm_edid_header_is_valid().
    This is a prerequisite to extend DDC probing, e. g. in function
    radeon_ddc_probe() for Radeon devices, by a central EDID header check.

    Tested for kernel 2.35, 2.38 and 3.0

Signed-off-by: Thomas Reim <rdratlos@yahoo.co.uk>
---
 drivers/gpu/drm/drm_edid.c |   24 ++++++++++++++++++------
 include/drm/drm_crtc.h     |    1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0929219..1bbb85b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -127,6 +127,23 @@ static const u8 edid_header[] = {
 	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 };
 
+ /*
+ * Sanity check the header of the base EDID block.  Return 8 if the header
+ * is perfect, down to 0 if it's totally wrong.
+ */
+int drm_edid_header_is_valid(const u8 *raw_edid)
+{
+	int i, score = 0;
+
+	for (i = 0; i < sizeof(edid_header); i++)
+		if (raw_edid[i] == edid_header[i])
+			score++;
+
+	return score;
+}
+EXPORT_SYMBOL(drm_edid_header_is_valid);
+
+
 /*
  * Sanity check the EDID block (base or extension).  Return 0 if the block
  * doesn't check out, or 1 if it's valid.
@@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
 	struct edid *edid = (struct edid *)raw_edid;
 
 	if (raw_edid[0] == 0x00) {
-		int score = 0;
-
-		for (i = 0; i < sizeof(edid_header); i++)
-			if (raw_edid[i] == edid_header[i])
-				score++;
-
+		int score = drm_edid_header_is_valid(raw_edid);
 		if (score == 8) ;
 		else if (score >= 6) {
 			DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 33d12f8..0ec3687 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -802,6 +802,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
 extern int drm_add_modes_noedid(struct drm_connector *connector,
 				int hdisplay, int vdisplay);
 
+extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_is_valid(struct edid *edid);
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
 					   int hsize, int vsize, int fresh);
-- 
1.7.1


  parent reply	other threads:[~2011-07-06 23:30 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 15:31 [PATCH 1/1] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem Thomas Reim
2011-06-21 15:37 ` Alex Deucher
2011-06-21 18:03   ` Thomas Reim
2011-06-21 19:27 ` Jean Delvare
2011-06-22  1:11   ` Thomas Reim
2011-06-22 13:53     ` Jean Delvare
2011-06-22  1:20 ` reimth
2011-06-22  1:28   ` Alex Deucher
2011-06-22 15:17     ` Thomas Reim
2011-06-22 15:41       ` Alex Deucher
2011-06-22 15:45       ` Alex Deucher
2011-06-23 21:57         ` Thomas Reim
2011-06-23 22:05   ` [PATCH] " reimth
2011-06-23 22:55     ` Alex Deucher
2011-06-24  4:02       ` Thomas Reim
2011-06-24 13:36         ` Alex Deucher
2011-06-27 12:14           ` Jean Delvare
2011-07-06  9:35           ` Thomas Reim
2011-07-06 10:09     ` reimth
2011-07-06 12:26       ` Thomas Reim
2011-07-06 15:39       ` Alex Deucher
2011-07-06 15:42         ` Alex Deucher
2011-07-06 23:30         ` [PATCH 0/3] " reimth
2011-07-20  8:34           ` [PATCH] drm/radeon: Fix ECS A740GM-M DVI-D " reimth
2011-07-20 22:18             ` Thomas Reim
2011-07-26 13:05             ` Alex Deucher
2011-07-06 23:30         ` [PATCH 3/3] drm/radeon: Log Subsystem Vendor and Device Information reimth
2011-07-07 13:56           ` Alex Deucher
2011-07-06 23:30         ` [PATCH 2/3] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem reimth
2011-07-07 14:01           ` Alex Deucher
2011-07-26 13:20             ` Dave Airlie
2011-07-26 14:52               ` Alex Deucher
2011-07-26 14:55                 ` Alex Deucher
2011-07-06 23:30         ` reimth [this message]
2011-07-06 23:56           ` [stable] [PATCH 1/3] drm: Separate EDID Header Check from EDID Block Check Greg KH
2011-07-07 13:57           ` Alex Deucher

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=1309995012-5873-4-git-send-email-reimth@gmail.com \
    --to=reimth@googlemail.com \
    --cc=airlied@redhat.com \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason.wessel@windriver.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.kleiner@tuebingen.mpg.de \
    --cc=rdratlos@yahoo.co.uk \
    --cc=stable@kernel.org \
    --cc=twhitehead@gmail.com \
    /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