diff options
author | Peter Marheine <pmarheine@chromium.org> | 2019-12-20 11:33:40 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-08 06:29:05 +0000 |
commit | 544ee3c5461b6f00115887122f4ad5a29d0ed6bc (patch) | |
tree | be114b0c8be4a89c2cd323719daea58ef586d051 /include/battery.h | |
parent | 10ef2ab040528aca0e04716a844d5db96043e145 (diff) | |
download | chrome-ec-544ee3c5461b6f00115887122f4ad5a29d0ed6bc.tar.gz |
battery: stub out battery_is_present if disabled
There are a number of potential callers that care if there is a battery,
but for boards that don't support batteries (chromeboxes) we can let
them skip implementing this stub.
Tests default to battery present, but they can provide their own
per-test implementation if desired.
Some PD battery presence checks have been disabled when battery support
is disabled; these are irrelevant when there is no battery, and they
cause linking failures because they depend on both the charge manager
and battery presence.
BUG=b:146504182
BRANCH=none
TEST=buildall
Change-Id: Ifad6a9e356c8ac2146b09bc83b359a7c55adc1a7
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1980099
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r-- | include/battery.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h index a41cd9da40..85970ea4f2 100644 --- a/include/battery.h +++ b/include/battery.h @@ -168,12 +168,23 @@ void battery_get_params(struct batt_params *batt); */ void battery_override_params(struct batt_params *batt); +#if defined(CONFIG_BATTERY) || defined(CONFIG_BATTERY_PRESENT_CUSTOM) /** * Check for presence of battery. * * @return Whether there is a battery attached or not, or if we can't tell. */ enum battery_present battery_is_present(void); +#else +/* + * If battery support is not enabled and the board does not specifically + * provide its own implementation, assume a battery is never present. + */ +static inline enum battery_present battery_is_present(void) +{ + return BP_NO; +} +#endif /** * Check for physical presence of battery. |