aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0068-drm-adv7511-use-smbus-to-retrieve-edid.patch
blob: 1b4dbd8a29706ac9b9fcd91c1bd0875eae626997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 2e2b673a2a47e8358ef92ec4019be87552949304 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Wed, 9 Aug 2017 11:52:22 +0300
Subject: [PATCH] drm: adv7511: use smbus to retrieve edid

Get EDID using smbus protocol instead block i2c transfer
This fixes often checksum errors while retriving EDID at 400kHz bus speed

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index d3ece87..b2e1b58 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -500,18 +500,19 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
 		 * support 64 byte transfers than 256 byte transfers
 		 */
 
+#define CHUNK_SIZE	1
 		xfer[0].addr = adv7511->i2c_edid->addr;
 		xfer[0].flags = 0;
 		xfer[0].len = 1;
 		xfer[0].buf = &offset;
 		xfer[1].addr = adv7511->i2c_edid->addr;
 		xfer[1].flags = I2C_M_RD;
-		xfer[1].len = 64;
+		xfer[1].len = CHUNK_SIZE;
 		xfer[1].buf = adv7511->edid_buf;
 
 		offset = 0;
 
-		for (i = 0; i < 4; ++i) {
+		for (i = 0; i < 256/CHUNK_SIZE; ++i) {
 			ret = i2c_transfer(adv7511->i2c_edid->adapter, xfer,
 					   ARRAY_SIZE(xfer));
 			if (ret < 0)
@@ -519,8 +520,8 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
 			else if (ret != 2)
 				return -EIO;
 
-			xfer[1].buf += 64;
-			offset += 64;
+			xfer[1].buf += CHUNK_SIZE;
+			offset += CHUNK_SIZE;
 		}
 
 		adv7511->current_edid_segment = block / 2;
-- 
1.9.1