diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-09-22 20:02:00 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-05 12:09:39 +0000 |
commit | c7f698412abf87988d8b18ecc455a6f2ea061da1 (patch) | |
tree | 2ac1d4e16eed371741f944f2f6751d135bb4da88 /board/nocturne | |
parent | a51524b9ff16588c30d5b16716a2b8f8cc4f5592 (diff) | |
download | chrome-ec-c7f698412abf87988d8b18ecc455a6f2ea061da1.tar.gz |
CHERRY-PICK: nocturne: Update LED settings (again).
Various revisions of nocturne have had the current limiting resistors
tweaked and now one table will not suit all. This commit updates the
settings yet again for the latest revision as well as include support
for the older revisions.
BUG=b:114680136
BRANCH=firmware-nocturne-10984.B
TEST=Flash different revisions of nocturne and verify that the colors &
brightness are as expected.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1239546
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Change-Id: Ia429ee5faf7954cf74918571929d7636b9721de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2157060
Tested-by: Patryk Duda <pdk@semihalf.com>
Commit-Queue: Patryk Duda <pdk@semihalf.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/nocturne')
-rw-r--r-- | board/nocturne/board.c | 12 | ||||
-rw-r--r-- | board/nocturne/led.c | 51 |
2 files changed, 56 insertions, 7 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c index f3effb1fee..d03ac39822 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -116,17 +116,17 @@ const struct adc_t adc_channels[] = { /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ const struct pwm_t pwm_channels[] = { [PWM_CH_DB0_LED_RED] = { 3, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, [PWM_CH_DB0_LED_GREEN] = { 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, [PWM_CH_DB0_LED_BLUE] = { 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, [PWM_CH_DB1_LED_GREEN] = { 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, [PWM_CH_DB1_LED_BLUE] = { 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, - 2400 }, + 986 }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); diff --git a/board/nocturne/led.c b/board/nocturne/led.c index 7489fe7289..a569f5b49f 100644 --- a/board/nocturne/led.c +++ b/board/nocturne/led.c @@ -7,6 +7,7 @@ #include "common.h" #include "ec_commands.h" +#include "hooks.h" #include "led_pwm.h" #include "pwm.h" #include "util.h" @@ -17,7 +18,29 @@ const enum ec_led_id supported_led_ids[] = { }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); -struct pwm_led led_color_map[EC_LED_COLOR_COUNT] = { +struct pwm_led led_color_map_v3[EC_LED_COLOR_COUNT] = { + /* Red, Green, Blue */ + [EC_LED_COLOR_RED] = { 36, 0, 0 }, + [EC_LED_COLOR_GREEN] = { 0, 15, 0 }, + [EC_LED_COLOR_BLUE] = { 0, 0, 100 }, + [EC_LED_COLOR_YELLOW] = { 36, 15, 0 }, + [EC_LED_COLOR_WHITE] = { 30, 9, 15 }, + [EC_LED_COLOR_AMBER] = { 30, 1, 0 }, +}; + +/* Map for board rev 2 */ +struct pwm_led led_color_map_v2[EC_LED_COLOR_COUNT] = { + /* Red, Green, Blue */ + [EC_LED_COLOR_RED] = { 62, 0, 0 }, + [EC_LED_COLOR_GREEN] = { 0, 31, 0 }, + [EC_LED_COLOR_BLUE] = { 0, 0, 100 }, + [EC_LED_COLOR_YELLOW] = { 100, 54, 0 }, + [EC_LED_COLOR_WHITE] = { 70, 54, 100 }, + [EC_LED_COLOR_AMBER] = { 100, 15, 0 }, +}; + +/* Map for board rev 0 and 1 */ +struct pwm_led led_color_map_v0_1[EC_LED_COLOR_COUNT] = { /* Red, Green, Blue */ [EC_LED_COLOR_RED] = { 1, 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 1, 0 }, @@ -27,6 +50,8 @@ struct pwm_led led_color_map[EC_LED_COLOR_COUNT] = { [EC_LED_COLOR_AMBER] = { 15, 1, 0 }, }; +struct pwm_led led_color_map[EC_LED_COLOR_COUNT] = { { 0 } }; + /* Two tri-color LEDs with red, green, and blue channels. */ struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = { { @@ -86,3 +111,27 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) return EC_SUCCESS; } + +static void fill_led_color_map(struct pwm_led map[]) +{ + memcpy(led_color_map, map, EC_LED_COLOR_COUNT * sizeof(struct pwm_led)); +} + +static void select_color_map(void) +{ + switch (board_get_version()) { + case 0: + case 1: + fill_led_color_map(led_color_map_v0_1); + break; + + case 2: + fill_led_color_map(led_color_map_v2); + break; + + default: + fill_led_color_map(led_color_map_v3); + break; + } +} +DECLARE_HOOK(HOOK_INIT, select_color_map, HOOK_PRIO_INIT_PWM-1); |