google_battery: apply rest_fv_uv when adaptive charge in active state

Bug: 156608487
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: Ibf1c3a7f9d933d8ec853426e57ad39f2d06e30f7
Signed-off-by: Ken Tsou <[email protected]>
(cherry picked from commit ac7b3949cf59675ed0e144cb581ce18f7f4f7901)
diff --git a/google_battery.c b/google_battery.c
index dc09acf..77e810e 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -2403,8 +2403,11 @@
 	 * based charging is active
 	 */
 	changed |= msc_logic_health(&batt_drv->chg_health, batt_drv);
-	if (batt_drv->chg_health.rest_state == CHG_HEALTH_ACTIVE)
+	if (batt_drv->chg_health.rest_state == CHG_HEALTH_ACTIVE) {
 		batt_drv->msc_state = MSC_HEALTH;
+		/* make sure using rest_fv_uv when HEALTH_ACTIVE */
+		batt_drv->fv_uv = 0;
+	}
 
 msc_logic_done:
 	/* set ->cc_max = 0 on RL and SW_JEITA, no vote on interval in RL_DSG */
@@ -2444,11 +2447,11 @@
 		const int rest_fv_uv = batt_drv->chg_health.rest_fv_uv;
 
 		vote(batt_drv->fv_votable, MSC_LOGIC_VOTER,
-			!disable_votes && (batt_drv->fv_uv != -1),
+			!disable_votes && (batt_drv->fv_uv > 0),
 			batt_drv->fv_uv);
 
 		vote(batt_drv->fv_votable, MSC_HEALTH_VOTER,
-			!disable_votes && (rest_fv_uv != -1),
+			!disable_votes && (rest_fv_uv > 0),
 			rest_fv_uv);
 	}