From fe3d7e9f602bc52949738ec5ecbf417e8e5bb03e Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Tue, 26 Jan 2021 15:36:03 +0100 Subject: zephyr: Add missing charger configs There are 3 battery configs missing for Zephyr: -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON Add them to the Kconfig.usbc BUG=b:177604307 BRANCH=none TEST=Build Volteer board with the configs enabled Signed-off-by: Dawid Niedzwiecki Change-Id: I0700138a74f9879caf1c6f259377a376bde45364 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648487 Reviewed-by: Keith Short Commit-Queue: Keith Short --- zephyr/Kconfig.usbc | 53 +++++++++++++++++++++++++++++++++++++++ zephyr/shim/include/config_chip.h | 24 ++++++++++++++++++ 2 files changed, 77 insertions(+) (limited to 'zephyr') diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc index cf7c6bf50b..2b31a16395 100644 --- a/zephyr/Kconfig.usbc +++ b/zephyr/Kconfig.usbc @@ -64,6 +64,59 @@ config PLATFORM_EC_CHARGER_INPUT_CURRENT chargers, this should be set to 512 mA in order to not brown-out low-current USB charge ports in accordance with USB-PD r3.0 Sec. 7.3 +menuconfig PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS + bool "Power requirements to boot AP" + default y + help + Power thresholds for AP boot. + If one of the following conditions is met, EC boots AP: + 1. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. + 2. AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON. + 3. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC + and + AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT. + +if PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS + +config PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON + int "Minimal battery level to boot AP without AC" + depends on PLATFORM_EC_BATTERY + default 3 + help + Sets the minimum battery capacity, as a percentage, needed to boot + the AP when AC power is not supplied. + +config PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC + int "Minimal battery level to boot AP with AC" + depends on PLATFORM_EC_BATTERY && PLATFORM_EC_CHARGE_MANAGER + default 1 + help + Sets the minimum battery capacity, as a percentage, needed to boot + the AP when AC power is supplied. The AC power supplied must also + be greater than CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT. + +config PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT + int "Minimal AC power to boot AP with battery" + depends on PLATFORM_EC_BATTERY && PLATFORM_EC_CHARGE_MANAGER + default 15000 + help + Sets the minimum power, in milliwatts, supplied by an external + charger required to boot the AP when the battery capacity is also + above CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC. + +config PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON + int "Minimal AC power to boot AP without battery" + depends on PLATFORM_EC_CHARGE_MANAGER + default 15000 + help + Sets the minimum power, in milliwatts, supplied by an external + charger requires to boot the AP when no battery is present or + under dead battery conditions. If the AP requires greater than + 15W to boot, check the + CONFIG_PLATFORM_EC_CHARGER_LIMIT_POWER_THRESH_CHG_MW setting. + +endif # PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS + config PLATFORM_EC_USBC_OCP bool help diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index a2e3b63d86..2716eace4e 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -312,6 +312,30 @@ enum battery_type { #define CONFIG_CHARGER_INPUT_CURRENT CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT #endif +#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON +#ifdef CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON +#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON \ + CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON +#endif + +#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC +#ifdef CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC +#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC \ + CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC +#endif + +#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT +#ifdef CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT +#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT \ + CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT +#endif + +#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON +#ifdef CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON +#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON \ + CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON +#endif + #undef CONFIG_CHARGE_RAMP_SW #ifdef CONFIG_PLATFORM_EC_CHARGE_RAMP_SW #define CONFIG_CHARGE_RAMP_SW -- cgit v1.2.1