diff options
author | wen zhang <zhangwen6@huaqin.corp-partner.google.com> | 2022-05-10 16:03:23 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-17 08:08:33 +0000 |
commit | 66adb19709d2c19ca44fb50ec3db9c3a09ca2246 (patch) | |
tree | 3b3633d5b5afe54244ab95fb69494c440f5ba834 | |
parent | e2d0f0a288d91f357296613ab3a2814fdd395792 (diff) | |
download | chrome-ec-66adb19709d2c19ca44fb50ec3db9c3a09ca2246.tar.gz |
corsola: Initial zephyr config for steelix
Initial EC Zephyr config for Corsola/Steelix.
Reuse most of Kingler sources.
Configure the battery/gpio/led in the later CLs.
BUG=b:232050545
BRANCH=none
TEST=zmake build steelix
Change-Id: Ic8b5180de8b0c57232cca1f5c01b751df54f4f96
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3637397
Reviewed-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
Reviewed-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r-- | zephyr/projects/corsola/BUILD.py | 21 | ||||
-rw-r--r-- | zephyr/projects/corsola/CMakeLists.txt | 9 | ||||
-rw-r--r-- | zephyr/projects/corsola/Kconfig | 6 | ||||
-rw-r--r-- | zephyr/projects/corsola/adc_kingler.dts | 4 | ||||
-rw-r--r-- | zephyr/projects/corsola/battery_steelix.dts | 15 | ||||
-rw-r--r-- | zephyr/projects/corsola/gpio_steelix.dts | 244 | ||||
-rw-r--r-- | zephyr/projects/corsola/i2c_kingler.dts | 4 | ||||
-rw-r--r-- | zephyr/projects/corsola/interrupts_kingler.dts | 4 | ||||
-rw-r--r-- | zephyr/projects/corsola/led_steelix.dts | 57 | ||||
-rw-r--r-- | zephyr/projects/corsola/motionsense_kingler.dts | 4 | ||||
-rw-r--r-- | zephyr/projects/corsola/prj_steelix.conf | 7 | ||||
-rw-r--r-- | zephyr/projects/corsola/src/kingler/i2c.c | 2 | ||||
-rw-r--r-- | zephyr/projects/corsola/src/kingler/led_steelix.c | 45 |
13 files changed, 421 insertions, 1 deletions
diff --git a/zephyr/projects/corsola/BUILD.py b/zephyr/projects/corsola/BUILD.py index 81368ef2d4..8e2d16ac35 100644 --- a/zephyr/projects/corsola/BUILD.py +++ b/zephyr/projects/corsola/BUILD.py @@ -64,3 +64,24 @@ register_corsola_project( ], extra_kconfig_files=[here / "prj_kingler.conf"], ) + +register_corsola_project( + project_name="steelix", + chip="npcx9m3f", + extra_dts_overlays=[ + here / "adc_kingler.dts", + here / "battery_steelix.dts", + here / "i2c_kingler.dts", + here / "interrupts_kingler.dts", + here / "cbi_eeprom.dts", + here / "gpio_steelix.dts", + here / "led_steelix.dts", + here / "motionsense_kingler.dts", + here / "usbc_kingler.dts", + here / "default_gpio_pinctrl_kingler.dts", + ], + extra_kconfig_files=[ + here / "prj_kingler.conf", + here / "prj_steelix.conf", + ], +) diff --git a/zephyr/projects/corsola/CMakeLists.txt b/zephyr/projects/corsola/CMakeLists.txt index ad86ddecce..2bd50910ee 100644 --- a/zephyr/projects/corsola/CMakeLists.txt +++ b/zephyr/projects/corsola/CMakeLists.txt @@ -41,5 +41,14 @@ elseif(DEFINED CONFIG_BOARD_KINGLER) "src/kingler/usbc_config.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BUTTONS_RUNTIME_CONFIG "src/kingler/button.c") +elseif(DEFINED CONFIG_BOARD_STEELIX) + project(steelix) + zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/kingler/i2c.c") + zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON + "src/kingler/led_steelix.c") + zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC + "src/kingler/usb_pd_policy.c") + zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC + "src/kingler/usbc_config.c") endif() diff --git a/zephyr/projects/corsola/Kconfig b/zephyr/projects/corsola/Kconfig index 6c38371996..b05d68acc1 100644 --- a/zephyr/projects/corsola/Kconfig +++ b/zephyr/projects/corsola/Kconfig @@ -14,6 +14,12 @@ config BOARD_KINGLER Build Google Kingler reference board. Krabby has MediaTek MT8186 SoC with NPCX993FA0BX EC. +config BOARD_STEELIX + bool "Google Steelix Board" + help + Build Google Steelix variant board. Steelix is a variant of Kingler + and has MediaTek MT8186 SoC with NPCX993FA0BX EC. + config VARIANT_CORSOLA_DB_DETECTION bool "Corsola Platform Runtime Daughter Board Detection" depends on PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG diff --git a/zephyr/projects/corsola/adc_kingler.dts b/zephyr/projects/corsola/adc_kingler.dts index badef7a849..67630bcb00 100644 --- a/zephyr/projects/corsola/adc_kingler.dts +++ b/zephyr/projects/corsola/adc_kingler.dts @@ -3,6 +3,10 @@ * found in the LICENSE file. */ +/* + * Kingler and Steelix use the same dts, take care of this when modify it. + */ + / { named-adc-channels { compatible = "named-adc-channels"; diff --git a/zephyr/projects/corsola/battery_steelix.dts b/zephyr/projects/corsola/battery_steelix.dts new file mode 100644 index 0000000000..63d3b7ea21 --- /dev/null +++ b/zephyr/projects/corsola/battery_steelix.dts @@ -0,0 +1,15 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + batteries { + default_battery: smp_l20m3pg2 { + compatible = "smp,l20m3pg2", "battery-smart"; + }; + lgc_l20l3pg2 { + compatible = "lgc,l20l3pg2", "battery-smart"; + }; + }; +}; diff --git a/zephyr/projects/corsola/gpio_steelix.dts b/zephyr/projects/corsola/gpio_steelix.dts new file mode 100644 index 0000000000..6ef6f02e03 --- /dev/null +++ b/zephyr/projects/corsola/gpio_steelix.dts @@ -0,0 +1,244 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + aliases { + gpio-wp = &gpio_ec_wp_l; + gpio-kbd-kso2 = &gpio_ec_kso_02_inv; + }; + + named-gpios { + compatible = "named-gpios"; + + base_imu_int_l: base_imu_int_l { + gpios = <&gpio5 6 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + spi_ap_clk_ec { + gpios = <&gpio5 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + spi_ap_cs_ec_l { + gpios = <&gpio5 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + spi_ap_do_ec_di { + gpios = <&gpio4 6 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + spi_ap_di_ec_do { + gpios = <&gpio4 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ap_ec_warm_rst_req: ap_ec_warm_rst_req { + gpios = <&gpio5 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8 | + GPIO_ACTIVE_HIGH)>; + enum-name = "GPIO_AP_EC_WARM_RST_REQ"; + }; + ap_ec_wdtrst_l: ap_ec_wdtrst_l { + gpios = <&gpio5 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8 | + GPIO_ACTIVE_LOW)>; + enum-name = "GPIO_AP_EC_WDTRST_L"; + }; + ap_in_sleep_l: ap_in_sleep_l { + gpios = <&gpio5 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8 | + GPIO_ACTIVE_LOW)>; + enum-name = "GPIO_AP_IN_SLEEP_L"; + }; + gpio_en_ulp: en_ulp { + gpios = <&gpioc 6 GPIO_OUTPUT_LOW>; + }; + en_ec_id_odl { + gpios = <&gpio7 6 GPIO_ODR_HIGH>; + }; + sys_rst_odl { + gpios = <&gpioc 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>; + enum-name = "GPIO_SYS_RST_ODL"; + }; + ec_i2c_sensor_scl { + gpios = <&gpiob 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec_i2c_sensor_sda { + gpios = <&gpiob 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec_i2c_usb_c0_scl { + gpios = <&gpio9 0 GPIO_INPUT>; + }; + ec_i2c_usb_c0_sda { + gpios = <&gpio8 7 GPIO_INPUT>; + }; + ec_i2c_usb_c1_scl { + gpios = <&gpio9 2 GPIO_INPUT>; + }; + ec_i2c_usb_c1_sda { + gpios = <&gpio9 1 GPIO_INPUT>; + }; + ec_i2c_pwr_cbi_scl { + gpios = <&gpiod 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec_i2c_pwr_cbi_sda { + gpios = <&gpiod 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + ec_i2c_batt_scl { + gpios = <&gpio3 3 GPIO_INPUT>; + }; + ec_i2c_batt_sda { + gpios = <&gpio3 6 GPIO_INPUT>; + }; + ec_pen_chg_dis_odl { + gpios = <&gpioe 4 GPIO_INPUT>; + }; + gpio_ec_wp_l: ec_wp_odl { + gpios = <&gpioe 3 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + }; + lid_accel_int_l { + gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + tablet_mode_l { + gpios = <&gpiob 2 GPIO_INPUT>; + enum-name = "GPIO_TABLET_MODE_L"; + }; + ec_ap_int_odl { + gpios = <&gpioc 1 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>; + enum-name = "GPIO_EC_INT_L"; + }; + gpio_ec_kso_02_inv: ec_kso_02_inv { + gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>; + }; + gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl { + gpios = <&gpio8 3 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_BC12_INT_ODL"; + }; + ec_entering_rw { + gpios = <&gpio0 3 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_ENTERING_RW"; + }; + charger_prochot_odl { + gpios = <&gpiob 1 GPIO_INPUT>; + }; + ec_rst_odl { + gpios = <&gpio7 7 GPIO_INPUT>; + }; + gpio_lid_open: lid_open { + gpios = <&gpiod 2 GPIO_INPUT>; + enum-name = "GPIO_LID_OPEN"; + }; + gpio_acok_od: acok_od { + gpios = <&gpio0 0 GPIO_INPUT>; + enum-name = "GPIO_AC_PRESENT"; + }; + gpio_gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl { + gpios = <&gpio0 1 GPIO_INPUT>; + enum-name = "GPIO_POWER_BUTTON_L"; + }; + gpio_en_5v_usm: en_5v_usm { + gpios = <&gpio0 2 GPIO_OUTPUT_LOW>; + }; + packet_mode_en { + gpios = <&gpio7 5 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_PACKET_MODE_EN"; + }; + gpio_x_ec_gpio2: x_ec_gpio2 { + gpios = <&gpiod 4 GPIO_INPUT>; + }; + ap_sysrst_odl_r: ap_sysrst_odl_r { + gpios = <&gpioa 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8 | + GPIO_ACTIVE_LOW)>; + enum-name = "GPIO_AP_EC_SYSRST_ODL"; + }; + gpio_ap_xhci_init_done: ap_xhci_init_done { + gpios = <&gpioa 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; + }; + gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl { + gpios = <&gpio6 7 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_PPC_INT_ODL"; + }; + pg_pp5000_z2_od { + gpios = <&gpio7 0 GPIO_INPUT>; + }; + gpio_ec_x_gpio1: ec_x_gpio1 { + gpios = <&gpio6 2 GPIO_OUTPUT_LOW>; + }; + dp_aux_path_sel: dp_aux_path_sel { + gpios = <&gpio6 3 GPIO_OUTPUT_LOW>; + }; + gpio_ec_bl_en_od: ec_bl_en_od { + gpios = <&gpio4 0 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>; + }; + gpio_ec_x_gpio3: ec_x_gpio3 { + gpios = <&gpiod 3 GPIO_OUTPUT_LOW>; + }; + gpio_usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl { + gpios = <&gpio7 3 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_TCPC_INT_ODL"; + }; + gpio_usb_c0_tcpc_rst: usb_c0_tcpc_rst { + gpios = <&gpioc 0 GPIO_OUTPUT_LOW>; + }; + en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus_x { + gpios = <&gpio6 0 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_EN_PP5000_USB_A0_VBUS"; + }; + gpio_hdmi_prsnt_odl: hdmi_prsnt_odl { + gpios = <&gpio3 7 GPIO_INPUT>; + }; + en_pp5000_z2 { + gpios = <&gpio3 4 GPIO_OUTPUT_HIGH>; + }; + gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl { + gpios = <&gpioe 1 GPIO_INPUT>; + }; + ec_batt_pres_odl { + gpios = <&gpioe 0 GPIO_INPUT>; + enum-name = "GPIO_BATT_PRES_ODL"; + }; + usb_a0_fault_odl { + gpios = <&gpioc 7 GPIO_INPUT>; + }; + ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl { + gpios = <&gpio6 1 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>; + }; + ec_pmic_en_odl { + gpios = <&gpio7 4 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>; + enum-name = "GPIO_EC_PMIC_EN_ODL"; + }; + gpio_ec_volup_btn_odl: ec_volup_btn_odl { + gpios = <&gpiod 5 GPIO_INPUT>; + enum-name = "GPIO_VOLUME_UP_L"; + }; + gpio_ec_voldn_btn_odl: ec_voldn_btn_odl { + gpios = <&gpioe 2 GPIO_INPUT>; + enum-name = "GPIO_VOLUME_DOWN_L"; + }; + ccd_mode_odl { + gpios = <&gpioe 5 GPIO_INPUT>; + enum-name = "GPIO_CCD_MODE_ODL"; + }; + }; + + /* + * aliases for sub-board GPIOs + */ + aliases { + gpio-en-hdmi-pwr = &gpio_ec_x_gpio1; + gpio-usb-c1-frs-en = &gpio_ec_x_gpio1; + gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2; + gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2; + gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3; + gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3; + }; + + hibernate-wake-pins { + compatible = "cros-ec,hibernate-wake-pins"; + wakeup-irqs = < + &int_ac_present + &int_power_button + &int_lid_open + >; + }; + + def-lvol-io-list { + compatible = "nuvoton,npcx-lvolctrl-def"; + lvol-io-pads = < + &lvol_ioe3 /* GPIOE3 GPIO_EC_WP_L */ + &lvol_io40 /* GPIO40 GPIO_EC_BL_EN_OD */ + >; + }; +}; diff --git a/zephyr/projects/corsola/i2c_kingler.dts b/zephyr/projects/corsola/i2c_kingler.dts index 9975030d2c..05eeadeff5 100644 --- a/zephyr/projects/corsola/i2c_kingler.dts +++ b/zephyr/projects/corsola/i2c_kingler.dts @@ -3,6 +3,10 @@ * found in the LICENSE file. */ +/* + * Kingler and Steelix use the same dts, take care of this when modify it. + */ + / { named-i2c-ports { compatible = "named-i2c-ports"; diff --git a/zephyr/projects/corsola/interrupts_kingler.dts b/zephyr/projects/corsola/interrupts_kingler.dts index dd05567403..ac7da13e75 100644 --- a/zephyr/projects/corsola/interrupts_kingler.dts +++ b/zephyr/projects/corsola/interrupts_kingler.dts @@ -3,6 +3,10 @@ * found in the LICENSE file. */ +/* + * Kingler and Steelix use the same dts, take care of this when modify it. + */ + / { aliases { int-wp = &int_wp; diff --git a/zephyr/projects/corsola/led_steelix.dts b/zephyr/projects/corsola/led_steelix.dts new file mode 100644 index 0000000000..19bb0978d8 --- /dev/null +++ b/zephyr/projects/corsola/led_steelix.dts @@ -0,0 +1,57 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED + &pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED + &pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>; + }; + }; + + cros-pwmleds { + compatible = "cros-ec,pwm-leds"; + + leds = <&pwm_led0>; + frequency = <100>; + + color-map-red = <100 0 0>; + color-map-green = < 0 100 0>; + color-map-amber = <100 20 0>; + + brightness-range = <255 255 0 0 0 255>; + + #address-cells = <1>; + #size-cells = <0>; + + pwm_led_0@0 { + reg = <0>; + ec-led-name = "EC_LED_ID_BATTERY_LED"; + }; + }; +}; + +/* Red LED */ +&pwm0 { + status = "okay"; + drive-open-drain; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; + +/* Green LED */ +&pwm1 { + status = "okay"; + drive-open-drain; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; + +/* Blue LED */ +&pwm2 { + status = "okay"; + drive-open-drain; + clock-bus = "NPCX_CLOCK_BUS_LFCLK"; +}; diff --git a/zephyr/projects/corsola/motionsense_kingler.dts b/zephyr/projects/corsola/motionsense_kingler.dts index 35e673e5c8..4667635da0 100644 --- a/zephyr/projects/corsola/motionsense_kingler.dts +++ b/zephyr/projects/corsola/motionsense_kingler.dts @@ -3,6 +3,10 @@ * found in the LICENSE file. */ +/* + * Kingler and Steelix use the same dts, take care of this when modify it. + */ + #include <dt-bindings/motionsense/utils.h> / { diff --git a/zephyr/projects/corsola/prj_steelix.conf b/zephyr/projects/corsola/prj_steelix.conf new file mode 100644 index 0000000000..5354381f9b --- /dev/null +++ b/zephyr/projects/corsola/prj_steelix.conf @@ -0,0 +1,7 @@ +# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Variant config +CONFIG_BOARD_KINGLER=n +CONFIG_BOARD_STEELIX=y
\ No newline at end of file diff --git a/zephyr/projects/corsola/src/kingler/i2c.c b/zephyr/projects/corsola/src/kingler/i2c.c index a431050012..6236d42714 100644 --- a/zephyr/projects/corsola/src/kingler/i2c.c +++ b/zephyr/projects/corsola/src/kingler/i2c.c @@ -6,7 +6,7 @@ #include "i2c/i2c.h" #include "i2c.h" -/* Kingler board specific i2c implementation */ +/* Kingler and Steelix board specific i2c implementation */ #ifdef CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED int board_allow_i2c_passthru(const struct i2c_cmd_desc_t *cmd_desc) diff --git a/zephyr/projects/corsola/src/kingler/led_steelix.c b/zephyr/projects/corsola/src/kingler/led_steelix.c new file mode 100644 index 0000000000..a44f961441 --- /dev/null +++ b/zephyr/projects/corsola/src/kingler/led_steelix.c @@ -0,0 +1,45 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Battery LED control for Steelix + */ +#include "common.h" +#include "ec_commands.h" +#include "led_common.h" +#include "led_onoff_states.h" +#include "led_pwm.h" + +__override const int led_charge_lvl_1 = 5; +__override const int led_charge_lvl_2 = 97; +__override struct led_descriptor + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} }, + [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, + [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} }, + [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} }, + [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, + [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, + [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, + {LED_OFF, 1 * LED_ONE_SEC} }, + [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC}, + {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} }, +}; + +__override void led_set_color_battery(enum ec_led_colors color) +{ + switch (color) { + case EC_LED_COLOR_RED: + set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_RED); + break; + case EC_LED_COLOR_GREEN: + set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_GREEN); + break; + case EC_LED_COLOR_AMBER: + set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_AMBER); + break; + default: /* LED_OFF and other unsupported colors */ + set_pwm_led_color(EC_LED_ID_BATTERY_LED, -1); + break; + } +} |