]> rtime.felk.cvut.cz Git - linux-imx.git/commit
staging:iio:ad7192: Report offset and scale for temperature channel
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 10 Aug 2012 16:36:00 +0000 (17:36 +0100)
committerJonathan Cameron <jic23@kernel.org>
Thu, 16 Aug 2012 19:24:37 +0000 (20:24 +0100)
commit4fcbcf95b775acc430742a09fb3334dce08b6c10
tree4bf7af6363578ea6bd1e94bf8615d4f422a7f836
parent58cdff6ee71b4ea00a6b822a52ebf9ceb0b6a7d5
staging:iio:ad7192: Report offset and scale for temperature channel

The temperature channel reports values in degree Kelvin with sensitivity of 5630
codes per degree. If the chip is configured in bipolar mode there is an
additional binary offset of 0x800000 and the sensitivity is divided by two.

Currently the driver does the mapping from the raw value to degree Celsius when
doing a manual conversion. This has several disadvantages, the major one being
that it does not work for buffered mode, also by doing the division by the
sensitivity in the driver the precession of the reported value is needlessly
reduced.

Furthermore the current calculation only works in bipolar mode and the current
scale is of by a factor of 1000.

This patch modifies the driver to report correct offset and scale values in
both unipolar and bipolar mode and to report the raw temperature value
for manual conversions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/adc/ad7192.c