@@ -253,7 +253,9 @@ static int
drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
int block, int len)
{
- unsigned char start = block * EDID_LENGTH;
+ unsigned short start = block * EDID_LENGTH;
+ unsigned char segment = block >> 1;
+ unsigned short segFlags = segment ? 0 : I2C_M_IGNORE_NAK;
int ret, retries = 5;
/* The core i2c driver will automatically retry the transfer if the
@@ -264,27 +266,32 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
*/
do {
struct i2c_msg msgs[] = {
- {
+ { /*set segment pointer */
+ .addr = DDC_SEGMENT_ADDR,
+ .flags = segFlags,
+ .len = 1,
+ .buf = &segment,
+ }, { /*set offset */
.addr = DDC_ADDR,
.flags = 0,
.len = 1,
.buf = &start,
- }, {
+ }, { /*set data */
.addr = DDC_ADDR,
.flags = I2C_M_RD,
.len = len,
.buf = buf,
}
};
- ret = i2c_transfer(adapter, msgs, 2);
+ ret = i2c_transfer(adapter, msgs, 3);
if (ret == -ENXIO) {
DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
adapter->name);
break;
}
- } while (ret != 2 && --retries);
+ } while (ret != 3 && --retries);
- return ret == 2 ? 0 : -1;
+ return ret == 3 ? 0 : -1;
}
static bool drm_edid_is_zero(u8 *in_edid, int length)