On Mon, Apr 18, 2016 at 01:23:54PM +0200, Enric Balletbo i Serra wrote:
On 14/04/16 15:10, Thierry Reding wrote:
On Fri, Apr 08, 2016 at 02:52:52PM +0200, Enric Balletbo i Serra wrote:
[...]
- /* Map slave addresses of ANX7814 */
- for (i = 0; i < I2C_NUM_ADDRESSES; i++) {
anx78xx->i2c_dummy[i] = i2c_new_dummy(client->adapter,
anx78xx_i2c_addresses[i] >> 1);
if (!anx78xx->i2c_dummy[i]) {
err = -ENOMEM;
DRM_ERROR("Failed to reserve i2c bus %02x.\n",
anx78xx_i2c_addresses[i]);
goto err_unregister_i2c;
}
anx78xx->map[i] = devm_regmap_init_i2c(anx78xx->i2c_dummy[i],
&anx78xx_regmap_config);
if (IS_ERR(anx78xx->map[i])) {
err = PTR_ERR(anx78xx->map[i]);
DRM_ERROR("Failed regmap initialization %02x.\n",
anx78xx_i2c_addresses[i]);
goto err_unregister_i2c;
}
- }
That's quite some overhead merely to use regmap... Perhaps there's room to enhance regmap-i2c to support multiple addresses for the same device?
Yes it is, guess this is also used on other drivers, so will make sense enhance regmap-i2c, but let me do this on a future regmap-i2c patch series ;)
Yes, improving this in a follow-up patch seems fine, especially since this already seems to be a common pattern.
I'll try to take a look at v4 hopefully within the week.
Thierry