[PATCH] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C

Mark Brown broonie at kernel.org
Wed Apr 16 10:06:39 PDT 2014


On Wed, Apr 16, 2014 at 10:16:10AM +0200, Boris BREZILLON wrote:

> +	if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {
> +		return &regmap_i2c;
> +	} else if (config->val_bits == 16 &&
> +		   i2c_check_functionality(i2c->adapter,
> +					   I2C_FUNC_SMBUS_WORD_DATA)) {
> +                config->reg_read = regmap_smbus_word_reg_read;
> +                config->reg_write = regmap_smbus_word_reg_write;
> +		return NULL;

This all looks good to me except we shouldn't be modifying the config
struct (it's supposed to be const).  We should instead add the ability
for the bus to set these ops - that'll also be useful for things like
AC'97.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140416/575bc83b/attachment.sig>


More information about the linux-arm-kernel mailing list