diff options
author | mike <mike5@huaqin.corp-partner.google.com> | 2023-04-07 19:46:24 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-11 08:26:54 +0000 |
commit | 513f2d68b8f0b83d899cd09c50fc09a8b657e853 (patch) | |
tree | 53947e035ec1b77cba2c2ea4186e6481409e59dc | |
parent | 809649832964f03910b2254cc50950409e644f4a (diff) | |
download | chrome-ec-513f2d68b8f0b83d899cd09c50fc09a8b657e853.tar.gz |
voltorb: Select 15V PDO when battery charge full.
voltorb needs set PDO=15V or higher when battery is full
to prevent battery low current leakage, and change
CONFIG_PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV to
15000mv.
BUG=b:269431836
BRANCH=corsola
TEST=1.zmake build voltorb
2. test battery no leakage after fully charged
Change-Id: I68e62f739bc1e058131e7a2d918fd6bdf0f62f29
Signed-off-by: mike <mike5@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4405804
Reviewed-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r-- | zephyr/program/corsola/voltorb/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zephyr/program/corsola/voltorb/project.conf | 3 | ||||
-rw-r--r-- | zephyr/program/corsola/voltorb/src/board.c | 41 |
3 files changed, 45 insertions, 0 deletions
diff --git a/zephyr/program/corsola/voltorb/CMakeLists.txt b/zephyr/program/corsola/voltorb/CMakeLists.txt index bcd3e753c1..82fa262bda 100644 --- a/zephyr/program/corsola/voltorb/CMakeLists.txt +++ b/zephyr/program/corsola/voltorb/CMakeLists.txt @@ -9,3 +9,4 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "../src/npcx_usb_pd_policy.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "../src/npcx_usbc.c" "./src/usbc.c") +zephyr_library_sources("src/board.c") diff --git a/zephyr/program/corsola/voltorb/project.conf b/zephyr/program/corsola/voltorb/project.conf index 5343c7f524..53e619098a 100644 --- a/zephyr/program/corsola/voltorb/project.conf +++ b/zephyr/program/corsola/voltorb/project.conf @@ -38,3 +38,6 @@ CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=65000 # AC_OK debounce time CONFIG_PLATFORM_EC_EXTPOWER_DEBOUNCE_MS=800 + +# Battery config +CONFIG_PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV=15000 diff --git a/zephyr/program/corsola/voltorb/src/board.c b/zephyr/program/corsola/voltorb/src/board.c new file mode 100644 index 0000000000..d1d7f0350e --- /dev/null +++ b/zephyr/program/corsola/voltorb/src/board.c @@ -0,0 +1,41 @@ +/* Copyright 2023 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "charge_state.h" +#include "common.h" +#include "dps.h" +#include "math_util.h" + +#include <zephyr/logging/log.h> + +#include <dt-bindings/battery.h> + +LOG_MODULE_REGISTER(board_init, LOG_LEVEL_ERR); + +bool voltorb_is_more_efficient(int curr_mv, int prev_mv, int batt_mv, + int batt_mw, int input_mw) +{ + int batt_state; + + battery_status(&batt_state); + + /* Choose 15V PDO or higher when battery is full. */ + if ((batt_state & SB_STATUS_FULLY_CHARGED) && (curr_mv >= 15000) && + (prev_mv < 15000 || curr_mv <= prev_mv)) { + return true; + } else { + return ABS(curr_mv - batt_mv) < ABS(prev_mv - batt_mv); + } +} + +__override struct dps_config_t dps_config = { + .k_less_pwr = 93, + .k_more_pwr = 96, + .k_sample = 1, + .k_window = 3, + .t_stable = 10 * SECOND, + .t_check = 5 * SECOND, + .is_more_efficient = &voltorb_is_more_efficient, +}; |