summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-09-03 17:57:08 +0200
committerCommit Bot <commit-bot@chromium.org>2021-09-08 22:36:05 +0000
commitb35f8f07daaf148ffc4039c33f2fedcc4cb42cc2 (patch)
tree1d3d7ccf9f2340e1ebe6d264d49dc9d33b5d95d7
parentf3ffccd7d0fe4d0ce60434310795a7bfdaa5274c (diff)
downloadchrome-ec-b35f8f07daaf148ffc4039c33f2fedcc4cb42cc2.tar.gz
zephyr: add missing battery Kconfigs
Add missing Kconfigs for: - PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF - PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS - PLATFORM_EC_BATTERY_MEASURE_IMBALANCE - PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV Change help text in battery yamls to use Kconfigs instead of legacy CONFIGs BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I01716c1515350550c18bbfd4944638034a25c7b5 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141598 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/Kconfig.battery32
-rw-r--r--zephyr/dts/bindings/battery/battery-fuel-gauge.yaml3
-rw-r--r--zephyr/dts/bindings/battery/battery-info.yaml16
-rw-r--r--zephyr/shim/include/config_chip.h19
4 files changed, 61 insertions, 9 deletions
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 086e2041f3..11d3957d43 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -417,6 +417,18 @@ config PLATFORM_EC_CONSOLE_CMD_CHGRAMP
OC 1: s0 oc_det0 icl0
OC 2: s0 oc_det0 icl0
+config PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
+ bool "Enable battery cut off on critical power level"
+ help
+ If this option is enabled, the battery will enter cut-off
+ mode in case of critical power level.
+
+config PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+ bool "Monitor battery temperature while charging"
+ help
+ Enable monitoring of battery temperature while charging and
+ stop charging if is outside of the safe range.
+
config PLATFORM_EC_BATTERY_CUT_OFF
bool "Host/Console command: battery cut-off"
help
@@ -442,6 +454,26 @@ config PLATFORM_EC_BATTERY_REVIVE_DISCONNECT
this state by force-applying a charge current. Once defined,
a battery_get_disconnect_state() function has to be provided.
+config PLATFORM_EC_BATTERY_MEASURE_IMBALANCE
+ bool "Measure the battery cells imbalance"
+ help
+ Smart battery driver should measure the voltage cell imbalance in the
+ battery pack.
+ This requires a battery driver capable of the measurement.
+ If enabled, the AP enabling may be prevented if battery is too
+ imbalanced.
+
+config PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV
+ int "Max battery imbalance in millivolts"
+ depends on PLATFORM_EC_BATTERY_MEASURE_IMBALANCE
+ default 200
+ help
+ Imbalanced battery packs in this situation appear to have balanced
+ charge very quickly after beginning the charging cycle, since dV/dQ
+ rapidly decreases as the cell is charged out of deep discharge.
+ Increasing the value of CHARGER_MIN_BAT_PCT_IMBALANCED_POWER_ON will
+ make a system tolerant of larger values of BATTERY_MAX_IMBALANCE_MV.
+
config PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV
int "Voltage limit in mV when battery is full and AP is off"
depends on PLATFORM_EC_USB_PE_SM && PLATFORM_EC_CHARGE_MANAGER
diff --git a/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
index 9365910aa6..2572090024 100644
--- a/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
+++ b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
@@ -78,7 +78,8 @@ properties:
type: int
imbalance_mv:
description: |
- This property is used if CONFIG_BATTERY_MEASURE_IMBALANCE is defined.
+ This property is used only if
+ CONFIG_PLATFORM_EC_BATTERY_MEASURE_IMBALANCE is enabled.
It should be an enum and its value should be a name of function
which will be assigned to imbalance_mv pointer.
type: string
diff --git a/zephyr/dts/bindings/battery/battery-info.yaml b/zephyr/dts/bindings/battery/battery-info.yaml
index b84056c266..3a4cb875e7 100644
--- a/zephyr/dts/bindings/battery/battery-info.yaml
+++ b/zephyr/dts/bindings/battery/battery-info.yaml
@@ -36,28 +36,28 @@ properties:
start_charging_min_c:
description: |
Minimum temperature of battery to start charging it.
- This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
- is defined.
+ This value is used only if
+ CONFIG_PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS is enabled.
type: int
start_charging_max_c:
description: |
Maximum temperature of battery to start charging it.
- This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
- is defined.
+ This value is used only if
+ CONFIG_PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS is enabled.
type: int
charging_min_c:
description: |
Minimum temperature of battery during charging it. If the battery
temperature falls below this value, charging will be stopped.
- This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
- is defined.
+ This value is used only if
+ CONFIG_PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS is enabled.
type: int
charging_max_c:
description: |
Maximum temperature of battery during charging it. If the battery
temperature raises above this value, charging will be stopped.
- This value is used only if CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
- is defined.
+ This value is used only if
+ CONFIG_PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS is enabled.
type: int
discharging_min_c:
description: |
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 8f39ffa790..cfd34be454 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -180,6 +180,16 @@
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BATT_PRES_ODL
#endif
+#undef CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
+#ifdef CONFIG_PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
+#define CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
+#endif
+
+#undef CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+#ifdef CONFIG_PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+#define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
+#endif
+
#undef CONFIG_BATTERY_CUT_OFF
#ifdef CONFIG_PLATFORM_EC_BATTERY_CUT_OFF
#define CONFIG_BATTERY_CUT_OFF
@@ -195,6 +205,15 @@
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#endif
+#undef CONFIG_BATTERY_MEASURE_IMBALANCE
+#ifdef CONFIG_PLATFORM_EC_BATTERY_MEASURE_IMBALANCE
+
+#define CONFIG_BATTERY_MEASURE_IMBALANCE
+#define CONFIG_BATTERY_MAX_IMBALANCE_MV \
+ CONFIG_PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV
+
+#endif
+
#undef CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV
#if defined(CONFIG_PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV) && \
(CONFIG_PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV > 0)