summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/volteer/baseboard.c5
-rw-r--r--baseboard/volteer/led.c26
2 files changed, 27 insertions, 4 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 4f2df794cc..57abe21bb3 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -655,10 +655,7 @@ __override void board_icl_tgl_all_sys_pwrgood(void)
static void baseboard_init(void)
{
- /* Illuminate motherboard and daughter board LEDs equally.
- * TODO(b/139554899): Illuminate only the LED next to the active
- * charging port.
- */
+ /* Illuminate motherboard and daughter board LEDs equally to start. */
pwm_enable(PWM_CH_LED4_SIDESEL, 1);
pwm_set_duty(PWM_CH_LED4_SIDESEL, 50);
diff --git a/baseboard/volteer/led.c b/baseboard/volteer/led.c
index 60f3a103bb..f10e95235a 100644
--- a/baseboard/volteer/led.c
+++ b/baseboard/volteer/led.c
@@ -5,8 +5,10 @@
* Power and battery LED control for Volteer
*/
+#include "charge_manager.h"
#include "common.h"
#include "ec_commands.h"
+#include "hooks.h"
#include "led_common.h"
#include "led_pwm.h"
#include "pwm.h"
@@ -75,3 +77,27 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
return EC_SUCCESS;
}
+
+/* Illuminates the LED on the side of the active charging port. If not charging,
+ * illuminates both LEDs.
+ */
+static void led_set_charge_port_tick(void)
+{
+ int port;
+ int side_select_duty;
+
+ port = charge_manager_get_active_charge_port();
+ switch (port) {
+ case 0:
+ side_select_duty = 100;
+ break;
+ case 1:
+ side_select_duty = 0;
+ break;
+ default:
+ side_select_duty = 50;
+ }
+
+ pwm_set_duty(PWM_CH_LED4_SIDESEL, side_select_duty);
+}
+DECLARE_HOOK(HOOK_TICK, led_set_charge_port_tick, HOOK_PRIO_DEFAULT);