summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajesh Kumar <rajesh3.kumar@intel.com>2022-01-12 10:54:41 -0800
committerCommit Bot <commit-bot@chromium.org>2022-01-13 20:59:09 +0000
commit0c89e6dda74f3edf70dab31d6bad53dcbb209595 (patch)
treed9f2388acc6b5b35d19fcfd7cd4ca918ede8bdbe
parentda066206428118a0402cb89633559bc7adfc7f71 (diff)
downloadchrome-ec-0c89e6dda74f3edf70dab31d6bad53dcbb209595.tar.gz
zephyr: battery: Separate battery conf from charger
Removing dependecy of PLATFORM_EC_BATTERY_FUEL_GAUGE from PLATFORM_EC_CHARGER by moving this out from 'if PLATFORM_EC_CHARGER' zephyr/shim/src/battery.c belongs to PLATFORM_EC_BATTERY, and it should be part of source if PLATFORM_EC_BATTERY conf is enabled instead of PLATFORM_EC_BATTERY_FUEL_GAUGE. BUG=none BRANCH=none TEST=zmake testall TEST=zephyr/shim/src/battery.c and common/battery_fuel_gauge.c is included in source list and compilation is successful if we enable battery without enabling charger. Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I419502281e8f22c710119a76eacf4e3bfca3a3ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3384477 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/Kconfig.battery16
-rw-r--r--zephyr/shim/include/config_chip.h6
-rw-r--r--zephyr/shim/src/CMakeLists.txt2
3 files changed, 13 insertions, 11 deletions
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 3253c39d86..e1e0d703e1 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -627,14 +627,6 @@ config PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC
external AC power supply. Its value must be known for the calculation
to be correct. The value is typically around 10 mOhms.
-config PLATFORM_EC_BATTERY_FUEL_GAUGE
- bool "Board supplies battery info"
- help
- The fuel gauge information is used to cut off the battery for shipping
- mode and to check the charge/discharge FET status. The battery
- information is used to set voltage, current and temperature operating
- limits for the battery.
-
config PLATFORM_EC_CHARGER_CHGRAMP_BROKEN
bool
help
@@ -733,6 +725,14 @@ config PLATFORM_EC_BATTERY_CUT_OFF
Once defined, a board specific board_cut_off_battery() function
has to be provided.
+config PLATFORM_EC_BATTERY_FUEL_GAUGE
+ bool "Board supplies battery info"
+ help
+ The fuel gauge information is used to cut off the battery for shipping
+ mode and to check the charge/discharge FET status. The battery
+ information is used to set voltage, current and temperature operating
+ limits for the battery.
+
config PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM
bool "Hardware check of battery presence"
help
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 0badd1e298..b43cdb3694 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -142,11 +142,13 @@
/* Battery configuration */
#undef CONFIG_BATTERY
-#undef CONFIG_BATTERY_FUEL_GAUGE
#ifdef CONFIG_PLATFORM_EC_BATTERY
#define CONFIG_BATTERY
-#define CONFIG_BATTERY_FUEL_GAUGE
+#endif /* CONFIG_PLATFORM_EC_BATTERY */
+#undef CONFIG_BATTERY_FUEL_GAUGE
+#ifdef CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE
+#define CONFIG_BATTERY_FUEL_GAUGE
#endif /* CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE */
#undef CONFIG_BATTERY_V1
diff --git a/zephyr/shim/src/CMakeLists.txt b/zephyr/shim/src/CMakeLists.txt
index 4513e32076..5347d1c41f 100644
--- a/zephyr/shim/src/CMakeLists.txt
+++ b/zephyr/shim/src/CMakeLists.txt
@@ -17,7 +17,7 @@ endif()
zephyr_library_sources_ifdef(no_libgcc libgcc_${ARCH}.S)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ADC adc.c)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY
battery.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM cbi.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_GPIO cbi.c)