From ad0ea04a5f6b373f8998207e51dd63502f3e6356 Mon Sep 17 00:00:00 2001 From: james_chao Date: Wed, 28 Jan 2015 14:33:47 +0800 Subject: charger: Implement board specific charge IC initial configure. Some board needs to set the charge ic registers when power on, such as input current, charge options, prochot options. BUG=None TEST=make buildall -j BRANCH=firmware-strago-7287.B Change-Id: I953559e71b592ea1f7e6e1cb5498d93006101b1c Signed-off-by: james_chao Reviewed-on: https://chromium-review.googlesource.com/319334 Reviewed-by: Shawn N --- common/charge_state_v2.c | 6 ++++++ include/charger.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 642d157a18..e62d08fe4b 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -606,6 +606,12 @@ void charger_task(void) else prev_ac = curr.ac; } + if (board_charger_post_init) { + rv = board_charger_post_init(); + if (rv != EC_SUCCESS) { + problem(PR_POST_INIT, rv); + } + } } else { /* Some things are only meaningful on AC */ state_machine_force_idle = 0; diff --git a/include/charger.h b/include/charger.h index d29d66ed30..a0adff25f6 100644 --- a/include/charger.h +++ b/include/charger.h @@ -55,6 +55,9 @@ void charger_get_params(struct charger_params *chg); /* Power state machine post init */ int charger_post_init(void); +/* board specific charge IC init */ +int __attribute((weak)) board_charger_post_init(void); + /* Get charger information. */ const struct charger_info *charger_get_info(void); -- cgit v1.2.1