summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2022-07-21 11:31:24 +1000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-21 23:57:54 +0000
commit577c6ef6ac93d2d1b36333877fddefdd4cd06602 (patch)
tree7c680ae3abd3fd6cc97773b1c4d2f26dee286ae2
parent4354b58e599a8d3e3ce640f9eb28b52e1fe9a07f (diff)
downloadchrome-ec-577c6ef6ac93d2d1b36333877fddefdd4cd06602.tar.gz
sm5803: prevent use when PD max voltage exceeds 15V
Silicon Mitus have recommended that VBUS never exceed 15V on boards using the SM5803 because spikes from a nominal 20V VBUS may damage the charger, even when there is a protection device in front of it. To prevent accidental misconfiguration, make it a compile-time error to enable the SM5803 driver if VBUS greater than 15V is permitted in device policy. BUG=b:230712704 TEST=build fails if CONFIG_SM5803=y and PD_MAX_VOLTAGE_MV > 15000 BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: Ie4438f1793700b4dfd2eb6f53440c8ad785f4c3a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3778901 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/charger/sm5803.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index c5684f2732..e107f54dad 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -28,6 +28,13 @@
#error "SM5803 is a NVDC charger, please enable CONFIG_CHARGER_NARROW_VDC."
#endif
+#ifdef PD_MAX_VOLTAGE_MV
+#if PD_MAX_VOLTAGE_MV > 15000
+/* See https://issuetracker.google.com/230712704 for details. */
+#error "VBUS >15V is forbidden for SM5803 because it can cause hardware damage"
+#endif
+#endif
+
/* Console output macros */
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)