summaryrefslogtreecommitdiff
path: root/common/ocpc.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-08-03 15:22:11 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-05 21:59:32 +0000
commit9a1048e52e7f8595b5ca092a4c2a571514338a3e (patch)
tree022a3fcb087ccc721d08b7f51fdb2e17e525a386 /common/ocpc.c
parente42d9cb6f88b6174b1ff7c554651f5151e4158f0 (diff)
downloadchrome-ec-9a1048e52e7f8595b5ca092a4c2a571514338a3e.tar.gz
OCPC: Add ocpc_init()
This commit adds a ocpc_init() function which will also chain off to a board specific init function as well. Currently, the init function sets up the initial resistances. The board specific init functions may set up charger specific parameters. BUG=b:147440290 BRANCH=None TEST=Enable on waddledee, build and flash and verify charging still works. Verify that initial resistances are seeded. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ia25aff9d2032746f42cbf0f7b6c5707d20362203 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2336173 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/ocpc.c')
-rw-r--r--common/ocpc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/ocpc.c b/common/ocpc.c
index c8b4d05f36..c362acb243 100644
--- a/common/ocpc.c
+++ b/common/ocpc.c
@@ -53,6 +53,10 @@ enum phase {
PHASE_CV_COMPLETE,
};
+__overridable void board_ocpc_init(struct ocpc_data *ocpc)
+{
+}
+
enum ec_error_list ocpc_calc_resistances(struct ocpc_data *ocpc,
struct batt_params *battery)
{
@@ -347,6 +351,19 @@ static void ocpc_set_pid_constants(void)
}
DECLARE_HOOK(HOOK_INIT, ocpc_set_pid_constants, HOOK_PRIO_DEFAULT);
+void ocpc_init(struct ocpc_data *ocpc)
+{
+ /*
+ * We can start off assuming that the board resistance is 0 ohms
+ * and later on, we can update this value if we charge the
+ * system in suspend or off.
+ */
+ ocpc->combined_rsys_rbatt_mo = CONFIG_OCPC_DEF_RBATT_MOHMS;
+ ocpc->rbatt_mo = CONFIG_OCPC_DEF_RBATT_MOHMS;
+
+ board_ocpc_init(ocpc);
+}
+
static int command_ocpcdebug(int argc, char **argv)
{
if (argc < 2)