diff options
author | Yuval Peress <peress@chromium.org> | 2021-08-31 16:29:23 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-01 16:30:46 +0000 |
commit | 3af62490f82398b38fdcb56246eca8a0461631a1 (patch) | |
tree | 20ad3f7e52c36d6a3c7e847315b03ddd5f251fc4 | |
parent | 6810cc69d0878a803c630578cd09a478d8726907 (diff) | |
download | chrome-ec-3af62490f82398b38fdcb56246eca8a0461631a1.tar.gz |
driver: ln9310: Update init function signature to return status
Return the status of the init function. This will be used in
testing to verify that initialization was correct.
BRANCH=none
BUG=b:184856083
TEST=make buildall -j
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: I578b32b24b3ee59abf646307fb9670d2db74fe3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133624
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r-- | driver/ln9310.c | 15 | ||||
-rw-r--r-- | include/driver/ln9310.h | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/driver/ln9310.c b/driver/ln9310.c index d8e2c83623..9012e70f9e 100644 --- a/driver/ln9310.c +++ b/driver/ln9310.c @@ -373,7 +373,7 @@ static int ln9310_precharge_cfly_reset(void) return status; } -void ln9310_init(void) +int ln9310_init(void) { int status, val, chip_revision; enum battery_cell_type batt; @@ -389,9 +389,9 @@ void ln9310_init(void) * should not use the software startup sequence. */ status = raw_read8(LN9310_REG_BC_STS_C, &val); - if (status) { + if (status != EC_SUCCESS) { CPRINTS("LN9310 reading BC_STS_C failed"); - return; + return status; } chip_revision = val & LN9310_BC_STS_C_CHIP_REV_MASK; startup_workaround_required = chip_revision < LN9310_BC_STS_C_CHIP_REV_FIXED; @@ -400,7 +400,7 @@ void ln9310_init(void) status = ln9310_update_infet(); if (status != EC_SUCCESS) - return; + return status; /* * Set OPERATION_MODE update method @@ -439,7 +439,7 @@ void ln9310_init(void) /* Update Startup sequence */ status = ln9310_update_startup_seq(); if (status != EC_SUCCESS) - return; + return status; } batt = board_get_battery_cell_type(); @@ -449,16 +449,17 @@ void ln9310_init(void) status = ln9310_init_2to1(); } else { CPRINTS("LN9310 not supported battery type: %d", batt); - return; + return EC_ERROR_INVAL; } if (status != EC_SUCCESS) - return; + return status; /* Unmask the MODE change interrupt */ field_update8(LN9310_REG_INT1_MSK, LN9310_INT1_MODE, 0); + return EC_SUCCESS; } void ln9310_software_enable(int enable) diff --git a/include/driver/ln9310.h b/include/driver/ln9310.h index b7954a70f3..0ae7af4c4c 100644 --- a/include/driver/ln9310.h +++ b/include/driver/ln9310.h @@ -210,8 +210,12 @@ struct ln9310_config_t { /* Configuration struct defined at board level */ extern const struct ln9310_config_t ln9310_config; -/* Init the driver */ -void ln9310_init(void); +/** + * @brief Init the driver + * + * @return EC_SUCCESS when initialization was complete. + */ +int ln9310_init(void); /* Enable/disable the ln9310 output */ void ln9310_software_enable(int enable); |