diff options
author | Rajesh Kumar <rajesh3.kumar@intel.com> | 2021-12-07 15:00:49 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-24 01:48:42 +0000 |
commit | 2d3247f2407aa5db8c7f6c2b06b52139a102fad5 (patch) | |
tree | a4978e8be5087a610dfd46fd4183c9f2700627bd | |
parent | faf303bad5d54cc61104d1953e4aabfc21ec527c (diff) | |
download | chrome-ec-2d3247f2407aa5db8c7f6c2b06b52139a102fad5.tar.gz |
zephyr: Add Kconfig to override led color
Added kconfig to override LED color in below scenario:
1. Battery charging
2. Battery low
3. Error in charging
4. Charge state near full
5. SoC powered On
6. SoC suspended
BUG=b:200974848
BRANCH=none
TEST=zmake configure -B ~/tmp/brya/ brya -b
Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com>
Change-Id: I14e1f0ea4bfb45076b658364d4aeed7c18956bd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3321401
Reviewed-by: Parth Malkan <parthmalkan@google.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/Kconfig.led | 90 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 36 |
2 files changed, 126 insertions, 0 deletions
diff --git a/zephyr/Kconfig.led b/zephyr/Kconfig.led index 5374d039d1..6e0eeb8aa5 100644 --- a/zephyr/Kconfig.led +++ b/zephyr/Kconfig.led @@ -44,6 +44,96 @@ config PLATFORM_EC_CONSOLE_CMD_LEDTEST ledtest 0 disable +config PLATFORM_EC_LED_PWM_CHARGE_COLOR + int "Battery charging LED color" + default 5 + range 0 5 + help + Configure the color of LED when battery is charging: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + +config PLATFORM_EC_LED_PWM_CHARGE_ERROR_COLOR + int "Charging error LED color" + default 0 + range 0 5 + help + Configure the color of LED when Charging error or battery not present: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + +config PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR + int "Battery almost full LED color" + default 1 + range 0 5 + help + Configure the color of LED when charge battery is almost full: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + +config PLATFORM_EC_LED_PWM_SOC_ON_COLOR + int "AP powered on LED color" + default 1 + range 0 5 + help + Configure the color of LED when AP powered on: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + +config PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR + int "AP suspended LED color" + default 1 + range 0 5 + help + Configure the color of LED when AP suspended: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + +config PLATFORM_EC_LED_PWM_LOW_BATT_COLOR + int "Low battery LED color" + default 5 + range 0 5 + help + Configure the color of LED when battery is low: + 0 - EC_LED_COLOR_RED + 1 - EC_LED_COLOR_GREEN + 2 - EC_LED_COLOR_BLUE + 3 - EC_LED_COLOR_YELLOW + 4 - EC_LED_COLOR_WHITE + 5 - EC_LED_COLOR_AMBER + + This value is mapped directly to enum ec_led_colors. + endif # PLATFORM_EC_LED_PWM config PLATFORM_EC_LED_ONOFF_STATES diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 38f45bb2ae..64d7dec9f0 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -615,6 +615,42 @@ #define CONFIG_LED_PWM_COUNT DT_PROP_LEN(DT_INST(0, cros_ec_pwm_leds), leds) #endif +#ifdef CONFIG_PLATFORM_EC_LED_PWM_CHARGE_COLOR +#undef CONFIG_LED_PWM_CHARGE_COLOR +#define CONFIG_LED_PWM_CHARGE_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_CHARGE_COLOR +#endif + +#ifdef CONFIG_PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR +#undef CONFIG_LED_PWM_NEAR_FULL_COLOR +#define CONFIG_LED_PWM_NEAR_FULL_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR +#endif + +#ifdef CONFIG_PLATFORM_EC_LED_PWM_CHARGE_ERROR_COLOR +#undef CONFIG_LED_PWM_CHARGE_ERROR_COLOR +#define CONFIG_LED_PWM_CHARGE_ERROR_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_CHARGE_ERROR_COLOR +#endif + +#ifdef CONFIG_PLATFORM_EC_LED_PWM_SOC_ON_COLOR +#undef CONFIG_LED_PWM_SOC_ON_COLOR +#define CONFIG_LED_PWM_SOC_ON_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_SOC_ON_COLOR +#endif + +#ifdef CONFIG_PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR +#undef CONFIG_LED_PWM_SOC_SUSPEND_COLOR +#define CONFIG_LED_PWM_SOC_SUSPEND_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR +#endif + +#ifdef CONFIG_PLATFORM_EC_LED_PWM_LOW_BATT_COLOR +#undef CONFIG_LED_PWM_LOW_BATT_COLOR +#define CONFIG_LED_PWM_LOW_BATT_COLOR \ + CONFIG_PLATFORM_EC_LED_PWM_LOW_BATT_COLOR +#endif + #undef CONFIG_CMD_LEDTEST #ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_LEDTEST #define CONFIG_CMD_LEDTEST |