summaryrefslogtreecommitdiff
path: root/common/charge_ramp.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2023-02-21 15:52:58 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-24 08:56:12 +0000
commitf34bcdc53cf6a874ef67b4a93331261390bae013 (patch)
tree119fc9accd5ed08ec5a390b8e1182434ef044b54 /common/charge_ramp.c
parent9239f343bc9bf69aac3cf6438a4d34ba3e578a7e (diff)
downloadchrome-ec-f34bcdc53cf6a874ef67b4a93331261390bae013.tar.gz
zephyr: make bc1.2 optional
For devices that don't support bc1.2, the code should not depend on anything related to usb_charge module (e.g. bc12_ports) BUG=b:269989432 TEST=zmake build --all BRANCH=none Change-Id: I6be47485bbd606f93a581d1638b3402337233b7c Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4274111 Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'common/charge_ramp.c')
-rw-r--r--common/charge_ramp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/charge_ramp.c b/common/charge_ramp.c
index 2c84087e21..fcea02d1c7 100644
--- a/common/charge_ramp.c
+++ b/common/charge_ramp.c
@@ -44,8 +44,11 @@ test_mockable int chg_ramp_allowed(int port, int supplier)
/* default: fall through */
}
+#ifdef CONFIG_USB_CHARGER
/* Otherwise ask the BC1.2 detect module */
return usb_charger_ramp_allowed(port, supplier);
+#endif
+ return 0;
}
test_mockable int chg_ramp_max(int port, int supplier, int sup_curr)
@@ -53,6 +56,8 @@ test_mockable int chg_ramp_max(int port, int supplier, int sup_curr)
switch (supplier) {
case CHARGE_SUPPLIER_PD:
case CHARGE_SUPPLIER_TYPEC:
+ return 0;
+
case CHARGE_SUPPLIER_TYPEC_DTS:
/*
* We should not ramp DTS beyond what they advertise, otherwise
@@ -62,6 +67,9 @@ test_mockable int chg_ramp_max(int port, int supplier, int sup_curr)
/* default: fall through */
}
+#ifdef CONFIG_USB_CHARGER
/* Otherwise ask the BC1.2 detect module */
return usb_charger_ramp_max(port, supplier, sup_curr);
+#endif
+ return 0;
}