summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGuenter Roeck2016-06-21 20:04:23 +0200
committerMark Brown2016-06-22 14:50:51 +0200
commitd4ef930638086aa40d14f245799cf7c56aaa91ff (patch)
tree31f49b4e2d5c839ca1ff1961355a7790d00f56f4 /drivers/base
parentLinux 4.7-rc1 (diff)
downloadkernel-qcow2-linux-d4ef930638086aa40d14f245799cf7c56aaa91ff.tar.gz
kernel-qcow2-linux-d4ef930638086aa40d14f245799cf7c56aaa91ff.tar.xz
kernel-qcow2-linux-d4ef930638086aa40d14f245799cf7c56aaa91ff.zip
regmap-i2c: Use i2c block command only if register value width is 8 bit
Chips with 16-bit registers don't usually work well with I2C block commands. For example, neither the LM75 datasheet nor the TMP102 datasheet mentions block command support, and in fact it does not work for any of those chips. Also, it is not clear how the block command would handle 16-bit SMBus operations in the fist place, since the data format associated with those commands is either little endian or big endian, which requires some kind of conversion to or from host byte order. Only use i2c block commands if both register and value width is 8 bit. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-i2c.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
index 1a8ec3b2b601..4735318f4268 100644
--- a/drivers/base/regmap/regmap-i2c.c
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -259,7 +259,7 @@ static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
{
if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C))
return &regmap_i2c;
- else if (config->reg_bits == 8 &&
+ else if (config->val_bits == 8 && config->reg_bits == 8 &&
i2c_check_functionality(i2c->adapter,
I2C_FUNC_SMBUS_I2C_BLOCK))
return &regmap_i2c_smbus_i2c_block;