* [PATCH] iio: pressure: bmp280: fix temp compensation
@ 2015-04-08 15:26 Irina Tirdea
2015-04-08 15:30 ` Vlad Dogaru
0 siblings, 1 reply; 3+ messages in thread
From: Irina Tirdea @ 2015-04-08 15:26 UTC (permalink / raw)
To: Jonathan Cameron, Vlad Dogaru, linux-iio
Cc: linux-kernel, Hartmut Knaack, Irina Tirdea
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>
---
drivers/iio/pressure/bmp280.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
index 7c623e2..a2602d8 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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix temp compensation
2015-04-08 15:26 [PATCH] iio: pressure: bmp280: fix temp compensation Irina Tirdea
@ 2015-04-08 15:30 ` Vlad Dogaru
2015-04-09 11:56 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Vlad Dogaru @ 2015-04-08 15:30 UTC (permalink / raw)
To: Irina Tirdea; +Cc: Jonathan Cameron, linux-iio, linux-kernel, Hartmut Knaack
On Wed, Apr 08, 2015 at 06:26:12PM +0300, Irina Tirdea wrote:
> 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>
Nice catch, this must have been lost during a refactoring.
Thanks,
Vlad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix temp compensation
2015-04-08 15:30 ` Vlad Dogaru
@ 2015-04-09 11:56 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2015-04-09 11:56 UTC (permalink / raw)
To: Vlad Dogaru, Irina Tirdea; +Cc: linux-iio, linux-kernel, Hartmut Knaack
On 08/04/15 16:30, Vlad Dogaru wrote:
> On Wed, Apr 08, 2015 at 06:26:12PM +0300, Irina Tirdea wrote:
>> 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>
>
> Nice catch, this must have been lost during a refactoring.
>
> Thanks,
> Vlad
>
Thanks,
Applied to fixes-togreg which is now based on staging-next
which gives you an idea of when this will go to Greg now!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-09 11:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 15:26 [PATCH] iio: pressure: bmp280: fix temp compensation Irina Tirdea
2015-04-08 15:30 ` Vlad Dogaru
2015-04-09 11:56 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).