summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-08-14 10:17:59 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-18 04:11:50 +0000
commit001653461171f9685adfcba16b6d2e6108dfe725 (patch)
tree84b1dc78680e55ab99f559294aa96cc60e2ec26b
parent2c458588fc6e6ba12cf34e17ac4f1173de9f8b0f (diff)
downloadchrome-ec-001653461171f9685adfcba16b6d2e6108dfe725.tar.gz
config: Require battery >5% to enable PD Try.SRC
Align the CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC to the value of BATTERY_LEVEL_CRITICAL, which is 5%. The BATTERY_LEVEL_CRITICAL is 5% that means EC will send battery- critical host event when the battery level <= 5%. CrOS PD policies state that the system doesn't source power to any external USB devices when AP is shutdown. So the current CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC 1% default has no point. When the battery level is <= 5%, AP should be shutdown soon and the system should not be a source, so should not enable Try.SRC. Also change the comparison from soc >= CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC to soc > CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC as the battery critical check is soc <= BATTERY_LEVEL_CRITICAL. BRANCH=None BUG=b:165057418 TEST=Plugging a PD charger to a board with the battery level very low, the system boots up (was failed), Change-Id: If6b11feacd62fd003e13b1756eb5c33d2f9bbce4 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2360543 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--baseboard/dedede/baseboard.h8
-rw-r--r--common/usb_pd_dual_role.c2
-rw-r--r--include/config.h2
3 files changed, 2 insertions, 10 deletions
diff --git a/baseboard/dedede/baseboard.h b/baseboard/dedede/baseboard.h
index ce2aafd76c..98e864467f 100644
--- a/baseboard/dedede/baseboard.h
+++ b/baseboard/dedede/baseboard.h
@@ -174,14 +174,6 @@
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
-/*
- * Don't attempt Try.Src if the battery is too low. Even batteries which report
- * 1% state of charge can sometimes disable their discharge FET if the load is
- * too much. Therefore, set this threshold a bit higher. 5% should leave
- * plenty of margin.
- */
-#undef CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC
-#define CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC 5
/* #define CONFIG_USB_PD_VBUS_DETECT_CHARGER */
#define CONFIG_USB_PD_VBUS_MEASURE_CHARGER
#define CONFIG_USB_PD_DECODE_SOP
diff --git a/common/usb_pd_dual_role.c b/common/usb_pd_dual_role.c
index daa6f6dc86..eff8954622 100644
--- a/common/usb_pd_dual_role.c
+++ b/common/usb_pd_dual_role.c
@@ -360,7 +360,7 @@ bool pd_is_try_source_capable(void)
* and at some minimum percentage.
*/
new_try_src = (try_src &&
- usb_get_battery_soc() >= CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC);
+ usb_get_battery_soc() > CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC);
#ifdef CONFIG_BATTERY_REVIVE_DISCONNECT
/*
diff --git a/include/config.h b/include/config.h
index cd1976ff33..18c377faf1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -4198,7 +4198,7 @@
#undef CONFIG_USB_PD_TRY_SRC
/* Set the default minimum battery percentage for Try.Src to be enabled */
-#define CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC 1
+#define CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC 5
/*
* Set the minimum battery percentage to allow a PD port to send resets as a