power: supply: sbs-battery: use i2c_smbus_read_block_data()
authorSebastian Reichel <sebastian.reichel@collabora.com>
Fri, 5 Jun 2020 23:06:24 +0000 (01:06 +0200)
committerSebastian Reichel <sre@kernel.org>
Fri, 19 Jun 2020 16:38:39 +0000 (18:38 +0200)
commit05e0430971543e6aeb328df1226dc52930171445
tree03123901ff5a391756d82bf3c64f8cbd07a37987
parent1d85f6d1b0c11f15ec2b1a9719da8118f3f94e64
power: supply: sbs-battery: use i2c_smbus_read_block_data()

The SBS battery implements SMBus block reads. Currently the
driver "emulates" this by doing an I2C byte read for the
length followed by an I2C block read. The I2C subsystem
actually provides a proper API for doing SMBus block reads,
which can and should be used instead. The current implementation
does not properly handle packet error checking (PEC).

Not all upstream systems using sbs-battery have I2C bus drivers
supporting I2C_M_RECV_LEN, so old implementation is kept as
fallback to keep things working. But this prints a warning,
which hopefully results in people implementing support for it.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/sbs-battery.c