From e909c5a3f0b0c8f8fcba470878170f3d3195d9b1 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Fri, 21 Aug 2020 15:31:52 -0700 Subject: battery_fuel_gauge: Add check for CFET status This commit adds a function that allows the system to check the if the charge FET (CFET) is disabled or not. BUG=b:160918663 BRANCH=None TEST=Build and flash waddledee; cutoff battery, revive system, verify that "found batt in disconnect" statements are still found. TEST=Add other code, verify that CFET status is able to be retrieved. Signed-off-by: Aseda Aboagye Change-Id: I899070e50a38499708a367bba6b5f502b0232672 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2368071 Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye Tested-by: Aseda Aboagye Auto-Submit: Aseda Aboagye --- include/battery_fuel_gauge.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/battery_fuel_gauge.h') diff --git a/include/battery_fuel_gauge.h b/include/battery_fuel_gauge.h index d610b7e417..8b1b7106bd 100644 --- a/include/battery_fuel_gauge.h +++ b/include/battery_fuel_gauge.h @@ -30,6 +30,8 @@ struct fet_info { const uint8_t reg_addr; const uint16_t reg_mask; const uint16_t disconnect_val; + const uint16_t cfet_mask; /* CHG FET status mask */ + const uint16_t cfet_off_val; }; struct fuel_gauge_info { @@ -68,6 +70,12 @@ int battery_bq4050_imbalance_mv(void); #endif +/** + * Return 1 if CFET is disabled, 0 if enabled. -1 if an error was encountered. + * If the CFET mask is not defined, it will return 0. + */ +int battery_is_charge_fet_disabled(void); + /** * Battery cut off command via SMBus write block. * -- cgit v1.2.1