diff options
author | Aaron Massey <aaronmassey@google.com> | 2021-10-11 15:45:50 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-27 22:53:48 +0000 |
commit | 0a9ed9b8caf31da36f44479fb2cb43021f144818 (patch) | |
tree | 95df34b3d5d3003ed86ebc88415480258e6c75af | |
parent | 94875c97c5b96e4a522f86cf7d32c48087098897 (diff) | |
download | chrome-ec-0a9ed9b8caf31da36f44479fb2cb43021f144818.tar.gz |
zephyr: emul: ln9310_emul_is_init verifies switching modes enabled
Switching 21 and 31 modes are enabled for transition during ln9310
initialization and need to be checked by ln9310_is_init() emulator
function.
BRANCH=none
BUG=b:184856083
TEST=zmake configure --test zephyr/test/drivers
Signed-off-by: Aaron Massey <aaronmassey@chromium.org>
Change-Id: Ibf190b813d43d236f162aa4f259b55ca99ac9437
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3218362
Commit-Queue: Aaron Massey <aaronmassey@google.com>
Tested-by: Aaron Massey <aaronmassey@google.com>
Reviewed-by: Yuval Peress <peress@google.com>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r-- | zephyr/emul/emul_ln9310.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/zephyr/emul/emul_ln9310.c b/zephyr/emul/emul_ln9310.c index 72d7f904ea..3e6be65591 100644 --- a/zephyr/emul/emul_ln9310.c +++ b/zephyr/emul/emul_ln9310.c @@ -216,13 +216,19 @@ void ln9310_emul_set_vin_gt_10v(const struct emul *emulator, bool is_gt_10v) bool ln9310_emul_is_init(const struct emul *emulator) { - struct ln9310_emul_data *data = emulator->data; + struct ln9310_emul_data *data = emulator->data; bool interrupts_unmasked = (data->int1_msk_reg & LN9310_INT1_MODE) == 0; bool min_switch_freq_set = (data->spare_0_reg & LN9310_SPARE_0_LB_MIN_FREQ_SEL_ON) != 0; - - return interrupts_unmasked && min_switch_freq_set; + bool functional_mode_switching_21_enabled = + (data->power_ctrl_reg & LN9310_PWR_OP_MODE_SWITCH21) != 0; + bool functional_mode_switching_31_enabled = + (data->power_ctrl_reg & LN9310_PWR_OP_MODE_SWITCH31) != 0; + + return interrupts_unmasked && min_switch_freq_set && + (functional_mode_switching_21_enabled || + functional_mode_switching_31_enabled); } enum battery_cell_type board_get_battery_cell_type(void) |