From b23f483631d9e3fe3bb2b49356462e657aaf2afe Mon Sep 17 00:00:00 2001 From: Diana Z Date: Thu, 3 Sep 2020 16:53:14 -0600 Subject: SM5803: Enable hibernate function for z-state Enable SM5803 hibernation and restore registers after booting back from z-state. BRANCH=None BUG=b:166648029 TEST=on drawlat, z-state power usage is reduced and booting after z-state the charger chips can sink and source as expected Signed-off-by: Diana Z Change-Id: I6e9f9f29a184fa6177e589b3b7810f51a1b3345b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393225 Reviewed-by: Aseda Aboagye Commit-Queue: Aseda Aboagye --- driver/charger/sm5803.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'driver/charger/sm5803.h') diff --git a/driver/charger/sm5803.h b/driver/charger/sm5803.h index 7c0eaca78b..fe71314b1a 100644 --- a/driver/charger/sm5803.h +++ b/driver/charger/sm5803.h @@ -84,6 +84,9 @@ #define SM5803_REFERENCE_LDO3P3_PGOOD BIT(4) #define SM5803_REFERENCE_LDO5_PGOOD BIT(5) +#define SM5803_REG_CLOCK_SEL 0x2A +#define SM5803_CLOCK_SEL_LOW BIT(0) + #define SM5803_REG_GPIO0_CTRL 0x30 #define SM5803_GPIO0_VAL BIT(0) #define SM5803_GPIO0_MODE_MASK GENMASK(2, 1) @@ -121,6 +124,11 @@ enum sm5803_gpio0_modes { #define SM5803_GPADCC1_VSYS_EN BIT(6) /* NOTE: DO NOT CLEAR */ #define SM5803_GPADCC1_TINT_EN BIT(7) +#define SM5803_REG_GPADC_CONFIG2 0x02 + +#define SM5803_REG_PSYS1 0x04 +#define SM5803_PSYS1_DAC_EN BIT(0) + /* Note: Threshold registers all assume lower 2 bits are 0 */ #define SM5803_REG_VBUS_LOW_TH 0x1A #define SM5803_REG_VBUS_HIGH_TH 0x2A @@ -168,6 +176,9 @@ enum sm5803_gpio0_modes { /* Charger registers (address 0x32) */ +#define SM5803_REG_CC_CONFIG1 0x01 +#define SM5803_CC_CONFIG1_SD_PWRUP BIT(3) + #define SM5803_REG_FLOW1 0x1C #define SM5803_FLOW1_MODE GENMASK(1, 0) #define SM5803_FLOW1_DIRECTCHG_SRC_EN BIT(2) @@ -288,6 +299,7 @@ enum sm5803_charger_modes { #define SM5803_PHOT1_IBUS_PHOT_COMP_EN BIT(1) #define SM5803_PHOT1_VSYS_MON_EN BIT(2) #define SM5803_PHOT1_VBUS_MON_EN BIT(3) +#define SM5803_PHOT1_COMPARATOR_EN GENMASK(3, 0) #define SM5803_PHOT1_DURATION GENMASK(6, 4) #define SM5803_PHOT1_DURATION_SHIFT 4 #define SM5803_PHOT1_IRQ_MODE BIT(7) @@ -320,6 +332,7 @@ enum ec_error_list sm5803_get_chg_det(int chgnum, int *chg_det); enum ec_error_list sm5803_set_vbus_disch(int chgnum, int enable); enum ec_error_list sm5803_vbus_sink_enable(int chgnum, int enable); +void sm5803_hibernate(int chgnum); void sm5803_interrupt(int chgnum); extern const struct charger_drv sm5803_drv; -- cgit v1.2.1