max1720x_battery: allow age data to be empty timerh
An empty timerh may have been reset by fg or not accumulate enough time.
In this case there is no need to block the battery bhi calculation.
Add FG POR check to make sure get aged data after model loading done
Bug: 276635706
Change-Id: Ic37736f3bbab29593edb8b6e76d31ff65938550f
Signed-off-by: Jenny Ho <[email protected]>
(cherry picked from commit d6debad4550d15b1dd85571bf614dd2df2ad786f)
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 65dcdad..76a1581 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -2116,8 +2116,12 @@
u16 timerh;
int ret;
+ /* model not ready */
+ if (chip->por)
+ return -ENODATA;
+
ret = REGMAP_READ(&chip->regmap, MAX1720X_TIMERH, &timerh);
- if (ret < 0 || timerh == 0)
+ if (ret < 0)
return -ENODATA;
return reg_to_time_hr(timerh, chip);