summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-11-08 19:32:14 -0800
committerCommit Bot <commit-bot@chromium.org>2021-11-11 20:58:39 +0000
commit65ec8708608955683f04e7bbfdf2cef39b5214f9 (patch)
tree7e04991794c95443b1ad1e55ed1c165bfded659c
parentf764caac04ce12f7bcd404f17db27631c51c84b8 (diff)
downloadchrome-ec-65ec8708608955683f04e7bbfdf2cef39b5214f9.tar.gz
bq25710: Allow BATOC threshold to be configured
This adds support for selecting the minimum BATOC protection threshold to be used with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the bq25720. The default threshold is 200% on both chips. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I22576d1cf7c78bfefeb1c2582434ddc0220a1928 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3275001 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--driver/charger/bq25710.c10
-rw-r--r--include/config.h8
-rw-r--r--zephyr/Kconfig.battery10
-rw-r--r--zephyr/shim/include/config_chip.h5
4 files changed, 33 insertions, 0 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index 97a8299802..e7b3abca5d 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -298,6 +298,16 @@ static int bq257x0_init_charge_option_2(int chgnum)
reg = SET_CO2_BY_NAME(ACOC_VTH, 1P33, reg);
}
+ if (IS_ENABLED(CONFIG_CHARGER_BQ25710_BATOC_VTH_MINIMUM)) {
+ /* Set battery over-current threshold to minimum. */
+ if (IS_ENABLED(CONFIG_CHARGER_BQ25720))
+ reg = SET_BQ_FIELD_BY_NAME(BQ25720, CHARGE_OPTION_2,
+ BATOC_VTH, 1P33, reg);
+ else
+ reg = SET_BQ_FIELD_BY_NAME(BQ25710, CHARGE_OPTION_2,
+ BATOC_VTH, 1P50, reg);
+ }
+
return raw_write16(chgnum, BQ25710_REG_CHARGE_OPTION_2, reg);
}
diff --git a/include/config.h b/include/config.h
index 6d4177f813..6ac318efa7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1085,6 +1085,14 @@
#undef CONFIG_CHARGER_BQ25710_ACOC_VTH_1P33
/*
+ * This config option selects the minimum BATOC protection threshold to
+ * be used with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG
+ * on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the bq25720. The
+ * default threshold is 200% on both chips.
+ */
+#undef CONFIG_CHARGER_BQ25710_BATOC_VTH_MINIMUM
+
+/*
* Board specific maximum input current limit, in mA.
*/
#undef CONFIG_CHARGER_MAX_INPUT_CURRENT
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 9fffab3148..462eab16ea 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -288,6 +288,16 @@ config PLATFORM_EC_CHARGER_BQ25710_ACOC_VTH_1P33
EN_ACOC. Enabling this option selects 133% of
ILIM2. Otherwise, the default is 200% of ILIM2.
+config PLATFORM_EC_CHARGER_BQ25710_BATOC_VTH_MINIMUM
+ bool "Select the minimum BATOC threshold"
+ default n
+ depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720
+ help
+ This selects the minimum BATOC protection threshold to be used
+ with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG
+ on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the
+ bq25720. The default threshold is 200% on both chips.
+
config PLATFORM_EC_CHARGER_BQ25710_SENSE_RESISTOR
int "Value of the charge sense-resistor, in mOhms"
default 10
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 12c238ed96..665d7ade58 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1751,6 +1751,11 @@
#define CONFIG_CHARGER_BQ25710_ACOC_VTH_1P33
#endif
+#undef CONFIG_CHARGER_BQ25710_BATOC_VTH_MINIMUM
+#ifdef CONFIG_PLATFORM_EC_CHARGER_BQ25710_BATOC_VTH_MINIMUM
+#define CONFIG_CHARGER_BQ25710_BATOC_VTH_MINIMUM
+#endif
+
#undef CONFIG_CHARGER_BQ25710_SENSE_RESISTOR
#ifdef CONFIG_PLATFORM_EC_CHARGER_BQ25710_SENSE_RESISTOR
#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR \