summaryrefslogtreecommitdiff
path: root/include/config.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-01-22 11:50:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-05 23:05:39 -0800
commitd940d2a991b33b5b1ad9d6a2698ebfcdaa0f59db (patch)
tree017ac8b77a97807db600d9bbf76c2b2e324cde74 /include/config.h
parent5ef9b94d70418dd596fd81fda834e52787a24296 (diff)
downloadchrome-ec-d940d2a991b33b5b1ad9d6a2698ebfcdaa0f59db.tar.gz
common: Add support for PWM LEDs.
This commit adds support for a common framework for PWM controlled LEDs. If there are multiple LEDs, they will all follow the same pattern. The pattern is such that it follows the Chrome OS LED behaviour specification, essentially a similar version of led_policy_std.c but for PWM controlled LEDs. To use this framework, a board must do the following: - First, define the number of logical PWM LEDs which will be controlled by this common policy, CONFIG_LED_PWM_COUNT. - Then declare those logical LEDs and define the PWM channels that comprise those LEDs. (struct pwm_led pwm_leds[]). - Next, define what each color should look like (struct pwm_led led_color_map[]). By default, the colors follow the recommended colors in the LED behaviour spec, which assume an LED with a red and green channel. If a board differs or wishes to change the colors in general, they can redefine the colors (CONFIG_LED_PWM_*_COLOR) as they see fit. The colors must be one in enum ec_led_colors. These colors are the ones that can represent the charging state, SoC state, etc. BUG=b:69138917,chromium:752553 BRANCH=None TEST=make -j buildall TEST=Enable led_pwm for meowth, and verify that LEDs behave as expected. Change-Id: I945b86a7f8ed30df58d7da835d83577192548bea Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/888220 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'include/config.h')
-rw-r--r--include/config.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index b47b1e9892..243b51ca33 100644
--- a/include/config.h
+++ b/include/config.h
@@ -780,6 +780,7 @@
#define CONFIG_CMD_INA
#undef CONFIG_CMD_JUMPTAGS
#define CONFIG_CMD_KEYBOARD
+#undef CONFIG_CMD_LEDTEST
#undef CONFIG_CMD_LID_ANGLE
#undef CONFIG_CMD_MCDP
#define CONFIG_CMD_MD
@@ -1868,6 +1869,29 @@
#undef CONFIG_LED_POLICY_STD
/*
+ * Support common PWM-controlled LEDs that conform to the Chrome OS LED
+ * behaviour specification.
+ */
+#undef CONFIG_LED_PWM
+
+/*
+ * Here are some recommended color settings by default, but a board can change
+ * the colors to one of "enum ec_led_colors" as they see fit.
+ */
+#define CONFIG_LED_PWM_CHARGE_COLOR EC_LED_COLOR_AMBER
+#define CONFIG_LED_PWM_NEAR_FULL_COLOR EC_LED_COLOR_GREEN
+#define CONFIG_LED_PWM_CHARGE_ERROR_COLOR EC_LED_COLOR_RED
+#define CONFIG_LED_PWM_SOC_ON_COLOR EC_LED_COLOR_GREEN
+#define CONFIG_LED_PWM_SOC_SUSPEND_COLOR EC_LED_COLOR_GREEN
+#define CONFIG_LED_PWM_LOW_BATT_COLOR EC_LED_COLOR_AMBER
+
+/*
+ * How many PWM LEDs does the system have that will be controlled by the common
+ * PWM LED policy? Currently, this may be at most 2.
+ */
+#undef CONFIG_LED_PWM_COUNT
+
+/*
* LEDs for LED_POLICY STD may be inverted. In this case they are active low
* and the GPIO names will be GPIO_LED..._L.
*/
@@ -3267,6 +3291,11 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */
+
+#ifdef CONFIG_LED_PWM_COUNT
+#define CONFIG_LED_PWM
+#endif /* defined(CONFIG_LED_PWM_COUNT) */
+
/*****************************************************************************/
/*
* Define derived configuration options for EC-EC communication