summaryrefslogtreecommitdiff
path: root/common/mock/battery_mock.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /common/mock/battery_mock.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-factory-guybrush-14600.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'common/mock/battery_mock.c')
-rw-r--r--common/mock/battery_mock.c211
1 files changed, 0 insertions, 211 deletions
diff --git a/common/mock/battery_mock.c b/common/mock/battery_mock.c
deleted file mode 100644
index 63e94c660b..0000000000
--- a/common/mock/battery_mock.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "battery.h"
-#include "string.h"
-
-/*****************************************************************************
- * Battery functions needed to enable CONFIG_BATTERY
- */
-static int battery_soc_value = 100;
-int board_get_battery_soc(void)
-{
- return battery_soc_value;
-}
-void set_battery_soc(int new_value)
-{
- battery_soc_value = new_value;
-}
-
-static int battery_status_value;
-int battery_status(int *status)
-{
- *status = battery_status_value;
- return EC_SUCCESS;
-}
-void set_battery_status(int new_value)
-{
- battery_status_value = new_value;
-}
-
-static int battery_serial_number_value;
-int battery_serial_number(int *serial)
-{
- *serial = battery_serial_number_value;
- return EC_SUCCESS;
-}
-void set_battery_serial_number(int new_value)
-{
- battery_serial_number_value = new_value;
-}
-
-static int battery_design_voltage_value = 5000;
-int battery_design_voltage(int *voltage)
-{
- *voltage = battery_design_voltage_value;
- return EC_SUCCESS;
-}
-void set_battery_design_voltage(int new_value)
-{
- battery_design_voltage_value = new_value;
-}
-
-static int battery_mode_value;
-int battery_get_mode(int *mode)
-{
- *mode = battery_mode_value;
- return EC_SUCCESS;
-}
-void set_battery_mode(int new_value)
-{
- battery_mode_value = new_value;
-}
-
-static int battery_soc_abs_value = 100;
-int battery_state_of_charge_abs(int *percent)
-{
- *percent = battery_soc_abs_value;
- return EC_SUCCESS;
-}
-void set_battery_soc_abs(int new_value)
-{
- battery_soc_abs_value = new_value;
-}
-
-static int battery_remaining_capacity_value = 100;
-int battery_remaining_capacity(int *capacity)
-{
- *capacity = battery_remaining_capacity_value;
- return EC_SUCCESS;
-}
-void set_battery_remaining_capacity(int new_value)
-{
- battery_remaining_capacity_value = new_value;
-}
-
-static int battery_full_charge_capacity_value = 100;
-int battery_full_charge_capacity(int *capacity)
-{
- *capacity = battery_full_charge_capacity_value;
- return EC_SUCCESS;
-}
-void set_battery_full_charge_capacity(int new_value)
-{
- battery_full_charge_capacity_value = new_value;
-}
-
-static int battery_design_capacity_value = 100;
-int battery_design_capacity(int *capacity)
-{
- *capacity = battery_design_capacity_value;
- return EC_SUCCESS;
-}
-void set_battery_design_capacity(int new_value)
-{
- battery_design_capacity_value = new_value;
-}
-
-static int battery_time_to_empty_value = 60;
-int battery_time_to_empty(int *minutes)
-{
- *minutes = battery_time_to_empty_value;
- return EC_SUCCESS;
-}
-void set_battery_time_to_empty(int new_value)
-{
- battery_time_to_empty_value = new_value;
-}
-
-static int battery_run_time_to_empty_value = 60;
-int battery_run_time_to_empty(int *minutes)
-{
- *minutes = battery_run_time_to_empty_value;
- return EC_SUCCESS;
-}
-void set_battery_run_time_to_empty(int new_value)
-{
- battery_run_time_to_empty_value = new_value;
-}
-
-static int battery_time_to_full_value;
-int battery_time_to_full(int *minutes)
-{
- *minutes = battery_time_to_full_value;
- return EC_SUCCESS;
-}
-void set_battery_time_to_full(int new_value)
-{
- battery_time_to_full_value = new_value;
-}
-
-#define MAX_DEVICE_NAME_LENGTH 40
-static char battery_device_name_value[MAX_DEVICE_NAME_LENGTH+1] = "?";
-int battery_device_name(char *dest, int size)
-{
- int i;
-
- for (i = 0; i < size && i < MAX_DEVICE_NAME_LENGTH; ++i)
- dest[i] = battery_device_name_value[i];
- for (; i < size; ++i)
- dest[i] = '\0';
- return EC_SUCCESS;
-}
-void set_battery_device_name(char *new_value)
-{
- int i;
- int size = strlen(new_value);
-
- for (i = 0; i < size && i < MAX_DEVICE_NAME_LENGTH; ++i)
- battery_device_name_value[i] = new_value[i];
- for (; i < MAX_DEVICE_NAME_LENGTH+1; ++i)
- battery_device_name_value[i] = '\0';
-}
-
-#define MAX_DEVICE_CHEMISTRY_LENGTH 40
-static char battery_device_chemistry_value[MAX_DEVICE_CHEMISTRY_LENGTH+1] = "?";
-int battery_device_chemistry(char *dest, int size)
-{
- int i;
-
- for (i = 0; i < size && i < MAX_DEVICE_CHEMISTRY_LENGTH; ++i)
- dest[i] = battery_device_chemistry_value[i];
- for (; i < size; ++i)
- dest[i] = '\0';
- return EC_SUCCESS;
-}
-void set_battery_device_chemistry(char *new_value)
-{
- int i;
- int size = strlen(new_value);
-
- for (i = 0; i < size && i < MAX_DEVICE_CHEMISTRY_LENGTH; ++i)
- battery_device_chemistry_value[i] = new_value[i];
- for (; i < MAX_DEVICE_CHEMISTRY_LENGTH+1; ++i)
- battery_device_chemistry_value[i] = '\0';
-}
-
-static int battery_current_value = 3000;
-static int battery_desired_current_value = 3000;
-static int battery_desired_voltage_value = 5000;
-static int battery_is_present_value = BP_YES;
-static int battery_temperature_value = 20;
-static int battery_voltage_value = 5000;
-void battery_get_params(struct batt_params *batt)
-{
- struct batt_params batt_new = {0};
-
- batt_new.temperature = battery_temperature_value;
- batt_new.state_of_charge = battery_soc_value;
- batt_new.voltage = battery_voltage_value;
- batt_new.current = battery_current_value;
- batt_new.desired_voltage = battery_desired_voltage_value;
- batt_new.desired_current = battery_desired_current_value;
- batt_new.remaining_capacity = battery_remaining_capacity_value;
- batt_new.full_capacity = battery_full_charge_capacity_value;
- batt_new.status = battery_status_value;
- batt_new.is_present = battery_is_present_value;
-
- memcpy(batt, &batt_new, sizeof(*batt));
-}