power: pm8921-bms: fix the units of batt_temp for rbatt
The scaling factor tables has temperature in units of degree celcius.
The temperature passed to the get_rbatt function is in deci degree
celcius.
Convert the temperature to degree celcius before passing it to the
functions that read the scaling factor tables.
Change-Id: Iffb6a7c8d39ba7ececddadeb52913c3a19ee67bd
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/power/pm8921-bms.c b/drivers/power/pm8921-bms.c
index e21862a..ab1e1c7 100644
--- a/drivers/power/pm8921-bms.c
+++ b/drivers/power/pm8921-bms.c
@@ -983,7 +983,8 @@
pr_debug("RBATT = %d\n", rbatt);
return rbatt;
}
-
+ /* Convert the batt_temp to DegC from deciDegC */
+ batt_temp = batt_temp / 10;
scalefactor = interpolate_scalingfactor(chip, chip->rbatt_sf_lut,
batt_temp, soc_rbatt);
pr_debug("rbatt sf = %d for batt_temp = %d, soc_rbatt = %d\n",
@@ -1833,7 +1834,7 @@
if (chip->rbatt_sf_lut) {
scalefactor = interpolate_scalingfactor(chip,
chip->rbatt_sf_lut,
- chip->batt_temp_suspend,
+ chip->batt_temp_suspend / 10,
chip->soc_rbatt_suspend);
rbatt = rbatt * 100 / scalefactor;
}