summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-08-10 01:32:01 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-10 22:43:53 -0700
commit6990ea55076669d74c899d86a8fd76640016b7c1 (patch)
tree80e84c9e0955702ff1c01a4d11b496c21c9b6b5e
parent0e786a7cfe4e928bc87959a6674c6c583fc48bd0 (diff)
downloadchrome-ec-6990ea55076669d74c899d86a8fd76640016b7c1.tar.gz
atlas: fix order of LEDs to match ports
this updates the order in which LEDs are listed to match the order of the TCPCs. the charger and LED code use the same port index into the LED and TCPC tables, so we need to keep these tables in the same order. BUG=b:110505328 BRANCH=none TEST=ectool led right/left still controls the correct LED there is an implicit relationship between LEDs and USB-C ports. the ports and LEDs must be listed in the same order. Change-Id: I07c95cdd568f2d90643e1e502bd4698b334a95bf Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1170574 Commit-Ready: Caveh Jalali <caveh@google.com> Tested-by: Caveh Jalali <caveh@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/atlas/board.c2
-rw-r--r--board/atlas/led.c22
2 files changed, 16 insertions, 8 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 3724a04523..3861283a64 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -167,12 +167,14 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* TCPC mux configuration */
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
{
+ /* left port */
.i2c_host_port = I2C_PORT_TCPC0,
.i2c_slave_addr = I2C_ADDR_TCPC,
.drv = &ps8xxx_tcpm_drv,
.pol = TCPC_ALERT_ACTIVE_LOW
},
{
+ /* right port */
.i2c_host_port = I2C_PORT_TCPC1,
.i2c_slave_addr = I2C_ADDR_TCPC,
.drv = &ps8xxx_tcpm_drv,
diff --git a/board/atlas/led.c b/board/atlas/led.c
index b76c5e9a8f..b2106bd1de 100644
--- a/board/atlas/led.c
+++ b/board/atlas/led.c
@@ -28,18 +28,24 @@ struct pwm_led led_color_map[EC_LED_COLOR_COUNT] = {
[EC_LED_COLOR_AMBER] = { 65, 5, 0 },
};
-/* Two tri-color LEDs with red, green, and blue channels. */
+/*
+ * Two tri-color LEDs with red, green, and blue channels.
+ *
+ * Note: This order must match tcpc_config[]
+ */
struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = {
[PWM_LED0] = {
- PWM_CH_DB0_LED_RED,
- PWM_CH_DB0_LED_GREEN,
- PWM_CH_DB0_LED_BLUE,
- },
- [PWM_LED1] = {
+ /* left port LEDs */
PWM_CH_DB1_LED_RED,
PWM_CH_DB1_LED_GREEN,
PWM_CH_DB1_LED_BLUE,
},
+ [PWM_LED1] = {
+ /* right port LEDs */
+ PWM_CH_DB0_LED_RED,
+ PWM_CH_DB0_LED_GREEN,
+ PWM_CH_DB0_LED_BLUE,
+ },
};
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -58,9 +64,9 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
/* Convert ec_led_id to pwm_led_id. */
if (led_id == EC_LED_ID_LEFT_LED)
- pwm_id = PWM_LED1;
- else if (led_id == EC_LED_ID_RIGHT_LED)
pwm_id = PWM_LED0;
+ else if (led_id == EC_LED_ID_RIGHT_LED)
+ pwm_id = PWM_LED1;
else
return EC_ERROR_UNKNOWN;