summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiong <xiong.huang@bitland.com.cn>2019-08-22 15:10:11 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-20 10:49:58 +0000
commit4a89dc4fd185520f65b451eb09eb62675c22d514 (patch)
tree0b8933c2bea33af011fed562316930e9b250655d
parentd71c268f773fd485e4126b1ea184d7da34d9543f (diff)
downloadchrome-ec-4a89dc4fd185520f65b451eb09eb62675c22d514.tar.gz
kodama: Keep max charging voltage when remove battery
With adapter plugged in S0, the system will set charging current and voltage as 0V/0A once removing battery. Vsys drop to lower voltage (Vsys < 2.5V) since Vsys's loading, then system will shutdown. Keep max charging voltage as 4.4V when remove battery in S0 to not let the system to trigger under voltage (Vsys < 2.5V). BUG=b:138978212 BRANCH=master TEST=system will stay S0 state when remove battery Change-Id: I8356ee01826ad981e2701cd3674eb7cef87da0a9 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1763899 Reviewed-by: Yilun Lin <yllin@chromium.org>
-rw-r--r--board/kodama/battery.c30
-rw-r--r--board/kodama/board.h1
2 files changed, 29 insertions, 2 deletions
diff --git a/board/kodama/battery.c b/board/kodama/battery.c
index 28086d317b..62b0c85610 100644
--- a/board/kodama/battery.c
+++ b/board/kodama/battery.c
@@ -16,8 +16,6 @@
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-#define BAT_LEVEL_PD_LIMIT 85
-
const struct board_batt_params board_battery_info[] = {
[BATTERY_SIMPLO] = {
.fuel_gauge = {
@@ -89,6 +87,34 @@ int charger_profile_override(struct charge_state_data *curr)
mt6370_charger_profile_override(curr);
#endif /* CONFIG_CHARGER_MT6370 */
+ if (IS_ENABLED(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;
+ }
+
+ if (!curr->batt.is_present &&
+ curr->requested_voltage == 0 &&
+ curr->requested_current == 0) {
+ const struct battery_info *batt_info =
+ battery_get_info();
+
+ /*
+ * b/138978212: With adapter plugged in S0, the system
+ * will set charging current and voltage as 0V/0A once
+ * removing battery. Vsys drop to lower voltage
+ * (Vsys < 2.5V) since Vsys's loading, then system will
+ * shutdown. Keep max charging voltage as 4.4V when
+ * remove battery in S0 to not let the system to trigger
+ * under voltage (Vsys < 2.5V).
+ */
+ CPRINTS("battery disconnected");
+ curr->requested_voltage = batt_info->voltage_max;
+ curr->requested_current = 500;
+ }
+ }
+
return 0;
}
diff --git a/board/kodama/board.h b/board/kodama/board.h
index 771bf5f81e..ff71117cb9 100644
--- a/board/kodama/board.h
+++ b/board/kodama/board.h
@@ -35,6 +35,7 @@
#endif /* BOARD_KRANE */
#define CONFIG_CHARGER_MT6370_BACKLIGHT
+#define CONFIG_CHARGER_MAINTAIN_VBAT
/* Motion Sensors */
#ifdef SECTION_IS_RW