summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-04-13 12:31:28 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-13 18:37:18 -0700
commit013a47740dd0ca9f77c448ad862bbe0041a416e2 (patch)
tree876ecb2876994a1944d39805e21288bc83294fd1 /driver
parentf2ea8d729d914599e53bab27f6e83cb88ff69984 (diff)
downloadchrome-ec-013a47740dd0ca9f77c448ad862bbe0041a416e2.tar.gz
Driver: BD99955: Add code to enable both VBUS_EN & VCC_EN for PG3
In Pseudo G3 if both VBUS_EN & VCC_EN are disabled, on plugging the AC on either of the ports, ACOK pin is not asserted because the charger cannot detect the voltage on either of the ports. Hence the device cannot boot until the power button is pressed. Enable both the VBUS_EN & VCC_EN before entering pseudo G3 at the board level functions so that the board can boot to S0 on plugging the AC on either of the ports. BUG=none BRANCH=none TEST=Manually tested on Amenia. Enter PG3, plug in the AC, charger ACOK is asserted and the device boots to S0. Change-Id: Idbae2306948a470592219edfe475dc9b45c1df58 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/338825 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')
-rw-r--r--driver/charger/bd99955.c16
-rw-r--r--driver/charger/bd99955.h3
2 files changed, 9 insertions, 10 deletions
diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c
index e2d968c7f6..713a90be1c 100644
--- a/driver/charger/bd99955.c
+++ b/driver/charger/bd99955.c
@@ -285,14 +285,8 @@ int charger_get_status(int *status)
int charger_set_mode(int mode)
{
int rv;
- int enable;
- if (mode & CHARGE_FLAG_INHIBIT_CHARGE)
- enable = 0;
- else
- enable = 1;
-
- rv = bd99955_charger_enable(enable);
+ rv = bd99955_charger_enable(mode & CHARGE_FLAG_INHIBIT_CHARGE ? 0 : 1);
if (rv)
return rv;
@@ -435,13 +429,17 @@ int bd99955_select_input_port(enum bd99955_charge_port port)
if (port == BD99955_CHARGE_PORT_NONE) {
reg &= ~(BD99955_CMD_VIN_CTRL_SET_VBUS_EN |
- BD99955_CMD_VIN_CTRL_SET_VBUS_EN);
+ BD99955_CMD_VIN_CTRL_SET_VCC_EN);
} else if (port == BD99955_CHARGE_PORT_VBUS) {
reg |= BD99955_CMD_VIN_CTRL_SET_VBUS_EN;
reg &= ~BD99955_CMD_VIN_CTRL_SET_VCC_EN;
} else if (port == BD99955_CHARGE_PORT_VCC) {
reg |= BD99955_CMD_VIN_CTRL_SET_VCC_EN;
reg &= ~BD99955_CMD_VIN_CTRL_SET_VBUS_EN;
+ } else if (port == BD99955_CHARGE_PORT_BOTH) {
+ /* Enable both the ports for PG3 */
+ reg |= BD99955_CMD_VIN_CTRL_SET_VBUS_EN |
+ BD99955_CMD_VIN_CTRL_SET_VCC_EN;
} else {
/* Invalid charge port */
panic("Invalid charge port");
@@ -500,7 +498,7 @@ static int console_command_bd99955(int argc, char **argv)
rw = argv[1][0];
if (rw == 'w' && argc < 5)
- return EC_ERROR_PARAM_COUNT;
+ return EC_ERROR_PARAM_COUNT;
else if (rw != 'w' && rw != 'r')
return EC_ERROR_PARAM1;
diff --git a/driver/charger/bd99955.h b/driver/charger/bd99955.h
index cd9bfdfff5..0f3e4aa48d 100644
--- a/driver/charger/bd99955.h
+++ b/driver/charger/bd99955.h
@@ -22,6 +22,7 @@ enum bd99955_command {
enum bd99955_charge_port {
BD99955_CHARGE_PORT_VBUS,
BD99955_CHARGE_PORT_VCC,
+ BD99955_CHARGE_PORT_BOTH,
BD99955_CHARGE_PORT_NONE,
};
@@ -210,7 +211,7 @@ enum bd99955_charge_port {
/* Return true if extpower is present on their input port. */
int bd99955_extpower_is_present(void);
-/* Select input port from {VCC, VBUS, NONE}. */
+/* Select input port from {VCC, VBUS, VCC&VBUS, NONE}. */
int bd99955_select_input_port(enum bd99955_charge_port port);
#endif /* __CROS_EC_BD99955_H */