* [PATCH] fbdev: extend fb_do_probe_ddc_edid() to read two EDID blocks,
@ 2010-10-28 13:36 Guennadi Liakhovetski
0 siblings, 0 replies; only message in thread
From: Guennadi Liakhovetski @ 2010-10-28 13:36 UTC (permalink / raw)
To: linux-fbdev
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-28 13:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 13:36 [PATCH] fbdev: extend fb_do_probe_ddc_edid() to read two EDID blocks, Guennadi Liakhovetski
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).