summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHank.Xie <hank.xie@quanta.corp-partner.google.com>2022-08-03 00:39:53 -0400
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-04 02:06:20 +0000
commit7264165cade97f213a2ef2c83cc06fd003008ba1 (patch)
tree129ecaa423415bf384de068a92a3b72a20da6f21
parentc3ab32c8973f1af547a0a118a0f11de21e4c029e (diff)
downloadchrome-ec-7264165cade97f213a2ef2c83cc06fd003008ba1.tar.gz
sm5803: Add support for board with only one charger chip
Shotzo use charger sm5803 but has only one charger chip. Define CONFIG_CHARGER_SINGLE_CHIP will fail to build. To build successfully, replace CHARGER_PRIMARY with CHARGER_SOLO, and avoid the refencing of CHARGER_SECONDARY. BUG=none BRANCH=firmware-dedede-13606.B-master TEST=On shotzo. Check C0 port works fine. Signed-off-by: Hank.Xie <hank.xie@quanta.corp-partner.google.com> Change-Id: Id3460916485b0aede0c6744378e980fb4168d84c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3807184 Reviewed-by: Devin Lu <devin.lu@quantatw.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--driver/charger/sm5803.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 890d2b5c6b..363e320f89 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -35,6 +35,10 @@
#endif
#endif
+#ifdef CONFIG_CHARGER_SINGLE_CHIP
+#define CHARGER_PRIMARY CHARGER_SOLO
+#endif
+
/* Console output macros */
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
@@ -397,6 +401,7 @@ enum ec_error_list sm5803_vbus_sink_enable(int chgnum, int enable)
rv |= sm5803_flow2_update(
chgnum, SM5803_FLOW2_AUTO_ENABLED, MASK_CLR);
+#ifndef CONFIG_CHARGER_SINGLE_CHIP
if (chgnum == CHARGER_SECONDARY) {
rv |= sm5803_flow1_update(CHARGER_PRIMARY,
SM5803_FLOW1_LINEAR_CHARGE_EN,
@@ -408,6 +413,7 @@ enum ec_error_list sm5803_vbus_sink_enable(int chgnum, int enable)
rv |= chg_write8(CHARGER_PRIMARY, SM5803_REG_FLOW3,
regval);
}
+#endif
/* Disable sink mode, unless currently sourcing out */
if (!sm5803_is_sourcing_otg_power(chgnum, chgnum))