From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-fbdev@vger.kernel.org
Subject: [PATCH] fbdev: extend fb_do_probe_ddc_edid() to read two EDID blocks,
Date: Thu, 28 Oct 2010 13:36:05 +0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1010281534510.1257@axis700.grange> (raw)
A simple extension of the fb_do_probe_ddc_edid() function allows reading of up
to two EDID blocks without changing the API. Two EDID blocks is also the usual
case for HDMI devices.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/video/fb_ddc.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
index 4a874c8..958035a 100644
--- a/drivers/video/fb_ddc.c
+++ b/drivers/video/fb_ddc.c
@@ -21,7 +21,7 @@
static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter)
{
unsigned char start = 0x0;
- unsigned char *buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
+ unsigned char *buf = kmalloc(2 * EDID_LENGTH, GFP_KERNEL);
struct i2c_msg msgs[] = {
{
.addr = DDC_ADDR,
@@ -42,12 +42,21 @@ static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter)
return NULL;
}
- if (i2c_transfer(adapter, msgs, 2) = 2)
- return buf;
+ if (i2c_transfer(adapter, msgs, 2) != 2) {
+ dev_warn(&adapter->dev, "unable to read EDID block.\n");
+ kfree(buf);
+ return NULL;
+ }
+
+ if (buf[126]) {
+ start = 0x80;
+ msgs[1].buf += EDID_LENGTH;
+ if (i2c_transfer(adapter, msgs, 2) != 2)
+ /* Indicate failed E-EDID */
+ buf[128] = 0xff;
+ }
- dev_warn(&adapter->dev, "unable to read EDID block.\n");
- kfree(buf);
- return NULL;
+ return buf;
}
unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
--
1.7.1
reply other threads:[~2010-10-28 13:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.64.1010281534510.1257@axis700.grange \
--to=g.liakhovetski@gmx.de \
--cc=linux-fbdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).