Skip to contentSkip to conversation

drm: edid: add support for E-DDC

PATCH Superseded Shirish S 6 participants 14 messages Aug 30, 2012 – Sep 13, 2012

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH v6 1/1 drm: edid: add support for E-DDC

This patch adds support in probing 4 block edid data, for E-DDC. This is the first test case in CTS, for HDMI compliance.

Changes from V1:
1. Data type of offset adress updated to unsigned short
2. Updated the buf feild of msg[0]

Changes from V2:
Add switch for DDC and E-DDC

Changes from V3:
Remove switch,and avoid sending of segment data for non E-DDC

Changes from V4:
Fix review comments about space and comment indentation.

Changes from V5:
Compacted the code.

Based on drm-next branch

Shirish S (1):
drm: edid: add support for E-DDC

 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
author
#1 lore raw

PATCH v6 1/1 drm: edid: add support for E-DDC

The current logic for probing ddc is limited to 2 blocks (256 bytes), this patch adds support for the 4 block (512) data.

To do this, a single 8-bit segment index is passed to the display via the I2C address 30h. Data from the selected segment is then immediately read via the regular DDC2 address using a repeated I2C 'START' signal.

---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +16 -3
index bcc4725..7f62de5 100644
@@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 		      int block, int len)
 {
 	unsigned char start = block * EDID_LENGTH;
+	unsigned char segment = block >> 1;
+	unsigned char xfers = segment ? 3 : 2;
 	int ret, retries = 5;
 
 	/* The core i2c driver will automatically retry the transfer if the
@@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 	do {
 		struct i2c_msg msgs[] = {
 			{
+				.addr	= DDC_SEGMENT_ADDR,
+				.flags	= 0,
+				.len	= 1,
+				.buf	= &segment,
+			}, {
 				.addr	= DDC_ADDR,
 				.flags	= 0,
 				.len	= 1,
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 				.buf	= buf,
 			}
 		};
-		ret = i2c_transfer(adapter, msgs, 2);
+
+	/*
+	 * Avoid sending the segment addr to not upset non-compliant ddc
+	 * monitors.
+	 */
+		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
 		if (ret == -ENXIO) {
 			DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
 					adapter->name);
 			break;
 		}
-	} while (ret != 2 && --retries);
+	} while (ret != xfers && --retries);
 
-	return ret == 2 ? 0 : -1;
+	return ret == xfers ? 0 : -1;
 }
 
 static bool drm_edid_is_zero(u8 *in_edid, int length)
Signature · 1 line
1.7.0.4
#2 lore raw

drivers/gpu/drm/drm_edid.c drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, · line 290

Quoted 10 lines · Shirish S
drivers/gpu/drm/drm_edid.c +5 -1
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 				.buf	= buf,
 			}
 		};
-		ret = i2c_transfer(adapter, msgs, 2);
+
+	/*
+	 * Avoid sending the segment addr to not upset non-compliant ddc
+	 * monitors.
+	 */

Indentation is still wrong. Or is it gettimg mangled by some email server?

Quoted 15 lines
drivers/gpu/drm/drm_edid.c +4 -2
+		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
 		if (ret == -ENXIO) {
 			DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
 					adapter->name);
 			break;
 		}
-	} while (ret != 2 && --retries);
+	} while (ret != xfers && --retries);
 
-	return ret == 2 ? 0 : -1;
+	return ret == xfers ? 0 : -1;
 }
 
 static bool drm_edid_is_zero(u8 *in_edid, int length)
Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw
Quoted 13 lines · Ville Syrjälä

Review drm_do_probe_ddc_edid(struct i2c_adapter *adapter,

Quoted 1 line · Shirish S
(quoted diff) +0 -0
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,

unsigned char *buf,

drivers/gpu/drm/drm_edid.c drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, · line 290

Quoted 9 lines
drivers/gpu/drm/drm_edid.c +5 -1
                              .buf    = buf,
                      }
              };
-             ret = i2c_transfer(adapter, msgs, 2);
+
+     /*
+      * Avoid sending the segment addr to not upset non-compliant ddc
+      * monitors.
+      */
Quoted 3 lines

Indentation is still wrong. Or is it gettimg mangled by some email server?

I have double checked with checkpatch, i did not get any errors or

warnings,
looks like as you are saying may be true.
Requesting for merge!

Quoted 17 lines

drivers/gpu/drm/drm_edid.c drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,

Quoted 4 lines
drivers/gpu/drm/drm_edid.c +2 -0
+             ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
              if (ret == -ENXIO) {
                      DRM_DEBUG_KMS("drm: skipping non-existent adapter

%s\n",

drivers/gpu/drm/drm_edid.c drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, · line 303

Quoted 11 lines
drivers/gpu/drm/drm_edid.c +2 -2
                                      adapter->name);
                      break;
              }
