summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@chromium.org>2019-01-23 18:00:35 +0000
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-23 18:20:29 +0000
commit577659c3e9c2387beea6791d40431031465488b1 (patch)
tree4216874a6e48c76b7d6357d989c9cbbe78343c3b
parent28bdcbeab0b5482d12ef7f39afa03646f1458dd2 (diff)
downloadchrome-ec-577659c3e9c2387beea6791d40431031465488b1.tar.gz
Revert "casta : add battery information"
This reverts commit 3f21cfa6e7800de7a9a0a3247fecd84e0114655c. Reason for revert: The change needs to be uploaded first to master. Also it has lots of style errors that needs some manual cleanup. Reverting this change to do the cleanup, upload it to master, get it merged in that branch and then cherry-pick it back to this branch. Original change's description: > casta : add battery information > > casta uses same battery with nautilus. > > BUG=b:122868858 > BRANCH=None > TEST=flash EC & check battery information > > Change-Id: I55894821744d242958c2dcf31da355b315d9ac8f > Signed-off-by: YongBeum Ha <ybha@samsung.com> > Reviewed-on: https://chromium-review.googlesource.com/c/1385764 > Reviewed-by: Philip Chen <philipchen@chromium.org> Bug: b:122868858 Change-Id: Ia80091841837084093bcc342eb4583a7e2b4820b Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1430952 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Trybot-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
-rw-r--r--board/casta/battery.c123
-rw-r--r--board/casta/board.c43
-rw-r--r--board/casta/board.h5
3 files changed, 3 insertions, 168 deletions
diff --git a/board/casta/battery.c b/board/casta/battery.c
index 633ca91934..6cb4fc5743 100644
--- a/board/casta/battery.c
+++ b/board/casta/battery.c
@@ -6,14 +6,9 @@
*/
#include "battery_fuel_gauge.h"
-#include "battery_smart.h"
-#include "charge_state.h"
#include "common.h"
#include "util.h"
-#define CHARGING_VOLTAGE_MV_SAFE 8400
-#define CHARGING_CURRENT_MA_SAFE 1500
-
/*
* Battery info for all casta battery types. Note that the fields
* start_charging_min/max and charging_min/max are not used for the charger.
@@ -37,122 +32,8 @@
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
- [BATTERY_SDI] = {
- .fuel_gauge = {
- .manuf_name = "SDI",
- .device_name = "4402D51",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 0,
- .reg_addr = 0x00,
- .reg_mask = 0xc000,
- .disconnect_val = 0x8000,
- }
- },
- .batt_info = {
- .voltage_max = 8700,
- .voltage_normal = 7700, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 200, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 50,
- .discharging_min_c = -20,
- .discharging_max_c = 70,
- },
- },
+ /* TODO(b/119871861): Casta: battery datasheets and specs */
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SDI;
-
-int charger_profile_override(struct charge_state_data *curr)
-{
- int current;
- int voltage;
- /* battery temp in 0.1 deg C */
- int bat_temp_c;
-
- /*
- * Keep track of battery temperature range:
- *
- * ZONE_0 ZONE_1 ZONE_2 ZONE_3
- * ---+------+--------+--------+------+--- Temperature (C)
- * 0 5 12 45 50
- */
- enum {
- TEMP_ZONE_0, /* 0 <= bat_temp_c <= 5 */
- TEMP_ZONE_1, /* 5 < bat_temp_c <= 12 */
- TEMP_ZONE_2, /* 12 < bat_temp_c <= 45 */
- TEMP_ZONE_3, /* 45 < bat_temp_c <= 50 */
- TEMP_ZONE_COUNT,
- TEMP_OUT_OF_RANGE = TEMP_ZONE_COUNT
- } temp_zone;
-
- current = curr->requested_current;
- voltage = curr->requested_voltage;
- bat_temp_c = curr->batt.temperature - 2731;
-
- /*
- * If the temperature reading is bad, assume the temperature
- * is out of allowable range.
- */
- if ((curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE) ||
- (bat_temp_c < 0) || (bat_temp_c > 500))
- temp_zone = TEMP_OUT_OF_RANGE;
- else if (bat_temp_c <= 50)
- temp_zone = TEMP_ZONE_0;
- else if (bat_temp_c <= 120)
- temp_zone = TEMP_ZONE_1;
- else if (bat_temp_c <= 450)
- temp_zone = TEMP_ZONE_2;
- else
- temp_zone = TEMP_ZONE_3;
-
- switch (temp_zone) {
- case TEMP_ZONE_0:
- voltage = CHARGING_VOLTAGE_MV_SAFE;
- current = CHARGING_CURRENT_MA_SAFE;
- break;
- case TEMP_ZONE_1:
- current = CHARGING_CURRENT_MA_SAFE;
- break;
- case TEMP_ZONE_2:
- break;
- case TEMP_ZONE_3:
- voltage = CHARGING_VOLTAGE_MV_SAFE;
- break;
- case TEMP_OUT_OF_RANGE:
- /* Don't charge if outside of allowable temperature range */
- current = 0;
- voltage = 0;
- curr->batt.flags &= ~BATT_FLAG_WANT_CHARGE;
- curr->state = ST_IDLE;
- break;
- }
-
- curr->requested_voltage = MIN(curr->requested_voltage, voltage);
- curr->requested_current = MIN(curr->requested_current, current);
-
- return 0;
-}
-
-/* Customs options controllable by host command. */
-#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0)
-
-enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
-{
- return EC_RES_INVALID_PARAM;
-}
-
-enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
-{
- return EC_RES_INVALID_PARAM;
-}
-
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_TYPE_COUNT;
diff --git a/board/casta/board.c b/board/casta/board.c
index 968f67d369..124601fa75 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -88,49 +88,6 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-/*
- * I2C callbacks to ensure bus free time for battery I2C transactions is at
- * least 5ms.
- */
-#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
-static timestamp_t battery_last_i2c_time;
-
-static int is_battery_i2c(int port, int slave_addr)
-{
- return (port == I2C_PORT_BATTERY) && (slave_addr == BATTERY_ADDR);
-}
-
-static int is_battery_port(int port)
-{
- return (port == I2C_PORT_BATTERY);
-}
-
-void i2c_start_xfer_notify(int port, int slave_addr)
-{
- unsigned int time_delta_us;
-
- if (!is_battery_i2c(port, slave_addr))
- return;
-
- time_delta_us = time_since32(battery_last_i2c_time);
- if (time_delta_us >= BATTERY_FREE_MIN_DELTA_US)
- return;
-
- usleep(BATTERY_FREE_MIN_DELTA_US - time_delta_us);
-}
-
-void i2c_end_xfer_notify(int port, int slave_addr)
-{
- /*
- * The bus free time needs to be maintained from last transaction
- * on I2C bus to any device on it to the next transaction to battery.
- */
- if (!is_battery_port(port))
- return;
-
- battery_last_i2c_time = get_time();
-}
-
void board_overcurrent_event(int port, int is_overcurrented)
{
/* Sanity check the port. */
diff --git a/board/casta/board.h b/board/casta/board.h
index 8cb98085bd..8d83af75af 100644
--- a/board/casta/board.h
+++ b/board/casta/board.h
@@ -36,9 +36,6 @@
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HOST_EVENT
-/* Battery W/A */
-#define CONFIG_I2C_XFER_BOARD_CALLBACK
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -58,8 +55,8 @@ enum temp_sensor_id {
};
/* List of possible batteries */
+/* TODO(b/119871861): Casta: battery datasheets and specs */
enum battery_type {
- BATTERY_SDI,
BATTERY_TYPE_COUNT,
};