From a57e1ae3adc248977c8b7b2c6fe42bc24478ce06 Mon Sep 17 00:00:00 2001 From: Eric Yilun Lin Date: Thu, 25 Aug 2022 15:31:37 +0800 Subject: battery: print gauge C-FET status BUG=b:240883830 TEST=ec:~$ battery Status: 0x00e0 FULL DCHG INIT Param flags:00000002 Temp: 0x0bac = 298.8 K (25.7 C) V: 0x32e7 = 13031 mV V-desired: 0x0000 = 0 mV I: 0x0000 = 0 mA I-desired: 0x0000 = 0 mA Charging: Not Allowed Charge: 100 % Display: 100.0 % Manuf: COSMX Device: L22X3PG0 Chem: LiP Serial: 0x00bc V-design: 0x2c2e = 11310 mV Mode: 0x6020 Abs charge:100 % Remaining: 4152 mAh Cap-full: 4156 mAh Design: 4156 mAh Time-full: 0h:0 Empty: 0h:0 full_factor:0.97 shutdown_soc:4 % C-FET: 0 BRANCH=none Change-Id: Icbd8b357b608bf014f8670614fd3755a47b6d535 Signed-off-by: Eric Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855650 Tested-by: Eric Yilun Lin Commit-Queue: Eric Yilun Lin Reviewed-by: Ting Shen Auto-Submit: Eric Yilun Lin --- common/battery.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/battery.c b/common/battery.c index 35b0c500a9..9023af7c0e 100644 --- a/common/battery.c +++ b/common/battery.c @@ -6,6 +6,7 @@ */ #include "battery.h" +#include "battery_fuel_gauge.h" #include "charge_manager.h" #include "charge_state.h" #include "common.h" @@ -243,6 +244,15 @@ static void print_battery_info(void) print_item_name("shutdown_soc:"); ccprintf("%d %%\n", batt_host_shutdown_pct); + +#ifdef CONFIG_BATTERY_FUEL_GAUGE + value = battery_is_charge_fet_disabled(); + /* reverse the flag if no error */ + if (value != -1) + value = !value; + print_item_name("C-FET:"); + ccprintf("%d\n", value); +#endif } void print_battery_debug(void) -- cgit v1.2.1