summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-09-16 15:19:29 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-19 00:41:12 +0000
commita95e80dd47474a25a77f0a3507053848c3fa0f36 (patch)
treeba17778e7630c0207bad635c64f726cf33978693
parent6aa88ffa4e6d64a59e5c1d68439ee29d4e8193cc (diff)
downloadchrome-ec-a95e80dd47474a25a77f0a3507053848c3fa0f36.tar.gz
cleanup: move board-specific battery files to board dirs
The battery files contain board-specific constants and a few small methods like battery-detect and battery-cut. Most of these aren't reused across platforms. The battery files have also been cleaned up so those board-specific constants basically all that's left in them. Where a file is used by a single board only, move it to board/(boardname)/battery.c. Batteries used by more than one board (e.g. battery_link.c used by both link and bolt) are still in common/battery_*.c, since that's cleaner than duplicating the file in each board's directory. No code changes, just moving files. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards and pass unit tests Change-Id: I946c8eb874672c77f9b77105e5b900f98fa48d0f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169893 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/bolt/board.h1
-rw-r--r--board/falco/battery.c (renamed from common/battery_falco.c)0
-rw-r--r--board/falco/build.mk2
-rw-r--r--board/kirby/battery.c (renamed from common/battery_kirby.c)0
-rw-r--r--board/kirby/build.mk2
-rw-r--r--board/link/board.h1
-rw-r--r--board/peppy/battery.c (renamed from common/battery_peppy.c)0
-rw-r--r--board/peppy/build.mk2
-rw-r--r--board/slippy/battery.c (renamed from common/battery_slippy.c)0
-rw-r--r--board/slippy/build.mk2
-rw-r--r--board/spring/battery.c (renamed from common/battery_spring.c)0
-rw-r--r--board/spring/build.mk2
-rw-r--r--common/battery_wolf.c42
-rw-r--r--common/build.mk12
-rw-r--r--include/config.h15
15 files changed, 22 insertions, 59 deletions
diff --git a/board/bolt/board.h b/board/bolt/board.h
index 98e8c3f42f..b5751b9a36 100644
--- a/board/bolt/board.h
+++ b/board/bolt/board.h
@@ -27,6 +27,7 @@
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_WP_ACTIVE_HIGH
+#define CONFIG_BATTERY_LINK
#define CONFIG_BATTERY_SMART
#define CONFIG_BACKLIGHT_X86
#define CONFIG_CHARGER
diff --git a/common/battery_falco.c b/board/falco/battery.c
index 554e3cf7c2..554e3cf7c2 100644
--- a/common/battery_falco.c
+++ b/board/falco/battery.c
diff --git a/board/falco/build.mk b/board/falco/build.mk
index 6d1006db16..479e75aef2 100644
--- a/board/falco/build.mk
+++ b/board/falco/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o panel.o
+board-y=board.o battery.o panel.o
diff --git a/common/battery_kirby.c b/board/kirby/battery.c
index a149ba7aed..a149ba7aed 100644
--- a/common/battery_kirby.c
+++ b/board/kirby/battery.c
diff --git a/board/kirby/build.mk b/board/kirby/build.mk
index 3d89a2fca7..a02cbb0fee 100644
--- a/board/kirby/build.mk
+++ b/board/kirby/build.mk
@@ -10,4 +10,4 @@ CHIP:=stm32
CHIP_FAMILY:=stm32l
CHIP_VARIANT:=stm32l15x
-board-y=board.o
+board-y=board.o battery.o
diff --git a/board/link/board.h b/board/link/board.h
index 668736b0b1..f2de5ddfd4 100644
--- a/board/link/board.h
+++ b/board/link/board.h
@@ -10,6 +10,7 @@
/* Optional features */
#define CONFIG_BACKLIGHT_X86
+#define CONFIG_BATTERY_LINK
#define CONFIG_BATTERY_SMART
#define CONFIG_BATTERY_VENDOR_PARAMS
#define CONFIG_BOARD_VERSION
diff --git a/common/battery_peppy.c b/board/peppy/battery.c
index 59a7580bfc..59a7580bfc 100644
--- a/common/battery_peppy.c
+++ b/board/peppy/battery.c
diff --git a/board/peppy/build.mk b/board/peppy/build.mk
index 1843369ed4..b82aa39df6 100644
--- a/board/peppy/build.mk
+++ b/board/peppy/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o
+board-y=board.o battery.o
diff --git a/common/battery_slippy.c b/board/slippy/battery.c
index 75a179f291..75a179f291 100644
--- a/common/battery_slippy.c
+++ b/board/slippy/battery.c
diff --git a/board/slippy/build.mk b/board/slippy/build.mk
index 1843369ed4..b82aa39df6 100644
--- a/board/slippy/build.mk
+++ b/board/slippy/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o
+board-y=board.o battery.o
diff --git a/common/battery_spring.c b/board/spring/battery.c
index 4604671b8e..4604671b8e 100644
--- a/common/battery_spring.c
+++ b/board/spring/battery.c
diff --git a/board/spring/build.mk b/board/spring/build.mk
index 28c73da08f..6825668505 100644
--- a/board/spring/build.mk
+++ b/board/spring/build.mk
@@ -9,4 +9,4 @@ CHIP:=stm32
CHIP_FAMILY:=stm32f
CHIP_VARIANT:=stm32f100
-board-y=board.o
+board-y=board.o battery.o
diff --git a/common/battery_wolf.c b/common/battery_wolf.c
deleted file mode 100644
index 6ae9506aad..0000000000
--- a/common/battery_wolf.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (c) 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.
- *
- * Battery pack vendor provided charging profile
- */
-
-#include "battery_pack.h"
-#include "gpio.h"
-
-/* FIXME: We need REAL values for all this stuff */
-const struct battery_temperature_ranges bat_temp_ranges = {
- .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,
-};
-
-static const struct battery_info info = {
-/* Based on 3S1P, same as peppy */
-
- .voltage_max = 12600,
- .voltage_normal = 11100,
- .voltage_min = 9000,
-
- /* Pre-charge values. */
- .precharge_current = 256, /* mA */
-};
-
-const struct battery_info *battery_get_info(void)
-{
- return &info;
-}
-
-/* FIXME: The smart battery should do the right thing - that's why it's
- * called "smart". Do we really want to second-guess it? For now, let's not. */
-void battery_vendor_params(struct batt_params *batt)
-{
-}
-
diff --git a/common/build.mk b/common/build.mk
index a31d2c8588..3946396e73 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -11,19 +11,17 @@ common-y+=memory_commands.o shared_mem.o system_common.o hooks.o
common-y+=gpio_common.o version.o printf.o queue.o
common-y+=throttle_ap.o
-common-$(BOARD_bolt)+=battery_link.o
common-$(BOARD_daisy)+=extpower_snow.o
-common-$(BOARD_falco)+=battery_falco.o led_falco.o
-common-$(BOARD_kirby)+=battery_kirby.o led_kirby.o
-common-$(BOARD_link)+=battery_link.o
-common-$(BOARD_peppy)+=battery_peppy.o led_common.o led_peppy.o
-common-$(BOARD_slippy)+=battery_slippy.o led_slippy.o
+common-$(BOARD_falco)+=led_falco.o
+common-$(BOARD_kirby)+=led_kirby.o
+common-$(BOARD_peppy)+=led_common.o led_peppy.o
+common-$(BOARD_slippy)+=led_slippy.o
common-$(BOARD_snow)+=extpower_snow.o
-common-$(BOARD_spring)+=battery_spring.o
common-$(CONFIG_BACKLIGHT_X86)+=backlight_x86.o
common-$(CONFIG_BATTERY_BQ20Z453)+=battery_bq20z453.o
common-$(CONFIG_BATTERY_BQ27541)+=battery.o battery_bq27541.o
+common-$(CONFIG_BATTERY_LINK)+=battery_link.o
common-$(CONFIG_BATTERY_MOCK)+=mock_smart_battery.o mock_charger.o
common-$(CONFIG_BATTERY_SMART)+=battery.o smart_battery.o
common-$(CONFIG_CHARGER)+=charge_state.o charger_common.o
diff --git a/include/config.h b/include/config.h
index 148b5921e4..fda29dfca6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -55,11 +55,16 @@
/*****************************************************************************/
/* Battery config */
-/* Compile support for the BQ20Z453 battery used on some of the ARM laptops */
-#undef CONFIG_BATTERY_BQ20Z453
-
-/* Compile support for the BQ27541 battery */
-#undef CONFIG_BATTERY_BQ27541
+/*
+ * Compile battery-specific code. Choose at most one.
+ *
+ * Note that some boards have their own unique battery constants / functions.
+ * In this case, those are provided in board/(boardname)/battery.c, and none of
+ * these are defined.
+ */
+#undef CONFIG_BATTERY_BQ20Z453 /* BQ20Z453 battery used on some ARM laptops */
+#undef CONFIG_BATTERY_BQ27541 /* BQ27541 battery */
+#undef CONFIG_BATTERY_LINK /* Battery used on Link, Bolt, etc. */
/* Compile mock battery support; used by tests. */
#undef CONFIG_BATTERY_MOCK