diff options
-rw-r--r-- | zephyr/Kconfig.battery | 30 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 18 |
2 files changed, 43 insertions, 5 deletions
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery index 916f731d20..3bcb88d111 100644 --- a/zephyr/Kconfig.battery +++ b/zephyr/Kconfig.battery @@ -32,6 +32,36 @@ config PLATFORM_EC_BATTERY_SMART endchoice +choice "Battery presence detection" + prompt "Method to use to detect the battery" + help + This selects the method to use to detect the presence of a battery. + + Battery detection is important since it can be used to indicate that + the case is open, so security features can be disabled. It is also + useful to report to the user when the battery is missing, e.g. with + a desktop icon. + +config PLATFORM_EC_BATTERY_PRESENT_CUSTOM + bool "Call a board-provided function" + help + Use this method to provide a board-provided battery_is_present() + function to determine whether the battery is currently present. + This should be implemented in the board code and can use any + reasonable method to detect the battery. + +config PLATFORM_EC_BATTERY_PRESENT_GPIO + bool "Check a GPIO" + help + Use this method if a GPIO signals whether the battery is present. The + GPIO should read low if the battery is present, high if absent, + + TODO: + The actual GPIO to use is not defined by this option. Perhaps this + needs to be placed in the devicetree. + +endchoice # battery presence + choice "Charger select" prompt "Select the charger to use" help diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 84f0af9b77..69b7684a75 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -34,6 +34,19 @@ #define CONFIG_BATTERY_FUEL_GAUGE #endif +#undef CONFIG_BATTERY_SMART +#ifdef CONFIG_PLATFORM_EC_BATTERY_SMART +#define CONFIG_BATTERY_SMART +#endif + +#undef CONFIG_BATTERY_PRESENT_CUSTOM +#undef CONFIG_BATTERY_PRESENT_GPIO +#ifdef CONFIG_PLATFORM_EC_BATTERY_PRESENT_CUSTOM +#define CONFIG_BATTERY_PRESENT_CUSTOM +#elif defined(PLATFORM_EC_BATTERY_PRESENT_GPIO) +#define CONFIG_BATTERY_PRESENT_GPIO +#endif /* CONFIG_PLATFORM_EC_BATTERY_PRESENT_CUSTOM */ + #undef CONFIG_CHARGER_ISL9241 #ifdef CONFIG_PLATFORM_EC_CHARGER_ISL9241 #define CONFIG_CHARGER_ISL9241 @@ -48,11 +61,6 @@ #define CONFIG_CHARGER_INPUT_CURRENT 512 #endif -#undef CONFIG_BATTERY_SMART -#ifdef CONFIG_PLATFORM_EC_BATTERY_SMART -#define CONFIG_BATTERY_SMART -#endif - /* eSPI configuration */ #ifdef CONFIG_PLATFORM_EC_ESPI |