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>
This commit is contained in:
Shawn Nematbakhsh
2017-10-11 09:16:15 -07:00
committed by chrome-bot
parent a7587bea86
commit 7f472114fb
6 changed files with 18 additions and 16 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -3050,6 +3052,16 @@
#define CONFIG_ORIENTATION_SENSOR
#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.

View File

@@ -111,6 +111,7 @@
#endif
#ifdef TEST_SBS_CHARGING_V2
#define CONFIG_BATTERY
#define CONFIG_BATTERY_MOCK
#define CONFIG_BATTERY_SMART
#define CONFIG_CHARGER

View File

@@ -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";