alistair23-linux/drivers/iio
Linus Walleij 84e2f6f958 iio: accel: kxsd9: Fix up offset and scaling
This fixes several errors in the offset and scaling of the raw
values from the KXSD9 sensor:

- The code did not convert the big endian value from the sensor
  into the endianness of the host CPU. Fix this with
  be16_to_cpu() on the raw obtained value.

- The code did not regard the fact that only the upper 12 bits of
  the accelerometer values are valid. Shift these
  down four bits to yield the real raw value.

- Further the sensor provides 2048 at zero g. This means that an
  offset of 2048 must be subtracted from the raw value before
  scaling. This was not taken into account by the driver,
  yielding a weird value. Fix this by providing this offset in
  sysfs.

To house the scaling code better, the value reading code was
factored into the raw reading function.

This proper scaling and offseting is necessary to get proper
values out of triggered buffer by offsetting, shifting and scaling
them.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18 11:31:31 +01:00
..
accel iio: accel: kxsd9: Fix up offset and scaling 2016-09-18 11:31:31 +01:00
adc Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
amplifiers
buffer iio: add resource managed triggered buffer init helpers 2016-09-04 15:42:46 +01:00
chemical Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
common Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
dac Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
dummy iio:core: timestamping clock selection support 2016-06-30 19:41:38 +01:00
frequency
gyro iio: bmg160: add callbacks for the filter frequency 2016-07-03 12:39:55 +01:00
health First round of IIO new device support, features and cleanups for the 4.8 cycle. 2016-06-09 09:15:58 -07:00
humidity Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
imu Third set of IIO new device support, features and cleanups for the 4.8 cycle. 2016-07-14 12:05:29 +09:00
light Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
magnetometer iio: magn: ak8974: remove .owner field for driver 2016-08-29 20:12:10 +01:00
orientation
potentiometer iio: potentiometer: Fix typo in Kconfig 2016-07-03 12:40:01 +01:00
pressure Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
proximity Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
temperature iio: temperature: fix non static symbol warnings 2016-08-29 19:49:00 +01:00
trigger iio:trigger: Experimental kthread tight loop trigger (thread only) 2016-06-03 13:18:44 +01:00
iio_core.h iio:core: timestamping clock selection support 2016-06-30 19:41:38 +01:00
iio_core_trigger.h
industrialio-buffer.c iio: ensure ret is initialized to zero before entering do loop 2016-09-05 21:00:14 +01:00
industrialio-configfs.c
industrialio-core.c Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
industrialio-event.c iio: iio_push_event(): Don't crash if the event interface is not registered 2016-09-10 16:40:44 +01:00
industrialio-sw-device.c iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
industrialio-sw-trigger.c
industrialio-trigger.c iio: trigger: helpers to determine own trigger 2016-09-10 16:49:14 +01:00
industrialio-triggered-event.c
inkern.c
Kconfig iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
Makefile iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00