diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-11 09:16:15 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-13 14:45:16 -0700 |
commit | 7f472114fb3c0c2cc48ec4490ec9cc3d5b41eeef (patch) | |
tree | 351a55bf057dbdad4f7fbd886feffcc668c7378a | |
parent | a7587bea86719c289ba58914c9dda36eca0acff0 (diff) | |
download | chrome-ec-7f472114fb3c0c2cc48ec4490ec9cc3d5b41eeef.tar.gz |
cleanup: Use CONFIG_BATTERY to indicate whether a board has a battery
BUG=b:35528297
BRANCH=None
TEST=`make buildall -j`
Change-Id: I9e4814b4172f20711f7edd691c9569f9130aec8e
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713395
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/samus/board.h | 1 | ||||
-rw-r--r-- | common/build.mk | 9 | ||||
-rw-r--r-- | common/ec_features.c | 5 | ||||
-rw-r--r-- | include/config.h | 14 | ||||
-rw-r--r-- | test/test_config.h | 1 | ||||
-rw-r--r-- | util/genvif.c | 4 |
6 files changed, 18 insertions, 16 deletions
diff --git a/board/samus/board.h b/board/samus/board.h index 26c06b46af..f21f8a874f 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -40,7 +40,6 @@ #define CONFIG_POWER_BUTTON_X86 /* Note: not CONFIG_BACKLIGHT_LID. It's handled specially for Samus. */ #define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BL_EN -#define CONFIG_BATTERY_SAMUS /* TODO(crosbug.com/p/29467): remove this workaround when possible. */ #define CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD #define CONFIG_CHARGER_PROFILE_OVERRIDE diff --git a/common/build.mk b/common/build.mk index 3f49de0a88..5e779a58c2 100644 --- a/common/build.mk +++ b/common/build.mk @@ -21,14 +21,7 @@ common-$(HAS_TASK_ALS)+=als.o common-$(CONFIG_AP_HANG_DETECT)+=ap_hang_detect.o common-$(CONFIG_BACKLIGHT_LID)+=backlight_lid.o common-$(CONFIG_BASE32)+=base32.o -# TODO(crosbug.com/p/23821): Why do these include battery_common but -# the other batteries don't? Perhaps should use CONFIG_CMD_BATTERY -# instead, since all that's in battery.c is the battery console -# command? -common-$(CONFIG_BATTERY_BQ27541)+=battery.o -common-$(CONFIG_BATTERY_BQ27621)+=battery.o -common-$(CONFIG_BATTERY_MAX17055)+=battery.o -common-$(CONFIG_BATTERY_SMART)+=battery.o +common-$(CONFIG_BATTERY)+=battery.o common-$(CONFIG_BLUETOOTH_LE)+=bluetooth_le.o common-$(CONFIG_BLUETOOTH_LE_STACK)+=btle_hci_controller.o btle_ll.o common-$(CONFIG_BUTTON_COUNT)+=button.o diff --git a/common/ec_features.c b/common/ec_features.c index 01d666a9dc..1340727f41 100644 --- a/common/ec_features.c +++ b/common/ec_features.c @@ -46,8 +46,7 @@ uint32_t get_feature_flags0(void) #ifdef CONFIG_TEMP_SENSOR | EC_FEATURE_MASK_0(EC_FEATURE_THERMAL) #endif -/* Hack to uniquely identify Samus ec */ -#if (defined CONFIG_BACKLIGHT_LID) || (defined CONFIG_BATTERY_SAMUS) +#if (defined CONFIG_BACKLIGHT_LID) || (defined CONFIG_BACKLIGHT_REQ_GPIO) | EC_FEATURE_MASK_0(EC_FEATURE_BKLIGHT_SWITCH) #endif #ifdef CONFIG_WIRELESS @@ -65,7 +64,7 @@ uint32_t get_feature_flags0(void) #ifdef CONFIG_CHARGER | EC_FEATURE_MASK_0(EC_FEATURE_CHARGER) #endif -#if (defined CONFIG_BATTERY) || (defined CONFIG_BATTERY_SMART) +#if (defined CONFIG_BATTERY) | EC_FEATURE_MASK_0(EC_FEATURE_BATTERY) #endif #ifdef CONFIG_BATTERY_SMART diff --git a/include/config.h b/include/config.h index 5709cfe1d2..876ff4f5e8 100644 --- a/include/config.h +++ b/include/config.h @@ -211,12 +211,14 @@ * 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. + * Defining one of these will automatically define CONFIG_BATTERY near the end + * of this file. If you add a new config here, you'll need to update that + * check. */ #undef CONFIG_BATTERY_BQ20Z453 #undef CONFIG_BATTERY_BQ27541 #undef CONFIG_BATTERY_BQ27621 #undef CONFIG_BATTERY_MAX17055 -#undef CONFIG_BATTERY_SAMUS /* Compile mock battery support; used by tests. */ #undef CONFIG_BATTERY_MOCK @@ -3051,6 +3053,16 @@ #endif /*****************************************************************************/ +/* Define CONFIG_BATTERY if board has a battery. */ +#if defined(CONFIG_BATTERY_BQ20Z453) || \ + defined(CONFIG_BATTERY_BQ27541) || \ + defined(CONFIG_BATTERY_BQ27621) || \ + defined(CONFIG_BATTERY_MAX17055) || \ + defined(CONFIG_BATTERY_SMART) +#define CONFIG_BATTERY +#endif + +/*****************************************************************************/ /* * Handle task-dependent configs. * diff --git a/test/test_config.h b/test/test_config.h index 20cca9806d..61d04c0658 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -111,6 +111,7 @@ #endif #ifdef TEST_SBS_CHARGING_V2 +#define CONFIG_BATTERY #define CONFIG_BATTERY_MOCK #define CONFIG_BATTERY_SMART #define CONFIG_CHARGER diff --git a/util/genvif.c b/util/genvif.c index f6b59bc1b6..306784a9bc 100644 --- a/util/genvif.c +++ b/util/genvif.c @@ -175,9 +175,7 @@ static char *sources_vconn(void) static char *battery_powered(void) { -#if defined(CONFIG_BATTERY_BQ20Z453) || defined(CONFIG_BATTERY_BQ27541) || \ - defined(CONFIG_BATTERY_BQ27621) || defined(CONFIG_BATTERY_SAMUS) || \ - defined(CONFIG_BATTERY_SMART) +#ifdef CONFIG_BATTERY return "YES"; #else return "NO"; |