summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-01-05 15:24:32 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-06 23:06:06 +0000
commitf5cfb505dc2f0123fdc053c100ce634b89036f8c (patch)
tree800e6dbf1b296c7b8a7bc73becfc0aecdc86ee78 /board
parent2c29f2e7d758771d18a0ea0639778f2e4ca0867f (diff)
downloadchrome-ec-f5cfb505dc2f0123fdc053c100ce634b89036f8c.tar.gz
coil: remove charge_state_v2
This code uses coil terms we're removing, but we don't use it in platform/cr50. Remove the code instead of replacing the terms. BUG=b:175244613 TEST=make buildall -j Change-Id: I6b6004255f951497c5fc3d61e40b67433498a9d6 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613139 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/host/battery.c82
-rw-r--r--board/host/build.mk1
-rw-r--r--board/host/charger.c152
3 files changed, 0 insertions, 235 deletions
diff --git a/board/host/battery.c b/board/host/battery.c
deleted file mode 100644
index 1228485ab7..0000000000
--- a/board/host/battery.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright 2013 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.
- *
- * Smart battery driver.
- */
-
-#include "battery.h"
-#include "battery_smart.h"
-#include "common.h"
-#include "console.h"
-#include "test_util.h"
-#include "util.h"
-
-static uint16_t mock_smart_battery[SB_MANUFACTURER_DATA + 1];
-
-int sb_i2c_xfer(int port, uint16_t slave_addr_flags,
- const uint8_t *out, int out_size,
- uint8_t *in, int in_size, int flags)
-{
- if (out_size == 0)
- return EC_SUCCESS;
-
- if (port != I2C_PORT_BATTERY || slave_addr_flags != BATTERY_ADDR_FLAGS)
- return EC_ERROR_INVAL;
- if (out[0] >= ARRAY_SIZE(mock_smart_battery))
- return EC_ERROR_UNIMPLEMENTED;
- if (out_size == 1) {
- /* Read */
- if (in_size != 2)
- /* We are not doing a read16, assume read string */
- return EC_SUCCESS;
- else
- *(uint16_t *)in = mock_smart_battery[out[0]];
- } else {
- /* write */
- if (out_size != 3)
- /* We are only expecting write 16 */
- return EC_ERROR_UNIMPLEMENTED;
- else
- mock_smart_battery[out[0]] = (out[2] << 8) | out[1];
- }
- return EC_SUCCESS;
-}
-DECLARE_TEST_I2C_XFER(sb_i2c_xfer);
-
-int battery_time_at_rate(int rate, int *minutes)
-{
- return EC_SUCCESS;
-}
-
-static const struct battery_info bat_info = {
- /*
- * Design voltage
- * max = 8.4V
- * normal = 7.4V
- * min = 6.0V
- */
- .voltage_max = 8400,
- .voltage_normal = 7400,
- .voltage_min = 6000,
-
- /* Pre-charge current: I <= 0.01C */
- .precharge_current = 64, /* mA */
-
- /*
- * Operational temperature range
- * 0 <= T_charge <= 50 deg C
- * -20 <= T_discharge <= 60 deg C
- */
- .start_charging_min_c = 0,
- .start_charging_max_c = 50,
- .charging_min_c = 0,
- .charging_max_c = 50,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
-};
-
-const struct battery_info *battery_get_info(void)
-{
- return &bat_info;
-}
diff --git a/board/host/build.mk b/board/host/build.mk
index 78e4df530c..7719998eda 100644
--- a/board/host/build.mk
+++ b/board/host/build.mk
@@ -10,5 +10,4 @@ CHIP:=host
board-y=board.o
board-$(HAS_TASK_CHIPSET)+=chipset.o
-board-$(CONFIG_BATTERY_MOCK)+=battery.o charger.o
board-$(CONFIG_FANS)+=fan.o
diff --git a/board/host/charger.c b/board/host/charger.c
deleted file mode 100644
index 1dd972a82e..0000000000
--- a/board/host/charger.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Copyright 2012 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.
- *
- * Mock battery charger driver.
- */
-
-#include "battery_smart.h"
-#include "charger.h"
-#include "console.h"
-#include "common.h"
-#include "util.h"
-
-static const struct charger_info mock_charger_info = {
- .name = "MockCharger",
- .voltage_max = 19200,
- .voltage_min = 1024,
- .voltage_step = 16,
- .current_max = 8192,
- .current_min = 128,
- .current_step = 128,
- .input_current_max = 8064,
- .input_current_min = 128,
- .input_current_step = 128,
-};
-
-#define OPTION_CHARGE_INHIBIT BIT(0)
-
-static uint32_t mock_option;
-static uint32_t mock_mode;
-static uint32_t mock_current;
-static uint32_t mock_voltage;
-static uint32_t mock_input_current;
-
-const struct charger_info *charger_get_info(void)
-{
- return &mock_charger_info;
-}
-
-
-int charger_get_status(int *status)
-{
- *status = CHARGER_LEVEL_2;
- if (mock_mode & CHARGE_FLAG_INHIBIT_CHARGE)
- *status |= CHARGER_CHARGE_INHIBITED;
-
- return EC_SUCCESS;
-}
-
-
-int charger_set_mode(int mode)
-{
- if (mode & CHARGE_FLAG_INHIBIT_CHARGE)
- mock_mode |= OPTION_CHARGE_INHIBIT;
- else
- mock_mode &= ~OPTION_CHARGE_INHIBIT;
- return EC_SUCCESS;
-}
-
-
-int charger_get_current(int *current)
-{
- *current = mock_current;
- return EC_SUCCESS;
-}
-
-
-int charger_set_current(int current)
-{
- const struct charger_info *info = charger_get_info();
-
- if (current > 0 && current < info->current_min)
- current = info->current_min;
- if (current > info->current_max)
- current = info->current_max;
-
- if (mock_current != current)
- ccprintf("Charger set current: %d\n", current);
- mock_current = current;
- return EC_SUCCESS;
-}
-
-int charger_get_voltage(int *voltage)
-{
- *voltage = mock_voltage;
- return EC_SUCCESS;
-}
-
-
-int charger_set_voltage(int voltage)
-{
- mock_voltage = voltage;
- ccprintf("Charger set voltage: %d\n", voltage);
- return EC_SUCCESS;
-}
-
-
-int charger_get_option(int *option)
-{
- *option = mock_option;
- return EC_SUCCESS;
-}
-
-
-int charger_set_option(int option)
-{
- mock_option = option;
- return EC_SUCCESS;
-}
-
-
-int charger_manufacturer_id(int *id)
-{
- return EC_SUCCESS;
-}
-
-
-int charger_device_id(int *id)
-{
- return EC_SUCCESS;
-}
-
-
-int charger_get_input_current(int *input_current)
-{
- *input_current = mock_input_current;
- return EC_SUCCESS;
-}
-
-
-int charger_set_input_current(int current)
-{
- const struct charger_info *info = charger_get_info();
-
- if (current < info->input_current_min)
- current = info->input_current_min;
- if (current > info->input_current_max)
- current = info->input_current_max;
-
- if (mock_input_current != current)
- ccprintf("Charger set input current: %d\n", current);
-
- mock_input_current = current;
- return EC_SUCCESS;
-}
-
-
-int charger_post_init(void)
-{
- mock_current = mock_input_current = CONFIG_CHARGER_INPUT_CURRENT;
- return EC_SUCCESS;
-}