aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorOleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>2012-04-12 11:13:12 +0300
committerDmytro Kedrovskyi <x0169235@ti.com>2012-04-18 19:43:54 +0300
commite337edcb00de8c0751325dae2cf2f382a02363dc (patch)
tree2f286637aaaf96a23a3442cbd844b0bedbc0be25 /drivers/power
parent0cfa43e96370ae7e465ade2b1bd1b3d6aff80ba9 (diff)
downloadkernel_samsung_espresso10-e337edcb00de8c0751325dae2cf2f382a02363dc.zip
kernel_samsung_espresso10-e337edcb00de8c0751325dae2cf2f382a02363dc.tar.gz
kernel_samsung_espresso10-e337edcb00de8c0751325dae2cf2f382a02363dc.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')
-rw-r--r--drivers/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 cea9044..69bdacd 100644
--- a/drivers/power/twl6030_bci_battery.c
+++ b/drivers/power/twl6030_bci_battery.c
@@ -1429,6 +1429,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])