summaryrefslogtreecommitdiff
path: root/driver/charger/isl923x.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-04-16 13:54:49 -0700
committerCommit Bot <commit-bot@chromium.org>2020-04-21 19:49:54 +0000
commited6bc5e1bc86bfa9bf5d436fd77c14ad4d6068cb (patch)
tree8d14d4b371ad586e96f82101ee429ff58a33a603 /driver/charger/isl923x.h
parentd8d1f71a4f5e53d97ab99f86a2cbd2aa1dd7a268 (diff)
downloadchrome-ec-ed6bc5e1bc86bfa9bf5d436fd77c14ad4d6068cb.tar.gz
raa489000: Add hibernate function
The RAA489000 supports a battery ship mode in which the charger IC consumes the least amount of power. This commit adds that functionality. BUG=b:150236134 BRANCH=None TEST=Call function on waddledoo, build and flash, verify that device still wakes up from hibernate via AC insertion. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I5fd35adb4c0e737c438d766676e3f6038fc0d397 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2153808 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/charger/isl923x.h')
-rw-r--r--driver/charger/isl923x.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h
index 3ff0de9d69..d71bf170f1 100644
--- a/driver/charger/isl923x.h
+++ b/driver/charger/isl923x.h
@@ -32,6 +32,7 @@
#define ISL9238_REG_INPUT_VOLTAGE 0x4b
#define ISL923X_REG_MANUFACTURER_ID 0xfe
#define ISL923X_REG_DEVICE_ID 0xff
+#define RAA489000_REG_CONTROL8 0x37
/* Sense resistor default values in mOhm */
#define ISL923X_DEFAULT_SENSE_RESISTOR_AC 20
@@ -103,6 +104,10 @@
#define ISL923X_C0_DCHOT_3A (3 << 3)
#define ISL923X_C0_DCHOT_MASK (3 << 3)
+/* Control0: BGATE force on */
+#define RAA489000_C0_BGATE_FORCE_ON BIT(10)
+#define RAA489000_C0_EN_CHG_PUMPS_TO_100PCT BIT(6)
+
/* Control1: general purpose comparator debounce time in micro second */
#define ISL923X_C1_GP_DEBOUNCE_2 (0 << 14)
#define ISL923X_C1_GP_DEBOUNCE_12 BIT(14)
@@ -147,6 +152,12 @@
#define ISL923X_C1_VSYSLO_REF_6900 3
#define ISL923X_C1_VSYSLO_REF_MASK 3
+/* Control1: Supplemental mode support */
+#define RAA489000_C1_ENABLE_SUPP_SUPPORT_MODE BIT(10)
+
+/* Control1: BGATE Force Off */
+#define RAA489000_C1_BGATE_FORCE_OFF BIT(6)
+
/* Control2: trickle charging current in mA */
#define ISL923X_C2_TRICKLE_256 (0 << 14)
#define ISL923X_C2_TRICKLE_128 BIT(14)
@@ -240,6 +251,12 @@
/* Control4: PSYS Rsense ratio. */
#define RAA489000_C4_PSYS_RSNS_RATIO_1_TO_1 BIT(11)
+/* Control4: GP comparator control bit */
+#define RAA489000_C4_DISABLE_GP_CMP BIT(12)
+
+/* Control8: MCU_LDO - BAT state disable */
+#define RAA489000_C8_MCU_LDO_BAT_STATE_DISABLE BIT(14)
+
/* OTG voltage limit in mV, current limit in mA */
#define ISL9237_OTG_VOLTAGE_MIN 4864
#define ISL9237_OTG_VOLTAGE_MAX 5376
@@ -355,5 +372,14 @@ int isl923x_set_dc_prochot(int chgnum, uint16_t ma);
*/
int isl923x_set_comparator_inversion(int chgnum, int invert);
+/**
+ * Prepare the charger IC for battery ship mode. Battery ship mode sets the
+ * lowest power state for the IC. Battery ship mode can only be entered from
+ * battery only mode.
+ *
+ * @param chgnum index into chg_chips table.
+ */
+void raa489000_hibernate(int chgnum);
+
#define ISL923X_AC_PROCHOT_CURRENT_MAX 6400 /* mA */
#define ISL923X_DC_PROCHOT_CURRENT_MAX 12800 /* mA */