summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zephyr/Kconfig.charger6
-rw-r--r--zephyr/program/nissa/src/common.c39
2 files changed, 45 insertions, 0 deletions
diff --git a/zephyr/Kconfig.charger b/zephyr/Kconfig.charger
index 35bd8590ab..c2c6eeb3f4 100644
--- a/zephyr/Kconfig.charger
+++ b/zephyr/Kconfig.charger
@@ -204,6 +204,12 @@ config PLATFORM_EC_CHARGER_SM5803
Enables the driver for the SM5803.
The SM5803 is the Silicon Mitus SM5803 Buck-Boost Charger.
+ This charger is known to be very inefficient when operating in buck-boost
+ mode (when input voltage is close to output voltage), such that permanent
+ damage may be done to the charger. Users should exercise caution around
+ choice of supported configurations: see b:260271871, b:258754576, and
+ b:230712704 for more information.
+
if PLATFORM_EC_OCPC
diff --git a/zephyr/program/nissa/src/common.c b/zephyr/program/nissa/src/common.c
index 119a999736..155dc541d4 100644
--- a/zephyr/program/nissa/src/common.c
+++ b/zephyr/program/nissa/src/common.c
@@ -148,3 +148,42 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
*kd = 0;
*kd_div = 1;
}
+
+#ifdef CONFIG_PLATFORM_EC_CHARGER_SM5803
+/*
+ * Called by USB-PD code to determine whether a given input voltage is
+ * acceptable.
+ */
+__override int pd_is_valid_input_voltage(int mv)
+{
+ int battery_voltage, rv;
+
+ rv = battery_design_voltage(&battery_voltage);
+ if (rv) {
+ LOG_ERR("Unable to get battery design voltage: %d", rv);
+ return true;
+ }
+
+ /*
+ * SM5803 is extremely inefficient in buck-boost mode, when
+ * VBUS ~= VSYS: very high temperatures on the chip and associated
+ * inductor have been observed when sinking normal charge current in
+ * buck-boost mode (but not in buck or boost mode) so we choose to
+ * completely exclude some voltages that are likely to be problematic.
+ *
+ * Nissa devices use either 2S or 3S batteries, for which VBUS will
+ * usually only be near VSYS with a 3S battery and 12V input (picked
+ * from among common supported PD voltages)- 2S can get close to
+ * 9V, but we expect charge current to be low when a 2S battery is
+ * charged to that voltage (because it will be nearly full).
+ *
+ * We assume that any battery with a design voltage above 9V is 3S, and
+ * that other problematic PD voltages (near to, but not exactly 12V)
+ * will rarely occur.
+ */
+ if (battery_voltage > 9000 && mv == 12000) {
+ return false;
+ }
+ return true;
+}
+#endif