summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-11-02 23:09:21 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-16 07:11:01 +0000
commite16a8fc2faaa4216f848f89d09511f1002bad8a1 (patch)
treee949c58c5d9152b1a553d952d060d0ed1788ae8d
parent4b5b9c5c3a1b15075429712df6969416569643de (diff)
downloadchrome-ec-e16a8fc2faaa4216f848f89d09511f1002bad8a1.tar.gz
bq25710: Allow PP_ACOK to be configured
This adds support for configuring PP_ACOK as a prochot trigger. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I183c31daf89df316f7bcb1dc7b66e89bfc66c26c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283415 Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--driver/charger/bq25710.c3
-rw-r--r--include/config.h7
-rw-r--r--zephyr/Kconfig.battery8
-rw-r--r--zephyr/shim/include/config_chip.h5
4 files changed, 23 insertions, 0 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index 58679ccdf5..1865c116f5 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -332,6 +332,9 @@ static int bq257x0_init_prochot_option_1(int chgnum)
if (IS_ENABLED(CONFIG_CHARGER_BQ25710_PP_BATPRES))
reg = SET_PO1_BY_NAME(PP_BATPRES, ENABLE, reg);
+ if (IS_ENABLED(CONFIG_CHARGER_BQ25710_PP_ACOK))
+ reg = SET_PO1_BY_NAME(PP_ACOK, ENABLE, reg);
+
return raw_write16(chgnum, BQ25710_REG_PROCHOT_OPTION_1, reg);
}
diff --git a/include/config.h b/include/config.h
index 11f733731f..e2d0109dbd 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1111,6 +1111,13 @@
#undef CONFIG_CHARGER_BQ25710_PP_BATPRES
/*
+ * This config option sets the PP_ACOK in Prochot Option 1
+ * register. This causes PROCHOT to be pulsed when the AC adapter is
+ * removed.
+ */
+#undef CONFIG_CHARGER_BQ25710_PP_ACOK
+
+/*
* 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 df5f0fb546..736a15d358 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -316,6 +316,14 @@ config PLATFORM_EC_CHARGER_BQ25710_PP_BATPRES
Sets the PP_BATPRES bit in Prochot Option 1 register. This
causes PROCHOT to be pulsed when the battery is removed.
+config PLATFORM_EC_CHARGER_BQ25710_PP_ACOK
+ bool "Enable PROCHOT on AC removal"
+ default n
+ depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720
+ help
+ Sets the PP_ACOK in Prochot Option 1 register. This causes
+ PROCHOT to be pulsed when the AC adapter is removed.
+
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 3ea60c097a..972654f3f4 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1783,6 +1783,11 @@
#define CONFIG_CHARGER_BQ25710_PP_BATPRES
#endif
+#undef CONFIG_CHARGER_BQ25710_PP_ACOK
+#ifdef CONFIG_PLATFORM_EC_CHARGER_BQ25710_PP_ACOK
+#define CONFIG_CHARGER_BQ25710_PP_ACOK
+#endif
+
#undef CONFIG_CHARGER_DISCHARGE_ON_AC
#ifdef CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHARGER_DISCHARGE_ON_AC