summaryrefslogtreecommitdiff
path: root/include/charge_state_v2.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-09-08 12:05:33 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-26 13:25:38 -0800
commite5c6f97d1a4a1fa5ad17c2bab4e316a47b8def9a (patch)
tree88986d177cc58fd4c4f039cca41bc532ccb1a418 /include/charge_state_v2.h
parentecfa69663813ec41aa79ed01c4af2f36723fe194 (diff)
downloadchrome-ec-e5c6f97d1a4a1fa5ad17c2bab4e316a47b8def9a.tar.gz
charge_state_v2: Basic dual-battery charging algorithm
First version of the algorithm, some TODOs are left in the code but this, generally, works reasonably well. When charging, we allocate input current in this general order: - Base system (fixed, low, number) - Lid system (based on PSYS) - Lid battery (estimating how much current the battery actually requires) - Base battery (similar estimation) - Provide everything else to lid When discharging, we generally: - First discharge the base battery - Then discharge the lid battery BRANCH=none BUG=b:71881017 TEST=Flash lux and wand, EC-EC communication works, adapter power is split in a sensible way, and discharging works fine. Change-Id: I8a4f87963962fc5466b2fedf1347eb4dadd35740 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/659460 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/charge_state_v2.h')
-rw-r--r--include/charge_state_v2.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index f9f5d39edf..3fc9a94181 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -6,6 +6,7 @@
#include "battery.h"
#include "battery_smart.h"
#include "charger.h"
+#include "ec_ec_comm_master.h"
#include "timer.h"
#ifndef __CROS_EC_CHARGE_STATE_V2_H
@@ -41,6 +42,9 @@ struct charge_state_data {
#ifdef CONFIG_CHARGER_OTG
int output_current;
#endif
+#ifdef CONFIG_EC_EC_COMM_BATTERY_MASTER
+ int input_voltage;
+#endif
};
/**
@@ -74,5 +78,16 @@ int charge_set_input_current_limit(int ma, int mv);
int charge_get_charge_state_debug(int param, uint32_t *value);
#endif /* CONFIG_CHARGE_STATE_DEBUG */
+/**
+ * Board-specific routine to indicate if the base is connected.
+ */
+int board_is_base_connected(void);
+
+/**
+ * Board-specific routine to enable power distribution between lid and base
+ * (current can flow both ways).
+ */
+void board_enable_base_power(int enable);
+
#endif /* __CROS_EC_CHARGE_STATE_V2_H */