-     } while (ret != 2 && --retries);
+     } while (ret != xfers && --retries);
 
-     return ret == 2 ? 0 : -1;
+     return ret == xfers ? 0 : -1;
 }
 
 static bool drm_edid_is_zero(u8 *in_edid, int length)
Quoted 8 lines

--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to Shirish S

Hello Dave,

My patch-set for adding support for 4 block EDID is now reviewed and ready. Please let me know if you want any further clarification

Regards,
Shirish S

Quoted 71 lines · Shirish S

The current logic for probing ddc is limited to 2 blocks (256 bytes), this patch adds support for the 4 block (512) data.

To do this, a single 8-bit segment index is passed to the display via the I2C address 30h. Data from the selected segment is then immediately read via the regular DDC2 address using a repeated I2C 'START' signal.

---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -0
index bcc4725..7f62de5 100644
@@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                      int block, int len)
 {
        unsigned char start = block * EDID_LENGTH;
+       unsigned char segment = block >> 1;
+       unsigned char xfers = segment ? 3 : 2;
        int ret, retries = 5;
 
        /* The core i2c driver will automatically retry the transfer if the
drivers/gpu/drm/drm_edid.c +5 -0
@@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
        do {
                struct i2c_msg msgs[] = {
                        {
+                               .addr   = DDC_SEGMENT_ADDR,
+                               .flags  = 0,
+                               .len    = 1,
+                               .buf    = &segment,
+                       }, {
                                .addr   = DDC_ADDR,
                                .flags  = 0,
                                .len    = 1,
drivers/gpu/drm/drm_edid.c +9 -3
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                                .buf    = buf,
                        }
                };
-               ret = i2c_transfer(adapter, msgs, 2);
+
+       /*
+        * Avoid sending the segment addr to not upset non-compliant ddc
+        * monitors.
+        */
+               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
                if (ret == -ENXIO) {
                        DRM_DEBUG_KMS("drm: skipping non-existent adapter
 %s\n",
                                        adapter->name);
                        break;
                }
-       } while (ret != 2 && --retries);
+       } while (ret != xfers && --retries);
 
-       return ret == 2 ? 0 : -1;
+       return ret == xfers ? 0 : -1;
 }
Quoted 9 lines

static bool drm_edid_is_zero(u8 *in_edid, int length)
--
1.7.0.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 4 lines · Shirish S

Hello Dave,

My patch-set for adding support for 4 block EDID is now reviewed and ready. Please let me know if you want any further clarification

I assume you have actual displays with that many EDID extensions. Can you send a sample of the complete EDID block from one such display? I'd be interested to know what extensions are present.

- ajax

#6 lore raw
In reply to Shirish S

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Quoted 87 lines · Shirish S

Hello Dave,

My patch-set for adding support for 4 block EDID is now reviewed and ready. Please let me know if you want any further clarification

Regards,
Shirish S

Quoted 76 lines · Shirish S

The current logic for probing ddc is limited to 2 blocks (256 bytes), this patch adds support for the 4 block (512) data.

To do this, a single 8-bit segment index is passed to the display via the I2C address 30h. Data from the selected segment is then immediately read via the regular DDC2 address using a repeated I2C 'START' signal.

---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -0
index bcc4725..7f62de5 100644
@@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                      int block, int len)
 {
        unsigned char start = block * EDID_LENGTH;
+       unsigned char segment = block >> 1;
+       unsigned char xfers = segment ? 3 : 2;
        int ret, retries = 5;
 
        /* The core i2c driver will automatically retry the transfer if

the

drivers/gpu/drm/drm_edid.c +5 -0
@@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
        do {
                struct i2c_msg msgs[] = {
                        {
+                               .addr   = DDC_SEGMENT_ADDR,
+                               .flags  = 0,
+                               .len    = 1,
+                               .buf    = &segment,
+                       }, {
                                .addr   = DDC_ADDR,
                                .flags  = 0,
                                .len    = 1,
drivers/gpu/drm/drm_edid.c +9 -3
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                                .buf    = buf,
                        }
                };
-               ret = i2c_transfer(adapter, msgs, 2);
+
+       /*
+        * Avoid sending the segment addr to not upset non-compliant ddc
+        * monitors.
+        */
+               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
                if (ret == -ENXIO) {
                        DRM_DEBUG_KMS("drm: skipping non-existent adapter
 %s\n",
                                        adapter->name);
                        break;
                }
-       } while (ret != 2 && --retries);
+       } while (ret != xfers && --retries);
 
-       return ret == 2 ? 0 : -1;
+       return ret == xfers ? 0 : -1;
 }

static bool drm_edid_is_zero(u8 *in_edid, int length)
--
1.7.0.4

Quoted 7 lines
Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#7 lore raw
Quoted 6 lines · Shirish S

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Can you provide ajax with the sample he asked for previously?

