From e8fdcaa03f1057fae35abc15d3d9259b6e469329 Mon Sep 17 00:00:00 2001 From: Zhuohao Lee Date: Tue, 13 Sep 2022 17:01:52 +0800 Subject: charger: fix up the charge_get_percent default return value The charge_get_percent should return zero when the HW design doesn't include a battery(ie. no CONFIG_BATTERY). The reason is that the function handle_new_power_state in usb_tc_drp_acc_trysrc_sm.c will check the battery status (via pd_is_battery_capable) to determine whether the device needs to issue DPM_REQUEST_HARD_RESET_SEND or not. If we return 100, the pd_is_battery_capable() will return true and that makes the PD do the HARD_RESET and cause the device to reboot endlessly. BUG=b:242949656 BRANCH=None TEST=make buildall flash the ec.bin to the device and check the typec pd is working Signed-off-by: Zhuohao Lee Change-Id: I59d24c4f58bed3538b70eeba5eff11566bd5f455 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891810 Reviewed-by: Diana Z --- include/charge_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/charge_state.h b/include/charge_state.h index 800662b0a5..c2d2bce948 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -99,7 +99,7 @@ int charge_get_percent(void); #else static inline int charge_get_percent(void) { - return 100; + return 0; } #endif -- cgit v1.2.1