diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-08-03 15:22:11 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-05 21:59:32 +0000 |
commit | 9a1048e52e7f8595b5ca092a4c2a571514338a3e (patch) | |
tree | 022a3fcb087ccc721d08b7f51fdb2e17e525a386 /common | |
parent | e42d9cb6f88b6174b1ff7c554651f5151e4158f0 (diff) | |
download | chrome-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')
-rw-r--r-- | common/charge_state_v2.c | 8 | ||||
-rw-r--r-- | common/ocpc.c | 17 |
2 files changed, 18 insertions, 7 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 1f83fbf888..4ebedce3bb 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -1666,13 +1666,7 @@ void charger_task(void *u) charge_base = -1; #endif #ifdef CONFIG_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. - */ - curr.ocpc.combined_rsys_rbatt_mo = CONFIG_OCPC_DEF_RBATT_MOHMS; - curr.ocpc.rbatt_mo = CONFIG_OCPC_DEF_RBATT_MOHMS; + ocpc_init(&curr.ocpc); charge_set_active_chg_chip(CHARGE_PORT_NONE); #endif /* CONFIG_OCPC */ 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) |