aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorOleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>2012-04-12 11:13:12 +0300
committerZiyann <jaraidaniel@gmail.com>2014-10-01 13:01:13 +0200
commitd7d856f9d0b0578deb018ea0501981d0a477e54a (patch)
tree246800ee4368436f591d12de7f87d59fcabe3504 /drivers/power
parentfbd45a5853c9fe1bec2c86e4bb0a33053232b908 (diff)
downloadkernel_samsung_tuna-d7d856f9d0b0578deb018ea0501981d0a477e54a.zip
kernel_samsung_tuna-d7d856f9d0b0578deb018ea0501981d0a477e54a.tar.gz
kernel_samsung_tuna-d7d856f9d0b0578deb018ea0501981d0a477e54a.tar.bz2
OMAP4470: battery: correct temperature conversion.
TWL6032 has 12-bit ADC, TWL6030 has 10-bit ADC, battery temperature table is calculated for the TWL6030. So battery temperature measured correctly only for OMAP4430 and OMAP4460. Patch rejects two lower bits of ADC channel for TWL6032 and temperature measured correctly for all OMAP controllers. Change-Id: I88b6f2e6fbde11fa05642d1772c797b61b2fd1ce Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
Diffstat (limited to 'drivers/power')
-rwxr-xr-xdrivers/power/twl6030_bci_battery.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/power/twl6030_bci_battery.c b/drivers/power/twl6030_bci_battery.c
index e79a6be..4cb29a2 100755
--- a/drivers/power/twl6030_bci_battery.c
+++ b/drivers/power/twl6030_bci_battery.c
@@ -1776,6 +1776,15 @@ static void twl6030_bci_battery_work(struct work_struct *work)
return;
adc_code = req.buf[1].code;
+
+ /*
+ * TWL6032 has 12-bit ADC, TWL6030 has 10-bit ADC,
+ * battery temperature table is calculated for the TWL6030.
+ * So reject two lower bits for TWL6032.
+ */
+ if (di->features & TWL6032_SUBCLASS)
+ adc_code >>= 2;
+
for (temp = 0; temp < di->platform_data->tblsize; temp++) {
if (adc_code >= di->platform_data->
battery_tmp_tbl[temp])