@@ -522,9 +522,6 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
522522 size_t len )
523523{
524524 struct adv7511 * adv7511 = data ;
525- struct i2c_msg xfer [2 ];
526- uint8_t offset ;
527- unsigned int i ;
528525 int ret ;
529526
530527 if (len > 128 )
@@ -547,32 +544,8 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
547544 return ret ;
548545 }
549546
550- /* Break this apart, hopefully more I2C controllers will
551- * support 64 byte transfers than 256 byte transfers
552- */
553-
554- xfer [0 ].addr = adv7511 -> i2c_edid -> addr ;
555- xfer [0 ].flags = 0 ;
556- xfer [0 ].len = 1 ;
557- xfer [0 ].buf = & offset ;
558- xfer [1 ].addr = adv7511 -> i2c_edid -> addr ;
559- xfer [1 ].flags = I2C_M_RD ;
560- xfer [1 ].len = 64 ;
561- xfer [1 ].buf = adv7511 -> edid_buf ;
562-
563- offset = 0 ;
564-
565- for (i = 0 ; i < 4 ; ++ i ) {
566- ret = i2c_transfer (adv7511 -> i2c_edid -> adapter , xfer ,
567- ARRAY_SIZE (xfer ));
568- if (ret < 0 )
569- return ret ;
570- else if (ret != 2 )
571- return - EIO ;
572-
573- xfer [1 ].buf += 64 ;
574- offset += 64 ;
575- }
547+ ret = regmap_bulk_read (adv7511 -> regmap_edid , 0 ,
548+ adv7511 -> edid_buf , 256 );
576549
577550 adv7511 -> current_edid_segment = block / 2 ;
578551 }
@@ -585,6 +558,14 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block,
585558 return 0 ;
586559}
587560
561+ static const struct regmap_config adv7511_edid_regmap_config = {
562+ .reg_bits = 8 ,
563+ .val_bits = 8 ,
564+
565+ .max_register = 0xff ,
566+ .cache_type = REGCACHE_NONE ,
567+ };
568+
588569/* -----------------------------------------------------------------------------
589570 * ADV75xx helpers
590571 */
@@ -1190,6 +1171,13 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
11901171 goto uninit_regulators ;
11911172 }
11921173
1174+ adv7511 -> regmap_edid = devm_regmap_init_i2c (adv7511 -> i2c_edid ,
1175+ & adv7511_edid_regmap_config );
1176+ if (IS_ERR (adv7511 -> regmap_edid )) {
1177+ ret = PTR_ERR (adv7511 -> regmap_edid );
1178+ goto err_i2c_unregister_edid ;
1179+ }
1180+
11931181 regmap_write (adv7511 -> regmap , ADV7511_REG_EDID_I2C_ADDR ,
11941182 adv7511 -> i2c_edid -> addr << 1 );
11951183
0 commit comments