From a1677b72609cc606a96e608870ac488d8f987f9a Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Wed, 10 Oct 2018 17:56:34 +0000 Subject: Revert "tcpc: Check battery present to enable PD_SUSPEND" This reverts commit 1028c039fb14ddf523bcf0786ed39e8a2c57648f. Reason for revert: The original remaining capacity check should work on the no-battery case. Don't need an extra check. Original change's description: > tcpc: Check battery present to enable PD_SUSPEND > > When doing TCPC firmware update, it suspends the PD port. There is > a check to make sure if the battery level is enough for the update > process. But when no battery presents, it still does the update. > Should also check the battery present. Otherwise, the update > process will make the power lost and result a reboot loop. > > BRANCH=none > BUG=b:117498337 > TEST=Do TCPC firmware update on the charging port and no battery: > Saw AP console: > Protect aux fw 0 > Update aux fw 1 > ps8751.1: PD_SUSPEND busy! Could be only power source. > Protect aux fw 1 > Saw EC console: > [9.165306 C1: Cannot suspend for upgrade, no battery!] > > TEST=Do TCPC firmware update on the charging port and battery plugged: > Saw AP console: > Protect aux fw 0 > Update aux fw 1 > ps8751.1: found SPI flash ID 0x1c11 > ps8751.1: erased 20KB in 434ms > ps8751.1: verified 0KB in 0s > ps8751.1: programming 20KB... > > Change-Id: I4ed3929d3234d115596f04245e698de8b1b3e662 > Signed-off-by: Wai-Hong Tam > Reviewed-on: https://chromium-review.googlesource.com/1271257 > Reviewed-by: Furquan Shaikh BRANCH=none BUG=b:117498337 TEST=Triggered TCPC firmware update on the charging port and no battery. Checked the update is not allowed and EC console showed: [9.284003 C0: Cannot suspend for upgrade, not enough battery (0mAh)!] Change-Id: I6a13324996b8fa535cd1035a893b1af01fe96a5c Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/1274006 Reviewed-by: Furquan Shaikh Reviewed-by: Jett Rink --- common/usb_pd_protocol.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index f0d649929c..c5ab8ca9a2 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -4937,11 +4937,6 @@ 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) { -- cgit v1.2.1