power: pm8921-charger: Add ext batt state reporting

FSM state reporting does not support external charger support
Thus the software needs to check for this case before iterating
over the FSM states and reporting an incorrect state when
charging via an external DC charger.

CRs-Fixed: 318784
Change-Id: Iba973f9e6b7feab614280436178dc20177e2dc59
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
diff --git a/drivers/power/pm8921-charger.c b/drivers/power/pm8921-charger.c
index e517146..aa24409 100644
--- a/drivers/power/pm8921-charger.c
+++ b/drivers/power/pm8921-charger.c
@@ -1043,6 +1043,13 @@
 	int fsm_state = pm_chg_get_fsm_state(chip);
 	int i;
 
+	if (chip->ext) {
+		if (chip->ext_charge_done)
+			return POWER_SUPPLY_STATUS_FULL;
+		if (chip->ext_charging)
+			return POWER_SUPPLY_STATUS_CHARGING;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(map); i++)
 		if (map[i].fsm_state == fsm_state)
 			batt_state = map[i].batt_state;
@@ -1378,6 +1385,7 @@
 
 	chip->ext->stop_charging(chip->ext->ctx);
 	chip->ext_charging = false;
+	chip->ext_charge_done = false;
 }
 
 static void handle_start_ext_chg(struct pm8921_chg_chip *chip)