diff options
author | wuzhongtian <wuzhongtian@huaqin.corp-partner.google.com> | 2021-09-09 20:27:51 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-23 03:11:46 +0000 |
commit | 21a2d516bf80e006b738ffb9401b388945ee5086 (patch) | |
tree | e85191195e214fb5ace584d7506e96e2b14ca572 | |
parent | 7537986533dec6db5d903dde935a566f14b6035a (diff) | |
download | chrome-ec-21a2d516bf80e006b738ffb9401b388945ee5086.tar.gz |
Blipper: Add beetley related configuration
Add the relevant configuration of beetley to the blipper ec code
BUG=b:199479277
BRANCH=dedede
TEST=make BOARD=blipper pass,and we have done some tests on the modified
Blipper device,the basic functions are normal.
Signed-off-by: wuzhongtian <wuzhongtian@huaqin.corp-partner.google.com>
Change-Id: Ie6e246755779201faa12f6f48670b018b816351f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3151049
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Shou-Chieh Hsu <shouchieh@chromium.org>
Tested-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Commit-Queue: Shou-Chieh Hsu <shouchieh@chromium.org>
-rw-r--r-- | board/blipper/board.c | 155 | ||||
-rw-r--r-- | board/blipper/board.h | 42 | ||||
-rw-r--r-- | board/blipper/ec.tasklist | 1 | ||||
-rw-r--r-- | board/blipper/gpio.inc | 20 | ||||
-rw-r--r-- | board/blipper/led.c | 57 |
5 files changed, 251 insertions, 24 deletions
diff --git a/board/blipper/board.c b/board/blipper/board.c index 480ca5c6da..2ca56a1b51 100644 --- a/board/blipper/board.c +++ b/board/blipper/board.c @@ -7,10 +7,14 @@ #include "adc_chip.h" #include "button.h" +#include "cbi_fw_config.h" #include "cros_board_info.h" +#include "cbi_ssfc.h" #include "charge_manager.h" #include "charge_state_v2.h" #include "charger.h" +#include "driver/accel_lis2dw12.h" +#include "driver/accelgyro_lsm6dsm.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" #include "driver/temp_sensor/thermistor.h" @@ -29,6 +33,7 @@ #include "pwm_chip.h" #include "switch.h" #include "system.h" +#include "tablet_mode.h" #include "task.h" #include "tcpm/tcpci.h" #include "temp_sensor.h" @@ -211,6 +216,100 @@ const int usb_port_enable[USB_PORT_COUNT] = { static uint32_t board_id; +/* Sensors */ +static struct mutex g_lid_mutex; +static struct mutex g_base_mutex; + +/* Matrices to rotate accelerometers into the standard reference. */ +static const mat33_fp_t lid_lis2dwl_ref = { + { 0, FLOAT_TO_FP(1), 0}, + { FLOAT_TO_FP(1), 0, 0}, + { 0, 0, FLOAT_TO_FP(-1)} +}; + +static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; + +/* Lid accel private data */ +static struct stprivate_data g_lis2dwl_data; +struct motion_sensor_t motion_sensors[] = { + [LID_ACCEL] = { + .name = "Lid Accel", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_LIS2DWL, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_LID, + .drv = &lis2dw12_drv, + .mutex = &g_lid_mutex, + .drv_data = &g_lis2dwl_data, + .port = I2C_PORT_SENSOR, + .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS, + .rot_standard_ref = &lid_lis2dwl_ref, + .default_range = 2, /* g */ + .min_frequency = LIS2DW12_ODR_MIN_VAL, + .max_frequency = LIS2DW12_ODR_MAX_VAL, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 12500 | ROUND_UP_FLAG, + }, + /* Sensor on for lid angle detection */ + [SENSOR_CONFIG_EC_S3] = { + .odr = 10000 | ROUND_UP_FLAG, + }, + }, + }, + [BASE_ACCEL] = { + .name = "Base Accel", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_LSM6DS3, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_BASE, + .drv = &lsm6dsm_drv, + .mutex = &g_base_mutex, + .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, + MOTIONSENSE_TYPE_ACCEL), + .int_signal = GPIO_BASE_SIXAXIS_INT_L, + .flags = MOTIONSENSE_FLAG_INT_SIGNAL, + .port = I2C_PORT_SENSOR, + .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, + .rot_standard_ref = NULL, /* identity matrix */ + .default_range = 4, /* g */ + .min_frequency = LSM6DSM_ODR_MIN_VAL, + .max_frequency = LSM6DSM_ODR_MAX_VAL, + .config = { + [SENSOR_CONFIG_EC_S0] = { + .odr = 13000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + [SENSOR_CONFIG_EC_S3] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + }, + }, + [BASE_GYRO] = { + .name = "Base Gyro", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_LSM6DS3, + .type = MOTIONSENSE_TYPE_GYRO, + .location = MOTIONSENSE_LOC_BASE, + .drv = &lsm6dsm_drv, + .mutex = &g_base_mutex, + .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, + MOTIONSENSE_TYPE_GYRO), + .int_signal = GPIO_BASE_SIXAXIS_INT_L, + .flags = MOTIONSENSE_FLAG_INT_SIGNAL, + .port = I2C_PORT_SENSOR, + .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, + .default_range = 1000 | ROUND_UP_FLAG, /* dps */ + .rot_standard_ref = NULL, /* identity matrix */ + .min_frequency = LSM6DSM_ODR_MIN_VAL, + .max_frequency = LSM6DSM_ODR_MAX_VAL, + }, +}; + +unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); + void board_init(void) { gpio_enable_interrupt(GPIO_USB_C0_INT_ODL); @@ -221,6 +320,11 @@ void board_init(void) /* Set LEDs luminance */ pwm_set_duty(PWM_CH_LED_RED, 70); pwm_set_duty(PWM_CH_LED_GREEN, 70); + pwm_set_duty(PWM_CH_LED_WHITE, 70); + + /* Enable Base Accel interrupt for Beetley */ + if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_PRESENT) + gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); /* * If interrupt lines are already low, schedule them to be processed @@ -236,6 +340,25 @@ void board_init(void) keyscan_config.actual_key_mask[14] = 0xff; cbi_get_board_version(&board_id); + + if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) { + motion_sensor_count = 0; + gmr_tablet_switch_disable(); + /* + * Base accel is not stuffed, don't allow + * line to float. + */ + gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, + GPIO_INPUT | GPIO_PULL_DOWN); + + gpio_set_flags(GPIO_VOLDN_BTN_ODL, + GPIO_INPUT | GPIO_PULL_DOWN); + + gpio_set_flags(GPIO_VOLUP_BTN_ODL, + GPIO_INPUT | GPIO_PULL_DOWN); + + } + } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -377,6 +500,12 @@ const struct pwm_t pwm_channels[] = { .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW, .freq_hz = 2400, }, + + [PWM_CH_LED_WHITE] = { + .channel = 3, + .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW, + .freq_hz = 2400, + }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); @@ -396,3 +525,29 @@ const struct temp_sensor_t temp_sensors[] = { .idx = ADC_TEMP_SENSOR_3}, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); + +/* This callback disables keyboard when convertibles are fully open */ +__override void lid_angle_peripheral_enable(int enable) +{ + int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); + + /* + * If the lid is in tablet position via other sensors, + * ignore the lid angle, which might be faulty then + * disable keyboard. + */ + if (tablet_get_mode()) + enable = 0; + + if (enable) { + keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); + } else { + /* + * Ensure that the chipset is off before disabling the keyboard. + * When the chipset is on, the EC keeps the keyboard enabled and + * the AP decides whether to ignore input devices or not. + */ + if (!chipset_in_s0) + keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); + } +} diff --git a/board/blipper/board.h b/board/blipper/board.h index 7d8278c61f..fdee05e800 100644 --- a/board/blipper/board.h +++ b/board/blipper/board.h @@ -11,12 +11,12 @@ /* Select Baseboard features */ #define VARIANT_DEDEDE_EC_IT8320 #include "baseboard.h" -#undef GPIO_VOLUME_UP_L -#undef GPIO_VOLUME_DOWN_L -#undef CONFIG_VOLUME_BUTTONS /* Battery */ #define CONFIG_BATTERY_FUEL_GAUGE +#define CONFIG_BATTERY_V2 +#define CONFIG_BATTERY_COUNT 1 +#define CONFIG_HOSTCMD_BATTERY_V2 /* BC 1.2 */ #define CONFIG_BC12_DETECT_PI3USB9201 @@ -35,6 +35,33 @@ /* LED */ #define CONFIG_LED_ONOFF_STATES +/*SENSOR*/ +#define CONFIG_CMD_ACCELS +#define CONFIG_CMD_ACCEL_INFO +#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT + +#define CONFIG_ACCEL_LIS2DWL /* Lid accel */ +#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ + +/* Lid operates in forced mode, base in FIFO */ +#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) +#define CONFIG_ACCEL_FIFO +#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */ +#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) + +#define CONFIG_ACCEL_INTERRUPTS +#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ + TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) + +#define CONFIG_LID_ANGLE +#define CONFIG_LID_ANGLE_UPDATE +#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL + +#define CONFIG_TABLET_MODE +#define CONFIG_TABLET_MODE_SWITCH +#define CONFIG_GMR_TABLET_MODE + /* PWM */ #define CONFIG_PWM @@ -79,9 +106,18 @@ enum pwm_channel { PWM_CH_LED_RED, PWM_CH_LED_GREEN, + PWM_CH_LED_WHITE, PWM_CH_COUNT, }; +/* Motion sensors */ +enum sensor_id { + LID_ACCEL, + BASE_ACCEL, + BASE_GYRO, + SENSOR_COUNT +}; + /* ADC channels */ enum adc_channel { ADC_VSNS_PP3300_A, /* ADC0 */ diff --git a/board/blipper/ec.tasklist b/board/blipper/ec.tasklist index 40f8c1007b..bdcbcdf074 100644 --- a/board/blipper/ec.tasklist +++ b/board/blipper/ec.tasklist @@ -9,6 +9,7 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \ + TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, TRENTA_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \ diff --git a/board/blipper/gpio.inc b/board/blipper/gpio.inc index 516fcdcf61..f072f1c832 100644 --- a/board/blipper/gpio.inc +++ b/board/blipper/gpio.inc @@ -34,6 +34,10 @@ GPIO_INT(USB_C0_CCSBU_OVP_ODL, PIN(K, 6), GPIO_INT_FALLING | GPIO_PULL_UP, c0_cc /* Other interrupts */ GPIO_INT(LID_OPEN, PIN(F, 3), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(LID_360_L, PIN(A, 7), GPIO_INT_BOTH, gmr_tablet_switch_isr) +GPIO_INT(VOLDN_BTN_ODL, PIN(I, 6), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) +GPIO_INT(VOLUP_BTN_ODL, PIN(I, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) +GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 0), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt) GPIO_INT(EC_WP_OD, PIN(A, 6), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(HDMI_HPD_SUB_ODL, PIN(E, 7), GPIO_INT_BOTH, hdmi_hpd_interrupt) @@ -70,6 +74,8 @@ GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT) GPIO(EC_I2C_EEPROM_SDA, PIN(B, 4), GPIO_INPUT) GPIO(EC_I2C_BATTERY_SCL, PIN(C, 1), GPIO_INPUT) GPIO(EC_I2C_BATTERY_SDA, PIN(C, 2), GPIO_INPUT) +GPIO(EC_I2C_SENSOR_SCL, PIN(F, 6), GPIO_INPUT | GPIO_SEL_1P8V) +GPIO(EC_I2C_SENSOR_SDA, PIN(F, 7), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(EC_I2C_USB_C0_SCL, PIN(A, 4), GPIO_INPUT) GPIO(EC_I2C_USB_C0_SDA, PIN(A, 5), GPIO_INPUT) @@ -94,21 +100,19 @@ GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_ODR_HIGH) GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT) GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW) +/*TP*/ +GPIO(TP, PIN(C, 3), GPIO_INPUT | GPIO_HIGH) + /* NC pins, enable internal pull-down to avoid floating state. */ GPIO(GPIOA0_NC, PIN(A, 0), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOA3_NC, PIN(A, 3), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOA7_NC, PIN(A, 7), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOB5_NC, PIN(B, 5), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOC3_NC, PIN(C, 3), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOC4_NC, PIN(C, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOE0_NC, PIN(E, 0), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOF0_NC, PIN(F, 0), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOF1_NC, PIN(F, 1), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOF4_NC, PIN(F, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOF5_NC, PIN(F, 5), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOF6_NC, PIN(F, 6), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOF7_NC, PIN(F, 7), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG3_NC, PIN(G, 3), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG4_NC, PIN(G, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG5_NC, PIN(G, 5), GPIO_INPUT | GPIO_PULL_DOWN) @@ -117,9 +121,6 @@ GPIO(GPIOG7_NC, PIN(G, 7), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOH2_NC, PIN(H, 2), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOH4_NC, PIN(H, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOH6_NC, PIN(H, 6), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOI6_NC, PIN(I, 6), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOI7_NC, PIN(I, 7), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOJ0_NC, PIN(J, 0), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOJ1_NC, PIN(J, 1), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOJ3_NC, PIN(J, 3), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOJ4_NC, PIN(J, 4), GPIO_INPUT | GPIO_PULL_DOWN) @@ -136,6 +137,7 @@ ALTERNATE(PIN_MASK(B, BIT(0) | BIT(1)), 0, MODULE_UART, 0) /* UART for debug */ /* I2C */ ALTERNATE(PIN_MASK(B, BIT(3) | BIT(4)), 0, MODULE_I2C, 0) /* I2C0 */ ALTERNATE(PIN_MASK(C, BIT(1) | BIT(2)), 0, MODULE_I2C, 0) /* I2C1 */ +ALTERNATE(PIN_MASK(F, BIT(6) | BIT(7)), 0, MODULE_I2C, GPIO_SEL_1P8V) /* I2C2 - 1.8V SENSOR */ ALTERNATE(PIN_MASK(A, BIT(4) | BIT(5)), 0, MODULE_I2C, 0) /* I2C5 */ /* ADC */ @@ -146,4 +148,4 @@ ALTERNATE(PIN_MASK(I, BIT(0) | BIT(2) | BIT(3)), 0, MODULE_ADC, 0) /* ADC0: EC_V ALTERNATE(PIN_MASK(J, BIT(2)), 0, MODULE_DAC, 0) /* DAC2: EC_AP_PSYS */ /* PWM */ -ALTERNATE(PIN_MASK(A, BIT(1) | BIT(2)), 0, MODULE_PWM, 0) /* RED led, GREEN led */ +ALTERNATE(PIN_MASK(A, BIT(1) | BIT(2) | BIT(3)), 0, MODULE_PWM, 0) /* RED led, GREEN led, WHITE led */ diff --git a/board/blipper/led.c b/board/blipper/led.c index 78df105b97..7ba065fa5e 100644 --- a/board/blipper/led.c +++ b/board/blipper/led.c @@ -32,8 +32,20 @@ __override struct led_descriptor {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} }, }; +__override const struct led_descriptor + led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { + [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, + [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, + {LED_OFF, 3 * LED_ONE_SEC} }, + [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, + {LED_OFF, 3 * LED_ONE_SEC} }, + [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} }, +}; + + const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED + EC_LED_ID_BATTERY_LED, + EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -59,22 +71,43 @@ __override void led_set_color_battery(enum ec_led_colors color) } } +__override void led_set_color_power(enum ec_led_colors color) +{ + if (color == EC_LED_COLOR_WHITE) + pwm_enable(PWM_CH_LED_WHITE, LED_ON_LVL); + else + pwm_enable(PWM_CH_LED_WHITE, LED_OFF_LVL); +} + void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { - brightness_range[EC_LED_COLOR_RED] = 1; - brightness_range[EC_LED_COLOR_AMBER] = 1; - brightness_range[EC_LED_COLOR_GREEN] = 1; + if (led_id == EC_LED_ID_BATTERY_LED) { + brightness_range[EC_LED_COLOR_RED] = 1; + brightness_range[EC_LED_COLOR_AMBER] = 1; + brightness_range[EC_LED_COLOR_GREEN] = 1; + } else if (led_id == EC_LED_ID_POWER_LED) { + brightness_range[EC_LED_COLOR_WHITE] = 1; + } } int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) { - if (brightness[EC_LED_COLOR_RED] != 0) - led_set_color_battery(EC_LED_COLOR_RED); - else if (brightness[EC_LED_COLOR_AMBER] != 0) - led_set_color_battery(EC_LED_COLOR_AMBER); - else if (brightness[EC_LED_COLOR_GREEN] != 0) - led_set_color_battery(EC_LED_COLOR_GREEN); - else - led_set_color_battery(LED_OFF); + if (led_id == EC_LED_ID_BATTERY_LED) { + if (brightness[EC_LED_COLOR_RED] != 0) + led_set_color_battery(EC_LED_COLOR_RED); + else if (brightness[EC_LED_COLOR_AMBER] != 0) + led_set_color_battery(EC_LED_COLOR_AMBER); + else if (brightness[EC_LED_COLOR_GREEN] != 0) + led_set_color_battery(EC_LED_COLOR_GREEN); + else + led_set_color_battery(LED_OFF); + } else if (led_id == EC_LED_ID_POWER_LED) { + if (brightness[EC_LED_COLOR_WHITE] != 0) + led_set_color_power(EC_LED_COLOR_WHITE); + else + led_set_color_battery(LED_OFF); + } else { + return EC_ERROR_INVAL; + } return EC_SUCCESS; } |