linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/5] iio:pressure:ms5611: fix ms5607 temp compensation
@ 2016-02-15 17:53 Gregor Boirie
  2016-02-15 17:53 ` [PATCH v1 2/5] iio:pressure:ms5611: use probed device name Gregor Boirie
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Gregor Boirie @ 2016-02-15 17:53 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Tomasz Duszynski, Daniel Baluta,
	Krzysztof Kozlowski, Mark Brown, Andrew F. Davis, Gregor Boirie

See page 8 of ms5607 datasheet here:
http://www.meas-spec.com/product/pressure/MS5607-ms.aspx

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/ms5611_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
index c7885f0c..a2ff89e6 100644
--- a/drivers/iio/pressure/ms5611_core.c
+++ b/drivers/iio/pressure/ms5611_core.c
@@ -136,15 +136,15 @@ static int ms5607_temp_and_pressure_compensate(struct ms5611_chip_info *chip_inf
 
 	t = 2000 + ((chip_info->prom[6] * dt) >> 23);
 	if (t < 2000) {
-		s64 off2, sens2, t2;
+		s64 off2, sens2, t2, tmp;
 
 		t2 = (dt * dt) >> 31;
-		off2 = (61 * (t - 2000) * (t - 2000)) >> 4;
-		sens2 = off2 << 1;
+		tmp = (t - 2000) * (t - 2000);
+		off2 = (61 * tmp) >> 4;
+		sens2 = tmp << 1;
 
 		if (t < -1500) {
-			s64 tmp = (t + 1500) * (t + 1500);
-
+			tmp = (t + 1500) * (t + 1500);
 			off2 += 15 * tmp;
 			sens2 += (8 * tmp);
 		}
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-16  4:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 17:53 [PATCH v1 1/5] iio:pressure:ms5611: fix ms5607 temp compensation Gregor Boirie
2016-02-15 17:53 ` [PATCH v1 2/5] iio:pressure:ms5611: use probed device name Gregor Boirie
2016-02-15 17:53 ` [PATCH v1 3/5] iio:pressure:ms5611: power regulator support Gregor Boirie
2016-02-15 17:53 ` [PATCH v1 4/5] iio:pressure:ms5611: DT bindings documentation Gregor Boirie
2016-02-15 17:53 ` [PATCH v1 5/5] iio:pressure:ms5611: continuous sampling support Gregor Boirie
2016-02-15 18:37 ` [PATCH v1 1/5] iio:pressure:ms5611: fix ms5607 temp compensation Peter Meerwald-Stadler
2016-02-16  4:28   ` Lucas De Marchi

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).