mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
charger: Add CONFIG option to maintain VBAT voltage
On the bd9995*, back boosting may occur when actual battery voltage drops below VBAT register setting. Maintain the VBAT register at the battery-requested charge voltage even when not charging to ensure the bd9995* doesn't become a back boosted animal. BUG=chrome-os-partner:56139,chrome-os-partner:54248 BRANCH=gru TEST=Manual on kevin, unplug AC, run 'charger', verify that 'V_batt' is maintained at 8688 mV. Attach charger, verify 'V_batt' stays at 8688 mV and device charges. Change-Id: Ia0cc7f9279cb460e20a8faf332ad432067dc5482 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400087 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
a285debf1f
commit
b1014fc6bf
@@ -61,6 +61,7 @@
|
||||
#define CONFIG_CHARGER_BD99956
|
||||
#define CONFIG_BD9995X_POWER_SAVE_MODE BD9995X_PWR_SAVE_HIGH
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 512
|
||||
#define CONFIG_CHARGER_MAINTAIN_VBAT
|
||||
#define CONFIG_CHARGER_V2
|
||||
#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 2
|
||||
#define CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT 2
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 512
|
||||
#define CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT 1
|
||||
#define CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW 15000
|
||||
#define CONFIG_CHARGER_MAINTAIN_VBAT
|
||||
#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
|
||||
#define CONFIG_USB_CHARGER
|
||||
#define CONFIG_CHARGER_PROFILE_OVERRIDE
|
||||
|
||||
@@ -859,11 +859,13 @@ wait_for_it:
|
||||
}
|
||||
prev_full = is_full;
|
||||
|
||||
#ifndef CONFIG_CHARGER_MAINTAIN_VBAT
|
||||
/* Turn charger off if it's not needed */
|
||||
if (curr.state == ST_IDLE || curr.state == ST_DISCHARGE) {
|
||||
curr.requested_voltage = 0;
|
||||
curr.requested_current = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Apply external limits */
|
||||
if (curr.requested_current > user_current_limit)
|
||||
@@ -882,8 +884,10 @@ wait_for_it:
|
||||
* charging it. Thus, we only charge when AC is on and
|
||||
* battery is not cut off yet.
|
||||
*/
|
||||
if (battery_is_cut_off())
|
||||
charge_request(0, 0);
|
||||
if (battery_is_cut_off()) {
|
||||
curr.requested_voltage = 0;
|
||||
curr.requested_current = 0;
|
||||
}
|
||||
/*
|
||||
* As a safety feature, some chargers will stop
|
||||
* charging if we don't communicate with it frequently
|
||||
@@ -891,17 +895,17 @@ wait_for_it:
|
||||
* knows.
|
||||
*/
|
||||
else if (manual_mode) {
|
||||
charge_request(curr.chg.voltage,
|
||||
curr.chg.current);
|
||||
} else {
|
||||
charge_request(curr.requested_voltage,
|
||||
curr.requested_current);
|
||||
curr.requested_voltage = curr.chg.voltage;
|
||||
curr.requested_current = curr.chg.current;
|
||||
}
|
||||
} else {
|
||||
charge_request(
|
||||
charger_closest_voltage(
|
||||
curr.batt.voltage + info->voltage_step), -1);
|
||||
#ifndef CONFIG_CHARGER_MAINTAIN_VBAT
|
||||
curr.requested_voltage = charger_closest_voltage(
|
||||
curr.batt.voltage + info->voltage_step);
|
||||
curr.requested_current = -1;
|
||||
#endif
|
||||
}
|
||||
charge_request(curr.requested_voltage, curr.requested_current);
|
||||
|
||||
/* How long to sleep? */
|
||||
if (problems_exist)
|
||||
|
||||
@@ -479,6 +479,13 @@
|
||||
*/
|
||||
#undef CONFIG_CHARGER_MAX_INPUT_CURRENT
|
||||
|
||||
/*
|
||||
* Leave charger VBAT configured to battery-requested voltage under all
|
||||
* conditions, even when AC is not present. This may be necessary to work
|
||||
* around quirks of certain charger chips, such as the BD9995X.
|
||||
*/
|
||||
#undef CONFIG_CHARGER_MAINTAIN_VBAT
|
||||
|
||||
/* Minimum battery percentage for power on */
|
||||
#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
|
||||
|
||||
|
||||
Reference in New Issue
Block a user