linux/drivers/iio/common/st_sensors
Lorenzo Bianconi 65c8aea07d iio: common: st_sensors: fix channel data parsing
Using realbits as i2c/spi read len, when that value is not byte aligned
(e.g 12 bits), lead to skip msb part of out data registers.
Fix this taking into account scan_type.shift in addition to
scan_type.realbits as read length:

read_len = DIV_ROUND_UP(realbits + shift, 8)

This fix has been tested on 8, 12, 16, 24 bit sensors

Fixes: e7385de529 ("iio:st_sensors: align on storagebits boundaries")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-31 14:32:09 +00:00
..
Kconfig iio:common: Add STMicroelectronics common library 2013-01-31 17:56:43 +00:00
Makefile iio:common: Add STMicroelectronics common library 2013-01-31 17:56:43 +00:00
st_sensors_buffer.c iio: common: st_sensors: fix channel data parsing 2016-12-31 14:32:09 +00:00
st_sensors_core.c iio: common: st_sensors: fix channel data parsing 2016-12-31 14:32:09 +00:00
st_sensors_core.h iio: st_sensors: support active-low interrupts 2016-01-10 12:35:32 +00:00
st_sensors_i2c.c iio:st_sensors: emulate SMBus block read if needed 2016-05-29 16:04:17 +01:00
st_sensors_spi.c iio: common: remove unnecessary sizeof(u8) 2014-12-12 12:28:25 +00:00
st_sensors_trigger.c fix:iio:common:st_sensors:st_sensors_trigger:mark symbols static where possible 2016-08-29 20:13:12 +01:00