From: H. Nikolaus Schaller Date: Thu, 28 May 2015 19:50:18 +0000 (+0200) Subject: iio: adc: twl4030_madc: Fix calculation of the temperature sense current X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0cbb39f1432096cf00eca21f2d10f6d2057c26ba;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git iio: adc: twl4030_madc: Fix calculation of the temperature sense current The bit mask to read the setting of the constant current source for measuring the NTC voltage was the wrong one. Since default value is initialized to the lowest level (000 = 10uA) the difference was probably never noticed in practice. Signed-off-by: H. Nikolaus Schaller Signed-off-by: Marek Belisko Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index 94c5f05b4bc1..6d2d429a48e0 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c @@ -235,7 +235,7 @@ static int twl4030battery_temperature(int raw_volt) if (ret < 0) return ret; - curr = ((val & TWL4030_BCI_ITHEN) + 1) * 10; + curr = ((val & TWL4030_BCI_ITHSENS) + 1) * 10; /* Getting and calculating the thermistor resistance in ohms */ res = volt * 1000 / curr; /* calculating temperature */