diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2016-05-26 18:26:11 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-05-28 00:08:38 -0700 |
commit | 52fdd95321cb56094498f358872400969e260f9e (patch) | |
tree | f1f716696a316c2ec0620c5ebd3e90a5517c2cdd /driver/charger | |
parent | 0c5782495d60c3980b0c6ed91a7d8f000bb8d02a (diff) | |
download | chrome-ec-52fdd95321cb56094498f358872400969e260f9e.tar.gz |
BD99955: Get the VBUS provided status from individual ports
BUG=chrome-os-partner:53786
BRANCH=none
TEST=Manually tested on Amenia. VBUS provide status is updated
properly for inividual ports.
Change-Id: I59c41988438543033db2322029169f405f347869
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347895
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver/charger')
-rw-r--r-- | driver/charger/bd99955.c | 19 | ||||
-rw-r--r-- | driver/charger/bd99955.h | 4 |
2 files changed, 16 insertions, 7 deletions
diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c index c07cf70493..6953592fb1 100644 --- a/driver/charger/bd99955.c +++ b/driver/charger/bd99955.c @@ -437,7 +437,7 @@ int charger_get_status(int *status) } /* source of power */ - if (bd99955_extpower_is_present()) + if (bd99955_is_vbus_provided(BD99955_CHARGE_PORT_BOTH)) *status |= CHARGER_AC_PRESENT; return EC_SUCCESS; @@ -550,7 +550,7 @@ static void bd99995_init(void) (bi->voltage_max + 500) & 0x7ff0, BD99955_EXTENDED_COMMAND); } -DECLARE_HOOK(HOOK_INIT, bd99995_init, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_INIT, bd99995_init, HOOK_PRIO_INIT_EXTPOWER); int charger_post_init(void) { @@ -578,7 +578,7 @@ int charger_discharge_on_ac(int enable) /*** Non-standard interface functions ***/ -int bd99955_extpower_is_present(void) +int bd99955_is_vbus_provided(int port) { int reg; @@ -586,8 +586,17 @@ int bd99955_extpower_is_present(void) BD99955_EXTENDED_COMMAND)) return 0; - reg &= (BD99955_CMD_VBUS_VCC_STATUS_VCC_DETECT | - BD99955_CMD_VBUS_VCC_STATUS_VBUS_DETECT); + if (port == BD99955_CHARGE_PORT_VBUS) + reg &= BD99955_CMD_VBUS_VCC_STATUS_VBUS_DETECT; + else if (port == BD99955_CHARGE_PORT_VCC) + reg &= BD99955_CMD_VBUS_VCC_STATUS_VCC_DETECT; + else if (port == BD99955_CHARGE_PORT_BOTH) { + /* Check VBUS on either port */ + reg &= (BD99955_CMD_VBUS_VCC_STATUS_VCC_DETECT | + BD99955_CMD_VBUS_VCC_STATUS_VBUS_DETECT); + } else + reg = 0; + return !!reg; } diff --git a/driver/charger/bd99955.h b/driver/charger/bd99955.h index 69884dce13..7deae54b09 100644 --- a/driver/charger/bd99955.h +++ b/driver/charger/bd99955.h @@ -247,8 +247,8 @@ enum bd99955_charge_port { * functionality not part of the standard charger interface. */ -/* Return true if extpower is present on their input port. */ -int bd99955_extpower_is_present(void); +/* Is VBUS provided or external power present */ +int bd99955_is_vbus_provided(int port); /* Select input port from {VCC, VBUS, VCC&VBUS, NONE}. */ int bd99955_select_input_port(enum bd99955_charge_port port); /* Enable/Disable charging triggered by BC1.2 */ |