summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreno.wang <reno.wang@lcfc.corp-partner.google.com>2021-04-13 12:18:23 +0800
committerCommit Bot <commit-bot@chromium.org>2021-04-15 02:57:33 +0000
commitdb292e684f99f520a7c6d157734f67d983955d92 (patch)
tree7c1251929ee645d4773d057dd7864529a0d4908c
parentcbe51a74f3434682638af78de4eee66c71825ead (diff)
downloadchrome-ec-db292e684f99f520a7c6d157734f67d983955d92.tar.gz
Lindar: Move to SSFC for lightbar instead of SKUID
1. Move to SSFC to check if system support lightbar instead of sku id 2. Add lightbar 12 led support and EC can base on SSFC_LIGHTBAR type to adopt different lightbar led cfg. BUG=b:183826778 BRANCH=volteer TEST=makee buildall, test SSFC_LIGHTBAR Signed-off-by: reno.wang <reno.wang@lcfc.corp-partner.google.com> Change-Id: Ic8fac16e846638c403e37261ecf15a72e805a8e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822270 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> (cherry picked from commit 0d8c3b44f787d9532818bc072980ecb49dd80c9f) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2825978 Commit-Queue: Zhuohao Lee <zhuohao@chromium.org>
-rw-r--r--board/lindar/led.c73
1 files changed, 68 insertions, 5 deletions
diff --git a/board/lindar/led.c b/board/lindar/led.c
index 8e804e63eb..0ce9f05158 100644
--- a/board/lindar/led.c
+++ b/board/lindar/led.c
@@ -5,6 +5,7 @@
* Power and battery LED control for Malefor
*/
+#include "cbi_ssfc.h"
#include "charge_state.h"
#include "common.h"
#include "cros_board_info.h"
@@ -236,6 +237,13 @@ static bool lightbar_is_supported(void)
static uint32_t skuid = SKU_ID_NONE;
bool result;
+ /* lindar add SSFC tag to cbi image from "board_id = 3". */
+ if (get_board_id() >= 3) {
+ if (get_cbi_ssfc_lightbar() == SSFC_LIGHTBAR_NONE)
+ return false;
+ return true;
+ }
+
if (skuid == SKU_ID_NONE) {
if (cbi_get_sku_id(&skuid)) {
CPRINTS("Cannot get skuid for lightbar supported");
@@ -243,7 +251,10 @@ static bool lightbar_is_supported(void)
}
}
- /* Check sku_id to know if system support lightbar or not. */
+ /*
+ * If board_id = 1 or 2, it needs to check sku_id to know
+ * if system support lightbar or not.
+ */
if (skuid >= LB_SUPPORTED_SKUID_LOWER &&
skuid <= LB_SUPPORTED_SKUID_UPPER)
result = true;
@@ -283,7 +294,7 @@ static bool lightbar_is_enabled(void)
* green color led, and green-channel to orange color led.
* Blue-channel is unused.
*
- * lightbar_ctrl setting format is as below.
+ * The configuration format of lightbar_xx_led_cfg's is as below.
* ID_DAT, STATUS_REG, CTRL_CFG
* IRED_SET0, IGRN_SET0, IBLU_SET0, IRED_SET1, IGRN_SET1, IBLU_SET1
* ISEL_A12, ISEL_A34, ISEL_B12, ISEL_B34, ISEL_C12, ISEL_C34
@@ -331,12 +342,59 @@ const uint8_t lightbar_10_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
}
};
+const uint8_t lightbar_12_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
+ [BAR_RESET] = {
+ 0x00, 0x00, DISABLE_LIGHTBAR,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
+ },
+ [BAR_OFF] = {
+ 0x00, 0x00, DISABLE_LIGHTBAR,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
+ },
+ [BAR_COLOR_ORG_20_PERCENT] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
+ },
+ [BAR_COLOR_GRN_40_PERCENT] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED, SEL_OFF, SEL_OFF
+ },
+ [BAR_COLOR_GRN_60_PERCENT] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF
+ },
+ [BAR_COLOR_GRN_80_PERCENT] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED
+ },
+ [BAR_COLOR_GRN_FULL] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
+ },
+ [BAR_COLOR_ORG_FULL] = {
+ 0x00, 0x00, ENABLE_LIGHTBAR,
+ I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
+ }
+};
+
+/*
+ * lightbar_ctrl is a pointer to 2-dimension lightbar configuration. It's used
+ * to base on DUT type to load different cfg.
+ * Default is lightbar_10_led_cfg.
+ */
+const uint8_t (*lightbar_ctrl)[KTD20XX_TOTOAL_REG] = lightbar_10_led_cfg;
+
static void lightbar_set_color(enum ec_lightbar_colors color)
{
enum ktd20xx_register i;
- const uint8_t (*lightbar_ctrl)[KTD20XX_TOTOAL_REG];
-
- lightbar_ctrl = lightbar_10_led_cfg;
if (color >= LIGHTBAR_COLOR_TOTAL) {
CPRINTS("Lightbar Error! Incorrect lightbard color %d", color);
@@ -358,6 +416,11 @@ static void lightbar_init(void)
if (!lightbar_is_enabled())
return;
+ if (get_cbi_ssfc_lightbar() == SSFC_LIGHTBAR_12_LED)
+ lightbar_ctrl = lightbar_12_led_cfg;
+ else
+ lightbar_ctrl = lightbar_10_led_cfg;
+
/* Clear this flag if system doesn't enter S0ix/S3 */
lightbar_enter_s0ix_s3 = false;
lightbar_resume_tick = 0;