Skip to contentSkip to conversation

drm: edid: add support for E-DDC

PATCH Superseded Shirish S 3 participants 4 messages Aug 29, 2012

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH v5 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 V4:
Fix review comments about space and comment indentation.

Based on drm-next branch

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

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

PATCH v5 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 |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +19 -3
index bcc4725..b9ffc30 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	= segment ? 0 : I2C_M_IGNORE_NAK,
+				.len	= 1,
+				.buf	= &segment,
+			}, {
 				.addr	= DDC_ADDR,
 				.flags	= 0,
 				.len	= 1,
@@ -276,15 +283,24 @@ 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.
+	 */
+		if (!segment)
+			ret = i2c_transfer(adapter, &msgs[1], xfers);
+		else
+			ret = i2c_transfer(adapter, msgs, 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
Quoted 11 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.

If you resend patches it'd be nice to keep a changelog of the patch itself somewhere, otherwise it's just more work to figure that out for reviewers. Also, you can usually attach reviewed-by tags (like mine) to a patch resend if you don't change the patch massively ... -Daniel

Quoted 64 lines
---
 drivers/gpu/drm/drm_edid.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +19 -4
index bcc4725..b9ffc30 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  = segment ? 0 : I2C_M_IGNORE_NAK,
+                               .len    = 1,
+                               .buf    = &segment,
+                       }, {
                                .addr   = DDC_ADDR,
                                .flags  = 0,
                                .len    = 1,
@@ -276,15 +283,24 @@ 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.
+        */
+               if (!segment)
+                       ret = i2c_transfer(adapter, &msgs[1], xfers);
+               else
+                       ret = i2c_transfer(adapter, msgs, 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

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

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
#3 lore raw

Thanks for the comments Daniel and Jean
I will upload patch set 6.
This shall include Jean's review coments. And i will tag Daniel,Jean and Ville as reviewed.

Regards,
Shirish S

Quoted 91 lines · Daniel Vetter
Quoted 11 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.

If you resend patches it'd be nice to keep a changelog of the patch itself somewhere, otherwise it's just more work to figure that out for reviewers. Also, you can usually attach reviewed-by tags (like mine) to a patch resend if you don't change the patch massively ... -Daniel

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

Quoted 9 lines
---
 drivers/gpu/drm/drm_edid.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -0
index bcc4725..b9ffc30 100644
@@ -254,6 +254,8 @@ 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,

Quoted 8 lines
drivers/gpu/drm/drm_edid.c +2 -0
                      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 drm_do_probe_ddc_edid(struct i2c_adapter *adapter,

Quoted 1 line
drivers/gpu/drm/drm_edid.c +0 -0
@@ -265,6 +267,11 @@ 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,

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +5 -0
        do {
                struct i2c_msg msgs[] = {
                        {
+                               .addr   = DDC_SEGMENT_ADDR,
+                               .flags  = segment ? 0 : I2C_M_IGNORE_NAK,
+                               .len    = 1,
+                               .buf    = &segment,
+                       }, {
                                .addr   = DDC_ADDR,
                                .flags  = 0,
                                .len    = 1,
@@ -276,15 +283,24 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,

unsigned char *buf,

Quoted 6 lines
drivers/gpu/drm/drm_edid.c +2 -1
                                .buf    = buf,
                        }
                };
-               ret = i2c_transfer(adapter, msgs, 2);
+
+       /*

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

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +8 -0
+        * Avoid sending the segment addr to not upset non-compliant ddc
+        * monitors.
+        */
+               if (!segment)
+                       ret = i2c_transfer(adapter, &msgs[1], xfers);
+               else
+                       ret = i2c_transfer(adapter, msgs, xfers);
+
                if (ret == -ENXIO) {
                        DRM_DEBUG_KMS("drm: skipping non-existent

adapter %s\n",

Quoted 14 lines
drivers/gpu/drm/drm_edid.c +2 -3
                                        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 4 lines

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

Quoted 8 lines

--
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
_______________________________________________
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