From 0b55308198bb0833ae99eeb71facf470daffe596 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 31 May 2016 18:16:00 -0700 Subject: bd99955: Clear IADP enable bit on init After the EC is powered, we are no longer concerned with the IADP-selected current limit, so disable IADP measurement. On some platforms, this prevents IADP from interfering with register-selected current limits. BUG=chrome-os-partner:53693 BRANCH=None TEST=Verify reef selects a new input current limit when external charger is plugged. Change-Id: I1acadc03e3c978368dc96fd478970960106c18fb Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/348520 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: David Hendricks Reviewed-by: Rachel Nancollas --- driver/charger/bd99955.c | 8 ++++++++ driver/charger/bd99955.h | 1 + 2 files changed, 9 insertions(+) (limited to 'driver') diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c index 6953592fb1..77923f5bbb 100644 --- a/driver/charger/bd99955.c +++ b/driver/charger/bd99955.c @@ -549,6 +549,14 @@ static void bd99995_init(void) ch_raw_write16(BD99955_CMD_VBATOVP_SET, (bi->voltage_max + 500) & 0x7ff0, BD99955_EXTENDED_COMMAND); + + /* Disable IADP pin current limit */ + if (ch_raw_read16(BD99955_CMD_VM_CTRL_SET, ®, + BD99955_EXTENDED_COMMAND)) + return; + reg &= ~BD99955_CMD_VM_CTRL_SET_EXTIADPEN; + ch_raw_write16(BD99955_CMD_VM_CTRL_SET, reg, + BD99955_EXTENDED_COMMAND); } DECLARE_HOOK(HOOK_INIT, bd99995_init, HOOK_PRIO_INIT_EXTPOWER); diff --git a/driver/charger/bd99955.h b/driver/charger/bd99955.h index 7deae54b09..c03c349935 100644 --- a/driver/charger/bd99955.h +++ b/driver/charger/bd99955.h @@ -183,6 +183,7 @@ enum bd99955_charge_port { #define BD99955_CMD_EXT_PROTECT_SET 0x3E #define BD99955_CMD_EXT_MAP_SET 0x3F #define BD99955_CMD_VM_CTRL_SET 0x40 +#define BD99955_CMD_VM_CTRL_SET_EXTIADPEN (1 << 9) #define BD99955_CMD_THERM_WINDOW_SET1 0x41 #define BD99955_CMD_THERM_WINDOW_SET2 0x42 #define BD99955_CMD_THERM_WINDOW_SET3 0x43 -- cgit v1.2.1