MFLD/Battery: fix battery full logic for transition b/w temperature zones
authorRamakrishna Pallala <ramakrishna.pallala@intel.com>
Tue, 22 May 2012 14:16:12 +0000 (19:46 +0530)
committerbuildbot <buildbot@intel.com>
Thu, 24 May 2012 11:17:21 +0000 (04:17 -0700)
BZ: 37894

This patch fixes the battery full detection logic in case of
temperature transition b/w battery charge profle.

Change-Id: Iff9651b3fa5f35b45a8cec53b0661e69ef3e102f
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Reviewed-on: http://android.intel.com:8080/49753
Reviewed-by: Tc, Jenny <jenny.tc@intel.com>
Tested-by: Kallappa Manjanna, MadhukumarX <madhukumarx.kallappa.manjanna@intel.com>
Reviewed-by: Koskinen, Ilkka <ilkka.koskinen@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/power/intel_mdf_battery.c

index 180b28c..d457de0 100644 (file)
@@ -1437,7 +1437,16 @@ static int check_charge_full(struct msic_power_module_info *mbi,
        /* convert to milli amps */
        cur_avg /= 1000;
 
-       if ((volt_now > (vref - VBATT_FULL_DET_MARGIN)) &&
+       /*
+        * charge full is detected (1)when Vbatt > Vfull and could
+        * be discharging, this can happen  when temperature zone
+        * transition happens. (2) when Vbatt is close to Vfull and
+        * the charge current is with in the termination range.
+        */
+       if ((volt_now > vref) && (volt_prev > vref) &&
+                       (cur_avg <= FULL_CURRENT_AVG_HIGH)) {
+               is_full = true;
+       } else if ((volt_now > (vref - VBATT_FULL_DET_MARGIN)) &&
                (volt_prev > (vref - VBATT_FULL_DET_MARGIN))) {
                if (cur_avg >= FULL_CURRENT_AVG_LOW  &&
                                cur_avg <= FULL_CURRENT_AVG_HIGH)