summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@chromium.org>2019-02-20 14:18:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-06 06:51:27 -0800
commit19450284dfb48c3c0677dfc4215f3206195455c8 (patch)
tree5320c6f87defb6c499e285cd7f3d1f8b0e448ec2
parent1a0d4797edbab255f46e24b6a9c0b76413adad0e (diff)
downloadchrome-ec-19450284dfb48c3c0677dfc4215f3206195455c8.tar.gz
bq25710: Disable VDPM-triggered PROCHOT by default
PROCHOT_VDPM is triggered in every AC detach when VBUS drops. Ideally we may want to check the battery voltage when PROCHOT_VDPM is triggered. If battery voltage is not too low, we clear the flag and release PROCHOT pin. However, this PROCHOT profile isn't very useful for the case of AC detach, because EC already knows AC detach event from GPIO_AC_PRESENT pin and can check battery voltage then. PROCHOT_VDPM does provide finer-grained monitoring for VBUS, but before we come up with a good use of this profile, we may want to just disable this profile to prevent PROCHOT pin from being asserted in every AC detach. So let's disable PROCHOT_VDPM at charger initialization. BUG=b:123931545 BRANCH=none TEST=boot hatch and then unplug AC, verify bq25710 doesn't assert PROCHOT Change-Id: Icbbbb5572f26a450d0df92890d99fc216564a981 Signed-off-by: Philip Chen <philipchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1479872 Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r--driver/charger/bq25710.c13
-rw-r--r--driver/charger/bq25710.h4
2 files changed, 16 insertions, 1 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index bbb05032bc..c9724b7d4c 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -142,8 +142,19 @@ static int bq25710_adc_start(int adc_en_mask)
}
#endif
-/* Charger interfaces */
+/* Disbale VDPM prochot profile at initialization */
+static void bq25710_disable_prochot_vdpm(void)
+{
+ int reg;
+ if (!raw_read16(BQ25710_REG_PROCHOT_OPTION_1, &reg)) {
+ raw_write16(BQ25710_REG_PROCHOT_OPTION_1,
+ (reg & ~BQ25710_PROCHOT_PROFILE_VDPM));
+ }
+}
+DECLARE_HOOK(HOOK_INIT, bq25710_disable_prochot_vdpm, HOOK_PRIO_INIT_I2C + 1);
+
+/* Charger interfaces */
const struct charger_info *charger_get_info(void)
{
return &bq25710_charger_info;
diff --git a/driver/charger/bq25710.h b/driver/charger/bq25710.h
index faccfdec0d..086bf13edb 100644
--- a/driver/charger/bq25710.h
+++ b/driver/charger/bq25710.h
@@ -30,6 +30,7 @@
#define BQ25710_REG_ADC_IBAT 0x24
#define BQ25710_REG_ADC_CMPIN_IIN 0x25
#define BQ25710_REG_ADC_VSYS_VBAT 0x2C
+#define BQ25710_REG_PROCHOT_OPTION_1 0x34
#define BQ25710_REG_OTG_VOLTAGE 0x3B
#define BQ25710_REG_OTG_CURRENT 0x3C
#define BQ25710_REG_INPUT_VOLTAGE 0x3D
@@ -71,4 +72,7 @@
#define BQ25710_ADC_IIN_STEP_MA 50
#define BQ25710_ADC_IIN_STEP_BIT_OFFSET 8
+/* ProchotOption1 Register */
+#define BQ25710_PROCHOT_PROFILE_VDPM (1 << 7)
+
#endif /* __CROS_EC_BQ25710_H */