summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-03-29 20:23:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-31 01:56:32 -0700
commitf319a80975afe6f34286c9cbf115b815fa8c6416 (patch)
treecaf30de005ba8d32c7b109b82d423c6c7620b65b /driver
parent1a3851353892f7e26182e224a3a298e8f46dfa04 (diff)
downloadchrome-ec-f319a80975afe6f34286c9cbf115b815fa8c6416.tar.gz
scarlet: Enable charge termination only when battery is present
If we enable charge termination when booting w/o battery, charge termination would trigger and cut the power for max17055. BUG=b:72697658 BRANCH=scarlet TEST=Read rt946x reg 0x02, confirm charge termination is disabled when booting w/o battery, and enabled otherwise. Change-Id: I5780196ad993299ddfb37621bee5e941aa9b0d14 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/989314 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/rt946x.c10
-rw-r--r--driver/charger/rt946x.h3
2 files changed, 9 insertions, 4 deletions
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c
index 378d8f6814..7d724e68c2 100644
--- a/driver/charger/rt946x.c
+++ b/driver/charger/rt946x.c
@@ -399,10 +399,6 @@ static int rt946x_init_setting(void)
rv = rt946x_set_iprec(batt_info->precharge_current);
if (rv)
return rv;
- /* Enable charge current termination */
- rv = rt946x_set_bit(RT946X_REG_CHGCTRL2, RT946X_MASK_TE);
- if (rv)
- return rv;
return rt946x_init_irq();
}
@@ -903,3 +899,9 @@ int rt946x_cutoff_battery(void)
{
return rt946x_set_bit(RT946X_REG_CHGCTRL2, RT946X_MASK_SHIP_MODE);
}
+
+int rt946x_enable_charge_termination(int en)
+{
+ return (en ? rt946x_set_bit : rt946x_clr_bit)
+ (RT946X_REG_CHGCTRL2, RT946X_MASK_TE);
+}
diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h
index 48f9cd02e9..d597ac8aaa 100644
--- a/driver/charger/rt946x.h
+++ b/driver/charger/rt946x.h
@@ -311,4 +311,7 @@ int rt946x_is_vbus_ready(void);
*/
int rt946x_cutoff_battery(void);
+/* Enable/Disable charge temination */
+int rt946x_enable_charge_termination(int en);
+
#endif /* __CROS_EC_RT946X_H */