google_battery: change topoff current by battery temperature

For battery swelling concern, need to terminate charge early when
battery temperature is over criteria

Bug: 188055544
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: I9c8ccf6285e9ed4629d07a61322e387df149222f
diff --git a/google_battery.c b/google_battery.c
index d66ce78..9a4f71c 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -284,6 +284,7 @@
 
 	int fv_uv;
 	int cc_max;
+	int topoff;
 	int msc_update_interval;
 
 	bool disable_votes;
@@ -2888,6 +2889,7 @@
 	batt_drv->vbatt_idx = vbatt_idx;
 	batt_drv->temp_idx = temp_idx;
 	batt_drv->cc_max = GBMS_CCCM_LIMITS(profile, temp_idx, vbatt_idx);
+	batt_drv->topoff = profile->topoff_limits[temp_idx];
 	batt_drv->fv_uv = fv_uv;
 
 	return 0;
@@ -5600,6 +5602,13 @@
 		}
 		break;
 
+	case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
+		if (batt_drv->topoff)
+			val->intval = batt_drv->topoff;
+		else
+			val->intval = -1;
+		break;
+
 	default:
 		if (!batt_drv->fg_psy)
 			return -EINVAL;