summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index c5ab8ca9a2..f0d649929c 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -4937,6 +4937,11 @@ static int pd_control(struct host_cmd_handler_args *args)
* to ask the battery directly.
*/
battery_get_params(&batt);
+ if (batt.is_present != BP_YES) {
+ CPRINTS("C%d: Cannot suspend for upgrade, no "
+ "battery!", cmd->chip);
+ return EC_RES_BUSY;
+ }
if (batt.remaining_capacity <
MIN_BATTERY_FOR_TCPC_UPGRADE_MAH ||
batt.flags & BATT_FLAG_BAD_REMAINING_CAPACITY) {