1
0
Fork 0
alistair23-linux/include/linux/iio
Linus Walleij 65e4345c8e iio: accel: st_accel: fix LIS3LV02 reading and scaling
The LIS3LV02 has a special bit that need to be set to get the
read values left aligned. Before this patch we get gibberish
like this:

iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.010042 -0.642688 19155832931907
0.000000 -0.010042 -0.642688 19155858751073

Which is because we read a raw value for 1g as 64 which is
the nominal 1024 for 1g shifted 4 bits to the left by being
right-aligned rather than left aligned.

Since all other sensors are left aligned, add some code to
set the special DAS (data alignment setting) bit to 1 so that
the right value is now read like this:

iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.147095 -10.120135 24761614364956
-0.029419 -0.176514 -10.120135 24761631624540

The scaling was weird as well: we have a gain of 1000 for 1g
and 3000 for 6g. I don't even remember how I came up with the
old values but they are wrong.

Fixes: 3acddf74f8 ("iio: st-sensors: add support for lis3lv02d accelerometer")
Cc: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-31 14:35:04 +00:00
..
accel iio: accel: kxcjk1013 3-axis accelerometer driver 2014-06-14 17:10:21 +01:00
adc staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQ 2016-10-11 19:39:38 +01:00
common iio: accel: st_accel: fix LIS3LV02 reading and scaling 2016-12-31 14:35:04 +00:00
dac iio: dac: mcp4725: support voltage reference selection 2016-10-23 19:34:23 +01:00
frequency iio: frequency: adf4350: cast value to unsigned to make code checkers happy 2013-06-04 18:36:52 +01:00
gyro itg3200: fix incorrect ifdef comment 2013-03-18 10:59:42 +01:00
imu iio:adis: Add support for manual self-test flag clear 2016-04-16 13:42:43 +01:00
magnetometer iio:ak8975: add mounting matrix support 2016-04-23 22:14:34 +01:00
buffer-dma.h iio: Add generic DMA buffer infrastructure 2015-10-25 13:54:34 +00:00
buffer-dmaengine.h iio: Add a DMAengine framework based buffer 2015-10-25 13:55:32 +00:00
buffer.h iio: buffer: add missing descriptions in iio_buffer_access_funcs 2016-04-03 10:27:49 +01:00
configfs.h iio:configfs: Introduce iio/configfs.h to provide a location for the configfs_subsystem 2015-12-05 16:25:30 +00:00
consumer.h iio: inkern: add helpers to query available values from channels 2016-11-13 11:40:26 +00:00
driver.h iio: Simplify iio_map_array_unregister API 2013-02-02 12:02:20 +00:00
events.h iio: Export userspace IIO headers 2015-02-14 17:05:03 +00:00
iio.h iio: inkern: add helpers to query available values from channels 2016-11-13 11:40:26 +00:00
kfifo_buf.h iio: kfifo: Add resource management devm_iio_kfifo_allocate/free 2014-12-26 11:39:57 +00:00
machine.h staging:iio:in kernel users: Add a data field for channel specific info. 2012-11-10 10:17:27 +00:00
sw_device.h iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
sw_trigger.h iio: sw-trigger: Fix config group initialization 2016-08-15 15:39:09 +01:00
sysfs.h include: linux: iio: add IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros 2016-10-01 14:43:59 +01:00
trigger.h iio:trigger: Add helper function to verify that a trigger belongs to the same device 2016-09-27 20:32:55 +01:00
trigger_consumer.h iio:trigger_consumer.h: Add missing includes and forward declarations 2012-08-27 18:57:59 +01:00
triggered_buffer.h iio: add resource managed triggered buffer init helpers 2016-09-04 15:42:46 +01:00
triggered_event.h iio: Support triggered events 2015-08-27 20:47:09 +01:00
types.h iio:core: add a callback to allow drivers to provide _available attributes 2016-11-13 11:40:25 +00:00