summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhuohao Lee <zhuohao@chromium.org>2022-09-13 17:01:52 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-13 14:22:21 +0000
commite8fdcaa03f1057fae35abc15d3d9259b6e469329 (patch)
tree8e86b618fd6028be679700ce8a08b4708ec919af
parent0f5d89e24b7ab6bfe464affaaf2be905520d4f6a (diff)
downloadchrome-ec-e8fdcaa03f1057fae35abc15d3d9259b6e469329.tar.gz
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 <zhuohao@chromium.org> Change-Id: I59d24c4f58bed3538b70eeba5eff11566bd5f455 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891810 Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--include/charge_state.h2
1 files changed, 1 insertions, 1 deletions
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