diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2013-08-09 13:48:07 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-09 13:52:10 -0700 |
commit | 432650f810f894e74572188251d2d5ddc2ad6750 (patch) | |
tree | 3aa3aa9eb25d13581ae07f16b433f2b7a6a63f49 | |
parent | c075174443291fb452541bf7ac430112aa6164ad (diff) | |
download | chrome-ec-432650f810f894e74572188251d2d5ddc2ad6750.tar.gz |
Hide battery vendor params override behind config option
Only link actually used this function, but all batteries were required
to provide an (empty) implementation. Use
CONFIG_BATTERY_VENDOR_PARAMS to gate this functionality, so non-link
battery code can be simpler.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms and pass unit tests
Original-Change-Id: Ic2c6dd1163a981e48873d798f77891cc7de1f8cf
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65257
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
(cherry picked from commit d8be5316e6920c0ef0ef85e3a3859c8a64dc6d51)
Change-Id: I31d859780a3a75773830177febef7a3ee58bf8ea
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65378
-rw-r--r-- | board/link/board.h | 1 | ||||
-rw-r--r-- | common/battery_falco.c | 6 | ||||
-rw-r--r-- | common/battery_peppy.c | 6 | ||||
-rw-r--r-- | common/battery_slippy.c | 6 | ||||
-rw-r--r-- | common/charge_state.c | 2 | ||||
-rw-r--r-- | common/mock_smart_battery_stub.c | 4 | ||||
-rw-r--r-- | include/battery_pack.h | 2 | ||||
-rw-r--r-- | include/config.h | 6 |
8 files changed, 11 insertions, 22 deletions
diff --git a/board/link/board.h b/board/link/board.h index ea6d2f1f62..a8130bddcd 100644 --- a/board/link/board.h +++ b/board/link/board.h @@ -11,6 +11,7 @@ /* Optional features */ #define CONFIG_BACKLIGHT_X86 #define CONFIG_BATTERY_SMART +#define CONFIG_BATTERY_VENDOR_PARAMS #define CONFIG_BOARD_VERSION #define CONFIG_CHARGER #define CONFIG_CHARGER_BQ24725 diff --git a/common/battery_falco.c b/common/battery_falco.c index 9a493c19d6..554e3cf7c2 100644 --- a/common/battery_falco.c +++ b/common/battery_falco.c @@ -36,12 +36,6 @@ 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) -{ -} - int battery_command_cut_off(struct host_cmd_handler_args *args) { int rv; diff --git a/common/battery_peppy.c b/common/battery_peppy.c index 76d2d04395..1bc28c71d0 100644 --- a/common/battery_peppy.c +++ b/common/battery_peppy.c @@ -38,12 +38,6 @@ 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) -{ -} - int battery_command_cut_off(struct host_cmd_handler_args *args) { return sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_MODE_DATA); diff --git a/common/battery_slippy.c b/common/battery_slippy.c index 64d5c09d1e..75a179f291 100644 --- a/common/battery_slippy.c +++ b/common/battery_slippy.c @@ -33,12 +33,6 @@ 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) -{ -} - /** * Physical detection of battery connection. */ diff --git a/common/charge_state.c b/common/charge_state.c index d7a809e735..d0b5971ca9 100644 --- a/common/charge_state.c +++ b/common/charge_state.c @@ -284,8 +284,10 @@ static int state_common(struct power_state_context *ctx) *ctx->memmap_batt_flags &= ~EC_BATT_FLAG_LEVEL_CRITICAL; } +#ifdef CONFIG_BATTERY_VENDOR_PARAMS /* Apply battery pack vendor charging method */ battery_vendor_params(batt); +#endif #ifdef CONFIG_CHARGER_CURRENT_LIMIT if (batt->desired_current > CONFIG_CHARGER_CURRENT_LIMIT) diff --git a/common/mock_smart_battery_stub.c b/common/mock_smart_battery_stub.c index 0cf7b70e78..17287cd7ad 100644 --- a/common/mock_smart_battery_stub.c +++ b/common/mock_smart_battery_stub.c @@ -118,7 +118,3 @@ const struct battery_info *battery_get_info(void) { return &bat_info; } - -void battery_vendor_params(struct batt_params *batt) -{ -} diff --git a/include/battery_pack.h b/include/battery_pack.h index 41e881afbc..9cd068478b 100644 --- a/include/battery_pack.h +++ b/include/battery_pack.h @@ -45,12 +45,14 @@ struct battery_info { */ const struct battery_info *battery_get_info(void); +#ifdef CONFIG_BATTERY_VENDOR_PARAMS /** * Modify battery parameters to match vendor charging profile. * * @param batt Battery parameters to modify */ void battery_vendor_params(struct batt_params *batt); +#endif #ifdef CONFIG_BATTERY_CHECK_CONNECTED /** diff --git a/include/config.h b/include/config.h index e028319216..647638c620 100644 --- a/include/config.h +++ b/include/config.h @@ -69,6 +69,12 @@ */ #undef CONFIG_BATTERY_SMART +/* + * Charger should call battery_vendor_params() to limit/correct the voltage and + * current requested by the battery pack before acting on the request. + */ +#undef CONFIG_BATTERY_VENDOR_PARAMS + /*****************************************************************************/ /* |