diff options
author | Devin Lu <Devin.Lu@quantatw.com> | 2021-10-07 10:50:54 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-05 09:57:42 +0000 |
commit | a85538462cb76ebd60ce8d7b7c00ee304856b339 (patch) | |
tree | 6f3adb624d767b3b019d94b633eb6b9187b8d40a /board/anahera | |
parent | e7b2f800b0c0c6995efbe2704f177d1ffb544ad2 (diff) | |
download | chrome-ec-a85538462cb76ebd60ce8d7b7c00ee304856b339.tar.gz |
anahera: Blinking LEDs on S0ix
There is no power LED on anahera. This patch adds a indicator to
blinking white on S0ix.
BUG=b:208912133
BRANCH=none
TEST=Blinking white LEDs on S0ix.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I392a9022b6ec0bdadd768c1c4bed777536ea1f11
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3361070
Reviewed-by: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'board/anahera')
-rw-r--r-- | board/anahera/gpio.inc | 2 | ||||
-rw-r--r-- | board/anahera/led.c | 67 |
2 files changed, 24 insertions, 45 deletions
diff --git a/board/anahera/gpio.inc b/board/anahera/gpio.inc index ceb5087bd4..9aba64311c 100644 --- a/board/anahera/gpio.inc +++ b/board/anahera/gpio.inc @@ -76,7 +76,6 @@ GPIO(C0_CHARGE_LED_AMBER_L, PIN(C, 4), GPIO_OUT_HIGH) /* Amber C0 port GPIO(C0_CHARGE_LED_WHITE_L, PIN(C, 3), GPIO_OUT_HIGH) /* White C0 port */ GPIO(C1_CHARGE_LED_AMBER_L, PIN(5, 7), GPIO_OUT_HIGH) /* Amber C1 port */ GPIO(C1_CHARGE_LED_WHITE_L, PIN(9, 4), GPIO_OUT_HIGH) /* White C1 port */ -GPIO(PWR_LED_WHITE_L, PIN(C, 2), GPIO_OUT_HIGH) /* Power LED */ /* UART alternate functions */ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */ @@ -128,6 +127,7 @@ UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */ UNUSED(PIN(9, 5)) /* GPIO95/SPIP_MISO */ UNUSED(PIN(B, 4)) /* GPIOB4/I2C0_SDA0 */ UNUSED(PIN(B, 5)) /* GPIOB5/I2C0_SCL0 */ +UNUSED(PIN(C, 2)) /* GPIOC2/PWM1/I2C6_SCL0 */ UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */ UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */ diff --git a/board/anahera/led.c b/board/anahera/led.c index c794bc8b5f..64c9ff7ba9 100644 --- a/board/anahera/led.c +++ b/board/anahera/led.c @@ -31,8 +31,7 @@ const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED, - EC_LED_ID_POWER_LED + EC_LED_ID_RIGHT_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -76,20 +75,6 @@ static void led_set_color_battery(int port, enum led_color color) } } -void led_set_color_power(enum led_color color) -{ - switch (color) { - case LED_OFF: - gpio_set_level(GPIO_PWR_LED_WHITE_L, POWER_LED_OFF); - break; - case LED_WHITE: - gpio_set_level(GPIO_PWR_LED_WHITE_L, POWER_LED_ON); - break; - default: - break; - } -} - void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { switch (led_id) { @@ -101,9 +86,6 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) brightness_range[EC_LED_COLOR_WHITE] = 1; brightness_range[EC_LED_COLOR_AMBER] = 1; break; - case EC_LED_ID_POWER_LED: - brightness_range[EC_LED_COLOR_WHITE] = 1; - break; default: break; } @@ -128,12 +110,6 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) else led_set_color_battery(RIGHT_PORT, LED_OFF); break; - case EC_LED_ID_POWER_LED: - if (brightness[EC_LED_COLOR_WHITE] != 0) - led_set_color_power(LED_WHITE); - else - led_set_color_power(LED_OFF); - break; default: return EC_ERROR_PARAM1; } @@ -160,10 +136,32 @@ static void set_active_port_color(enum led_color color) static void led_set_battery(void) { static unsigned int battery_ticks; + static unsigned int suspend_ticks; uint32_t chflags = charge_get_flags(); battery_ticks++; + /* + * Override battery LEDs for Anahera, Anahera doesn't have power LED, + * blinking both two side battery white LEDs to indicate + * system suspend without charging state. + */ + if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && + charge_get_state() != PWR_STATE_CHARGE) { + + suspend_ticks++; + + led_set_color_battery(RIGHT_PORT, (suspend_ticks % + LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? + LED_WHITE : LED_OFF); + led_set_color_battery(LEFT_PORT, (suspend_ticks % + LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? + LED_WHITE : LED_OFF); + return; + } + + suspend_ticks = 0; + switch (charge_get_state()) { case PWR_STATE_CHARGE: /* Always indicate when charging, even in suspend. */ @@ -203,22 +201,6 @@ static void led_set_battery(void) } } -static void led_set_power(void) -{ - static unsigned int power_tick; - - power_tick++; - - if (chipset_in_state(CHIPSET_STATE_ON)) - led_set_color_power(LED_WHITE); - else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) - led_set_color_power((power_tick % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_WHITE : LED_OFF); - else - led_set_color_power(LED_OFF); -} - void led_task(void *u) { uint32_t start_time; @@ -227,9 +209,6 @@ void led_task(void *u) while (1) { start_time = get_time().le.lo; - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - led_set_power(); - led_set_battery(); /* Compute time for this iteration */ |