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>
/* 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)