diff options
author | Aseda Aboagye <aaboagye@google.com> | 2021-05-17 20:23:14 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-19 20:26:19 +0000 |
commit | 48c2e894a960a186a1b19b21ad270d7a2f62ed00 (patch) | |
tree | 718aa2e88b057b0eb9e9d86e5a91e10bd6ccb3f9 /driver/charger/sm5803.h | |
parent | 477dda563e0ee3bb831ebb8883cb72903bbb8141 (diff) | |
download | chrome-ec-48c2e894a960a186a1b19b21ad270d7a2f62ed00.tar.gz |
sm5803: Add sm5803_is_acok()
This commit adds a function to return whether the voltage before the
switching FETs is greater than ~4V. This would generally be the
criteria for other buck-boost chargers which have an "ACOK" signal.
BUG=b:187965740
BRANCH=dedede
TEST=With other changes, build and flash drawcia, verify that "AC on"
prints are only printed when we decide to charge from a port and not
just when VBUS is present
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: If3a5398197fb0a251b5290d107daf88e56ca12b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2901253
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/sm5803.h')
-rw-r--r-- | driver/charger/sm5803.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/driver/charger/sm5803.h b/driver/charger/sm5803.h index 79dbd55129..e1a3e10560 100644 --- a/driver/charger/sm5803.h +++ b/driver/charger/sm5803.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_SM5803_H #define __CROS_EC_SM5803_H +#include "common.h" + /* Note: configure charger struct with CHARGER_FLAGS */ #define SM5803_ADDR_MAIN_FLAGS 0x30 #define SM5803_ADDR_MEAS_FLAGS 0x31 @@ -132,6 +134,8 @@ enum sm5803_gpio0_modes { /* Note: Threshold registers all assume lower 2 bits are 0 */ #define SM5803_REG_VBUS_LOW_TH 0x1A #define SM5803_REG_VBUS_HIGH_TH 0x2A +#define SM5803_REG_VCHG_PWR_LOW_TH 0x1B +#define SM5803_REG_VCHG_PWR_HIGH_TH 0x2B #define SM5803_REG_TINT_LOW_TH 0x1D #define SM5803_REG_TINT_HIGH_TH 0x2D @@ -172,6 +176,9 @@ enum sm5803_gpio0_modes { #define SM5803_VBUS_MEAS_OV_TEMP BIT(5) #define SM5803_VBUS_MEAS_CHG_DET BIT(6) +/* VCHGPWR levels - The VCHGPWR levels increment in 23.4mV steps. */ +#define SM5803_REG_VCHG_PWR_MSB 0x4A + #define SM5803_REG_TINT_MEAS_MSB 0x4E /* VSYS levels - The VSYS levels increment in 23.4mV steps. */ @@ -382,6 +389,15 @@ enum ec_error_list sm5803_vbus_sink_enable(int chgnum, int enable); void sm5803_hibernate(int chgnum); void sm5803_interrupt(int chgnum); +/** + * Return whether ACOK is high or low. + * + * @param chgnum index into chg_chips table. + * @param acok will be set to true if ACOK is asserted, otherwise false. + * @return EC_SUCCESS, error otherwise. + */ +enum ec_error_list sm5803_is_acok(int chgnum, bool *acok); + /* Expose low power mode functions */ void sm5803_disable_low_power_mode(int chgnum); void sm5803_enable_low_power_mode(int chgnum); |