]> git.ipfire.org Git - people/ms/linux.git/commit
iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit
authorBeomho Seo <beomho.seo@samsung.com>
Wed, 2 Apr 2014 08:15:00 +0000 (09:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Feb 2014 21:34:51 +0000 (13:34 -0800)
commitc2de2d3b28ed7ac53a14b5c1940de3fc527cdce3
treee5671f1b282229c4597aa4924099540c8e517044
parentdceb7b647a838eac1a64f962baa429e0eeb8cb23
iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit

commit bef44abccb2677e8d16e50b75316d4fd1061be81 upstream.

This effects the reported scale of the raw values, and thus userspace
applications that use this value.

One micro tesla equal 0.01 gauss. So I have fixed calculation formula And add RAW_TO_GAUSS macro.
ASA is in the range of 0 to 255. If multiply 0.003, calculation result(in_magn_[*]_scale) is
always 0. So multiply 3000 and return and IIO_VAL_INT_PLUS_MICRO.
As a result, read_raw call back function return accurate scale value.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/magnetometer/ak8975.c