Dave.

#8 lore raw

I have already sent him the sample he had asked for. Regards,
Shirish S

Quoted 8 lines · Dave Airlie
Quoted 6 lines · Shirish S

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Quoted 4 lines

Can you provide ajax with the sample he asked for previously?

Dave.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Dear Shirish,

thank you for your answers and patience.

Please just sent plain text message to mailings lists and adhere to the netiquette (inline quoting) [1]. That would be awesome.

Am Samstag, den 08.09.2012, 08:49 -0700 schrieb Shirish S:

Quoted 10 lines · Dave Airlie
Quoted 9 lines · Shirish S
Quoted 6 lines

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Quoted 3 lines
Quoted 1 line

Can you provide ajax with the sample he asked for previously?

I have already sent him the sample he had asked for.

Could you sent it to the list again as we are all interested in it? If you are allowed that is of course.

Thanks and hopefully your patch will go in soon,

Paul

[1] http://en.opensuse.org/openSUSE:Mailing_list_netiquette

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
Quoted 23 lines · Paul Menzel

Dear Shirish,

thank you for your answers and patience.

Please just sent plain text message to mailings lists and adhere to the netiquette (inline quoting) [1]. That would be awesome.

Have been replying inline, anyways,thanks for the correction.

Am Samstag, den 08.09.2012, 08:49 -0700 schrieb Shirish S:

Quoted 3 lines · Dave Airlie
Quoted 2 lines

On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines
Quoted 6 lines

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Can you provide ajax with the sample he asked for previously?

I have already sent him the sample he had asked for.

Could you sent it to the list again as we are all interested in it? If you are allowed that is of course.

am not sure if i can mail it to list, but you can get it from

http://www.quantumdata.com/index.asp
by mailing their technical support.

Quoted 8 lines

Thanks and hopefully your patch will go in soon,

Paul

[1] http://en.opensuse.org/openSUSE:Mailing_list_netiquette

Regards,
Shirish S

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw
In reply to Dave Airlie
Quoted 9 lines · Dave Airlie
Quoted 6 lines · Shirish S

Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI Compliance test suite.
Regards,
Shirish S

Can you provide ajax with the sample he asked for previously?

He did, it even looks like I expected it to look: a (correct) block map and two CEA extension blocks. Which I think means there are now ways two successive CEA blocks could disagree with each other, so that's probably something to audit, but I don't expect that to be common.

- ajax

#12 lore raw
In reply to Shirish S

Gentle Reminder!

Quoted 87 lines · Shirish S

Hello Dave,

My patch-set for adding support for 4 block EDID is now reviewed and ready. Please let me know if you want any further clarification

Regards,
Shirish S

Quoted 76 lines · Shirish S

The current logic for probing ddc is limited to 2 blocks (256 bytes), this patch adds support for the 4 block (512) data.

To do this, a single 8-bit segment index is passed to the display via the I2C address 30h. Data from the selected segment is then immediately read via the regular DDC2 address using a repeated I2C 'START' signal.

---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +2 -0
index bcc4725..7f62de5 100644
@@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                      int block, int len)
 {
        unsigned char start = block * EDID_LENGTH;
+       unsigned char segment = block >> 1;
+       unsigned char xfers = segment ? 3 : 2;
        int ret, retries = 5;
 
        /* The core i2c driver will automatically retry the transfer if

the

drivers/gpu/drm/drm_edid.c +5 -0
@@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
        do {
                struct i2c_msg msgs[] = {
                        {
+                               .addr   = DDC_SEGMENT_ADDR,
+                               .flags  = 0,
+                               .len    = 1,
+                               .buf    = &segment,
+                       }, {
                                .addr   = DDC_ADDR,
                                .flags  = 0,
                                .len    = 1,
drivers/gpu/drm/drm_edid.c +9 -3
@@ -276,15 +283,21 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
 unsigned char *buf,
                                .buf    = buf,
                        }
                };
-               ret = i2c_transfer(adapter, msgs, 2);
+
+       /*
+        * Avoid sending the segment addr to not upset non-compliant ddc
+        * monitors.
+        */
+               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
                if (ret == -ENXIO) {
                        DRM_DEBUG_KMS("drm: skipping non-existent adapter
 %s\n",
                                        adapter->name);
                        break;
                }
-       } while (ret != 2 && --retries);
+       } while (ret != xfers && --retries);
 
-       return ret == 2 ? 0 : -1;
+       return ret == xfers ? 0 : -1;
 }

static bool drm_edid_is_zero(u8 *in_edid, int length)
--
1.7.0.4

Quoted 7 lines
Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#13 lore raw
Quoted 1 line · Shirish S

Gentle Reminder!

you are a day late,

I pushed it into drm-next yesterday :-)

Dave.