aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorLinus Walleij <[email protected]>2016-09-01 11:44:43 +0200
committerJonathan Cameron <[email protected]>2016-09-18 11:31:31 +0100
commit84e2f6f9583f195b9851a8f6340bb526749ea609 (patch)
tree5a259880d554cb2a87225e98e2d30bf398875b20 /tools/perf/scripts/python
parentdc6ac050c7d405cf99f847d5f7b485a7dfa00840 (diff)
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 <[email protected]> Tested-by: Jonathan Cameron <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions