aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@intel.com>2015-04-08 18:26:12 +0300
committerJonathan Cameron <jic23@kernel.org>2015-04-09 12:54:10 +0100
commitabad398337f038f5822e53c55eff5b0820ef7efe (patch)
treee0442b139200afcf71c3f0ff32204d9f3e9d4335
parentMerge 4.0-rc7 into staging-next (diff)
downloadlinux-dev-abad398337f038f5822e53c55eff5b0820ef7efe.tar.xz
linux-dev-abad398337f038f5822e53c55eff5b0820ef7efe.zip
iio: pressure: bmp280: fix temp compensation
Temperature reads on bmp280 device always return 0, due to a missing step in the compensation formula (data->tfine is never initialized). Initialize data->tfine value so we get correct temperature and pressure values. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/pressure/bmp280.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
index 7c623e2bd633..a2602d8dd6d5 100644
--- a/drivers/iio/pressure/bmp280.c
+++ b/drivers/iio/pressure/bmp280.c
@@ -172,6 +172,7 @@ static s32 bmp280_compensate_temp(struct bmp280_data *data,
var2 = (((((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1]))) *
((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1])))) >> 12) *
((s32)(s16)le16_to_cpu(buf[T3]))) >> 14;
+ data->t_fine = var1 + var2;
return (data->t_fine * 5 + 128) >> 8;
}