google_battery: add logging for OVERHEAT
Log triggers of TEMP-DEFEND and DWELL-DEFEND in a separate voltage
tier.
Bug: 172006737
Test: triggered, checked the logs
Signed-off-by: AleX Pelosi <[email protected]>
Change-Id: Iba8474ea20671854312e5c9b004267b8ed823de8
Signed-off-by: Ken Tsou <[email protected]>
(cherry picked from commit ac6ca8a21b100a37e37dab93151af5f67a46e465)
diff --git a/google_bms.h b/google_bms.h
index 1fe70c1..3703927 100644
--- a/google_bms.h
+++ b/google_bms.h
@@ -225,6 +225,7 @@
* CHG_HEALTH_ACTIVE -> CHG_HEALTH_DONE
*/
enum chg_health_state {
+ CHG_HEALTH_CCLVL_DISABLED = -6,
CHG_HEALTH_BD_DISABLED = -5,
CHG_HEALTH_USER_DISABLED = -3,
CHG_HEALTH_DISABLED = -2,
@@ -241,6 +242,7 @@
GBMS_STATS_AC_TI_DISABLE_MISC = -3,
GBMS_STATS_AC_TI_DISABLE_SETTING = -2,
GBMS_STATS_AC_TI_INVALID = -1,
+
/* Regular charge tiers 0 -> 9 */
GBMS_STATS_AC_TI_VALID = 10,
GBMS_STATS_AC_TI_DISABLED,
@@ -248,8 +250,14 @@
GBMS_STATS_AC_TI_ACTIVE,
GBMS_STATS_AC_TI_ENABLED_AON,
GBMS_STATS_AC_TI_ACTIVE_AON,
+
+ /* TODO: rename, these are not really related to AC */
GBMS_STATS_AC_TI_FULL_CHARGE = 100,
GBMS_STATS_AC_TI_HIGH_SOC = 101,
+
+ /* Defender TEMP or DWELL */
+ GBMS_STATS_BD_TI_OVERHEAT_TEMP = 110,
+ GBMS_STATS_BD_TI_CUSTOM_LEVELS = 111,
};
/* health state */
@@ -272,6 +280,7 @@
#define CHG_HEALTH_REST_SOC(rest) (((rest)->always_on_soc != -1) ? \
(rest)->always_on_soc : (rest)->rest_soc)
+/* reset on every charge session */
struct gbms_charging_event {
union gbms_ce_adapter_details adapter_details;
@@ -292,20 +301,25 @@
struct batt_chg_health ce_health; /* updated on close */
struct gbms_ce_tier_stats health_stats; /* updated in HC */
+ /* other stats */
struct gbms_ce_tier_stats full_charge_stats;
struct gbms_ce_tier_stats high_soc_stats;
+
+ struct gbms_ce_tier_stats overheat_stats;
+ struct gbms_ce_tier_stats cc_lvl_stats;
};
#define GBMS_CCCM_LIMITS(profile, ti, vi) \
profile->cccm_limits[(ti * profile->volt_nb_limits) + vi]
/* newgen charging */
-#define GBMS_CS_FLAG_BUCK_EN (1 << 0)
-#define GBMS_CS_FLAG_DONE (1 << 1)
-#define GBMS_CS_FLAG_CC (1 << 2)
-#define GBMS_CS_FLAG_CV (1 << 3)
-#define GBMS_CS_FLAG_ILIM (1 << 4)
-#define GBMS_CS_FLAG_NOCOMP (1 << 5)
+#define GBMS_CS_FLAG_BUCK_EN BIT(0)
+#define GBMS_CS_FLAG_DONE BIT(1)
+#define GBMS_CS_FLAG_CC BIT(2)
+#define GBMS_CS_FLAG_CV BIT(3)
+#define GBMS_CS_FLAG_ILIM BIT(4)
+#define GBMS_CS_FLAG_CCLVL BIT(5)
+#define GBMS_CS_FLAG_NOCOMP BIT(6)
union gbms_charger_state {
uint64_t v;