summaryrefslogtreecommitdiff
path: root/driver/charger/bd9995x.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-11-21 19:38:09 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-28 01:01:16 -0800
commit31e1ee195561f0c21ca390f5da9cb4816d668f70 (patch)
tree7b8a639d693d7d8f98f89dca20b7c211f209313b /driver/charger/bd9995x.c
parentba50aab90456504b0dc8d5f27baffd0f553dc251 (diff)
downloadchrome-ec-31e1ee195561f0c21ca390f5da9cb4816d668f70.tar.gz
reef: BD9995X: Suspend DC-DC converter when discharging on AC
When the battery is fully charged or not charging, upon removal of the AC, discharge takes long time. To overcome this issue suspend the DC-DC converter when discharging on AC. BUG=chrome-os-partner:58969 BRANCH=none TEST=Manually tested on reef. Discharge is in the permissible range. 'chgstate' console command prints correct values. Change-Id: I64afa992e50b6e18daf43edf237fde8cf658a8a2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/413153 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/bd9995x.c')
-rw-r--r--driver/charger/bd9995x.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c
index 1acd753da3..d87f9340ba 100644
--- a/driver/charger/bd9995x.c
+++ b/driver/charger/bd9995x.c
@@ -795,10 +795,18 @@ int charger_discharge_on_ac(int enable)
if (rv)
return rv;
+ /*
+ * Suspend USB charging and DC/DC converter so that BATT_LEARN mode
+ * doesn't auto exit if VBAT < VSYSVAL_THL_SET and also it helps to
+ * discharge VBUS quickly when charging is not allowed and the AC
+ * is removed.
+ */
if (enable)
- reg |= BD9995X_CMD_CHGOP_SET2_BATT_LEARN;
+ reg |= BD9995X_CMD_CHGOP_SET2_BATT_LEARN |
+ BD9995X_CMD_CHGOP_SET2_USB_SUS;
else
- reg &= ~BD9995X_CMD_CHGOP_SET2_BATT_LEARN;
+ reg &= ~(BD9995X_CMD_CHGOP_SET2_BATT_LEARN |
+ BD9995X_CMD_CHGOP_SET2_USB_SUS);
return ch_raw_write16(BD9995X_CMD_CHGOP_SET2, reg,
BD9995X_EXTENDED_COMMAND);