diff options
author | Patryk Duda <pdk@semihalf.com> | 2021-03-18 13:45:17 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-29 16:29:26 +0000 |
commit | f4b27032e1c508b693bba1f2d6572ad14d42f319 (patch) | |
tree | d69d14be564e34efbb81417f9ada83122b7a3c44 /board/dratini | |
parent | 6f00183c755fe7c9e77adffb308626443e0b274a (diff) | |
download | chrome-ec-f4b27032e1c508b693bba1f2d6572ad14d42f319.tar.gz |
Use generic voltage reduce function instead of provided by board
This patch switches implementation of input voltage reduction to generic
one. It removes reduce_input_voltage_when_full() function from board
code and defines CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV
with appropriate voltage.
Affected boards:
- Ampton
- Asurada
- Cherry
- Dratini
- Jinlon
- Liara
- Nocturne
BUG=b:182546058
BRANCH=none
TEST=Compile firmware for affected boards.
TEST=Flash EC ToT on one of affected boards. Charge battery to full.
Shutdown board and check if voltage is reduced. Power on board,
check if previous voltage is restored.
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I8f285e75c11f84f4711d5e6a4008174b6fb639cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2773219
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'board/dratini')
-rw-r--r-- | board/dratini/battery.c | 24 | ||||
-rw-r--r-- | board/dratini/board.h | 2 |
2 files changed, 2 insertions, 24 deletions
diff --git a/board/dratini/battery.c b/board/dratini/battery.c index dafd0c9425..77c84cd973 100644 --- a/board/dratini/battery.c +++ b/board/dratini/battery.c @@ -96,27 +96,3 @@ const struct board_batt_params board_battery_info[] = { BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SIMPLO_COS; - -/* Lower our input voltage to 5V in S5/G3 when battery is full. */ -static void reduce_input_voltage_when_full(void) -{ - int max_pd_voltage_mv; - int port; - - if (charge_get_percent() == 100 && - chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF)) - max_pd_voltage_mv = 5000; - else - max_pd_voltage_mv = PD_MAX_VOLTAGE_MV; - - if (pd_get_max_voltage() != max_pd_voltage_mv) { - for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) - pd_set_external_voltage_limit(port, max_pd_voltage_mv); - } -} -DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, reduce_input_voltage_when_full, - HOOK_PRIO_DEFAULT); -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, reduce_input_voltage_when_full, - HOOK_PRIO_DEFAULT); -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, reduce_input_voltage_when_full, - HOOK_PRIO_DEFAULT); diff --git a/board/dratini/board.h b/board/dratini/board.h index 8f25d7362a..5878f17af1 100644 --- a/board/dratini/board.h +++ b/board/dratini/board.h @@ -33,6 +33,8 @@ #undef CONFIG_POWER_BUTTON_INIT_TIMEOUT #define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6 +#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 + /* Sensors */ /* BMI160 Base accel/gyro */ #define CONFIG_ACCEL_INTERRUPTS |