[PATCH 2/5] drm/edid: wrap ddc read block

Jani Nikula jani.nikula at intel.com
Wed Dec 13 13:36:48 UTC 2023


Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/drm_edid.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0353e2b614c6..1d6886ee3f82 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2126,8 +2126,9 @@ static struct edid *edid_filter_invalid_blocks(struct edid *edid,
 
 #define DDC_SEGMENT_ADDR 0x30
 /**
- * ddc_read_block() - get EDID information via I2C
- * @data: I2C device adapter
+ * ddc_read_block_addr() - get EDID information via I2C
+ * @adapter: I2C device adapter
+ * @addr: I2C address
  * @buf: EDID data buffer to be filled
  * @block: 128 byte EDID block to start fetching from
  * @len: EDID data buffer length to fetch
@@ -2137,9 +2138,8 @@ static struct edid *edid_filter_invalid_blocks(struct edid *edid,
  * Return: 0 on success or -1 on failure.
  */
 static int
-ddc_read_block(void *data, u8 *buf, unsigned int block, size_t len)
+ddc_read_block(struct i2c_adapter *adapter, u16 addr, u8 *buf, unsigned int block, size_t len)
 {
-	struct i2c_adapter *adapter = data;
 	unsigned char start = block * EDID_LENGTH;
 	unsigned char segment = block >> 1;
 	unsigned char xfers = segment ? 3 : 2;
@@ -2160,12 +2160,12 @@ ddc_read_block(void *data, u8 *buf, unsigned int block, size_t len)
 				.len	= 1,
 				.buf	= &segment,
 			}, {
-				.addr	= DDC_ADDR,
+				.addr	= addr,
 				.flags	= 0,
 				.len	= 1,
 				.buf	= &start,
 			}, {
-				.addr	= DDC_ADDR,
+				.addr	= addr,
 				.flags	= I2C_M_RD,
 				.len	= len,
 				.buf	= buf,
@@ -2188,6 +2188,11 @@ ddc_read_block(void *data, u8 *buf, unsigned int block, size_t len)
 	return ret == xfers ? 0 : -1;
 }
 
+static int ddc_read_block(void *context, u8 *buf, unsigned int block, size_t len)
+{
+	return ddc_read_block_addr(context, DDC_ADDR, buf, block, len);
+}
+
 static void connector_bad_edid(struct drm_connector *connector,
 			       const struct edid *edid, int num_blocks)
 {
-- 
2.39.2



More information about the Intel-gfx-trybot mailing list