max1720x_battery: load default battery id when id not found
Load profile 0 and prevent from saving data to GMSR when id is not found.
Bug: 181824598
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: If71d43e26ad334b7f549df056d04150fee14e389
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 55e5b83..f9a455f 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -92,7 +92,7 @@
int start_vfsoc;
};
-#define DEFAULT_BATTERY_ID -1
+#define DEFAULT_BATTERY_ID 0
#define DEFAULT_BATTERY_ID_RETRIES 5
#define DEFAULT_CAP_SETTLE_INTERVAL 3
@@ -3556,6 +3556,10 @@
{
int rc, cycle_count;
+ /* do not save data when battery ID not clearly */
+ if (chip->batt_id == DEFAULT_BATTERY_ID)
+ return 0;
+
cycle_count = max1720x_get_cycle_count(chip);
if (cycle_count < 0)
return cycle_count;