lkml.org 
[lkml]   [2014]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] regmap: i2c: fallback to SMBus if the adapter does not support standard I2C
> +const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
> + const struct regmap_config *config)
> +{
> + 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))
> + return &regmap_smbus_word;
> + else if (config->val_bits == 8 &&
> + i2c_check_functionality(i2c->adapter,
> + I2C_FUNC_SMBUS_BYTE_DATA))
> + return &regmap_smbus_byte;

The fallback code should also check that reg_bits is 8.

> +
> + return ERR_PTR(-ENOTSUPP);
> +}
> +



\
 
 \ /
  Last update: 2014-04-18 19:41    [W:0.069 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site