summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyu Qin <qinsiyu@huaqin.corp-partner.google.com>2022-02-23 19:55:06 +0800
committerCommit Bot <commit-bot@chromium.org>2022-03-03 13:00:26 +0000
commit7c7866e774940b7faf9d95ddef2f4e0aed19e0a7 (patch)
treec221a0730b5cee019d190aadc153b7bd5201b412
parent94022e3ced776c9ed471baa3404fa6330e9ba0ab (diff)
downloadchrome-ec-7c7866e774940b7faf9d95ddef2f4e0aed19e0a7.tar.gz
bellis: Initial EC image
Create the initial EC image for the bellis variant by copying the munna reference board EC files into a new directory named for the variant. BUG=b:220669923 BRANCH=kukui TEST=1.make BOARD=bellis -j 2.test pass on DUT Change-Id: Ib35d1fbed3cba3b0c13d437efd510c42b312fdb5 Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3484816 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit dd9613f99cff45eeaab9605216b91906f5561536) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3499654 Reviewed-by: Kenny Pan <kennypan@google.com> Commit-Queue: Kenny Pan <kennypan@google.com>
-rw-r--r--board/bellis/battery.c104
-rw-r--r--board/bellis/board.c577
-rw-r--r--board/bellis/board.h186
-rw-r--r--board/bellis/build.mk15
-rw-r--r--board/bellis/ec.tasklist21
-rw-r--r--board/bellis/gpio.inc120
-rw-r--r--board/bellis/led.c115
-rw-r--r--board/bellis/vif_override.xml3
8 files changed, 1141 insertions, 0 deletions
diff --git a/board/bellis/battery.c b/board/bellis/battery.c
new file mode 100644
index 0000000000..7c086fb8e2
--- /dev/null
+++ b/board/bellis/battery.c
@@ -0,0 +1,104 @@
+/* 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.
+ */
+
+#include "battery.h"
+#include "battery_fuel_gauge.h"
+#include "gpio.h"
+
+const struct board_batt_params board_battery_info[] = {
+ /* LGC L20L3PG2, Gauge IC: RAJ240047A20DNP. */
+ [BATTERY_LGC] = {
+ .fuel_gauge = {
+ .manuf_name = "LGC",
+ .device_name = "L20L3PG2",
+ .ship_mode = {
+ .reg_addr = 0x34,
+ .reg_data = { 0x0000, 0x1000 },
+ },
+ .fet = {
+ .reg_addr = 0x34,
+ .reg_mask = 0x0100,
+ .disconnect_val = 0x0100,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13050, /* mV */
+ .voltage_normal = 11400, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 50,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 73,
+ },
+ },
+ /* Sunwoda L20D3PG2, Gauge IC: BQ40Z697A. */
+ [BATTERY_SUNWODA] = {
+ .fuel_gauge = {
+ .manuf_name = "Sunwoda",
+ .device_name = "L20D3PG2",
+ .ship_mode = {
+ .reg_addr = 0x34,
+ .reg_data = { 0x0000, 0x1000 },
+ },
+ .fet = {
+ .reg_addr = 0x34,
+ .reg_mask = 0x0100,
+ .disconnect_val = 0x0100,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13050, /* mV */
+ .voltage_normal = 11250, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 200, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 50,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
+ },
+ },
+
+ /* SIMPLO L20M3PG2, Gauge IC: BQ40Z697A. */
+ [BATTERY_SMP] = {
+ .fuel_gauge = {
+ .manuf_name = "SMP",
+ .device_name = "L20M3PG2",
+ .ship_mode = {
+ .reg_addr = 0x34,
+ .reg_data = { 0x0000, 0x1000 },
+ },
+ .fet = {
+ .reg_addr = 0x34,
+ .reg_mask = 0x0100,
+ .disconnect_val = 0x0100,
+ },
+ },
+ .batt_info = {
+ .voltage_max = 13050, /* mV */
+ .voltage_normal = 11250, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 45,
+ .charging_min_c = 0,
+ .charging_max_c = 45,
+ .discharging_min_c = -40,
+ .discharging_max_c = 73,
+ },
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_LGC;
+
+enum battery_present battery_hw_present(void)
+{
+ return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
+}
diff --git a/board/bellis/board.c b/board/bellis/board.c
new file mode 100644
index 0000000000..882df736ac
--- /dev/null
+++ b/board/bellis/board.c
@@ -0,0 +1,577 @@
+/* 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.
+ */
+
+#include "adc.h"
+#include "adc_chip.h"
+#include "backlight.h"
+#include "button.h"
+#include "charge_manager.h"
+#include "charge_ramp.h"
+#include "charge_state.h"
+#include "charger.h"
+#include "chipset.h"
+#include "clock-l4.h"
+#include "common.h"
+#include "console.h"
+#include "driver/accel_lis2dw12.h"
+#include "driver/accelgyro_bmi_common.h"
+#include "driver/battery/max17055.h"
+#include "driver/bc12/pi3usb9201.h"
+#include "driver/charger/isl923x.h"
+#include "driver/tcpm/fusb302.h"
+#include "driver/usb_mux/it5205.h"
+#include "ec_commands.h"
+#include "extpower.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "i2c.h"
+#include "i2c_bitbang.h"
+#include "it8801.h"
+#include "keyboard_scan.h"
+#include "keyboard_backlight.h"
+#include "lid_switch.h"
+#include "power.h"
+#include "power_button.h"
+#include "registers.h"
+#include "spi.h"
+#include "system.h"
+#include "task.h"
+#include "tcpm.h"
+#include "timer.h"
+#include "usb_charge.h"
+#include "usb_mux.h"
+#include "usb_pd_tcpm.h"
+#include "util.h"
+
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+
+static void tcpc_alert_event(enum gpio_signal signal)
+{
+ schedule_deferred_pd_interrupt(0 /* port */);
+}
+
+#include "gpio_list.h"
+
+/******************************************************************************/
+/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
+const struct adc_t adc_channels[] = {
+ [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(5),
+ STM32_RANK(1)},
+ [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(15),
+ STM32_RANK(2)},
+};
+BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+
+/******************************************************************************/
+/* I2C ports */
+const struct i2c_port_t i2c_ports[] = {
+ {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
+ {"other", 2, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+const struct i2c_port_t i2c_bitbang_ports[] = {
+ {"battery", 3, 100, GPIO_I2C4_SCL, GPIO_I2C4_SDA, .drv = &bitbang_drv},
+};
+const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
+
+#define BC12_I2C_ADDR PI3USB9201_I2C_ADDR_3
+
+/* power signal list. Must match order of enum power_signal. */
+const struct power_signal_info power_signal_list[] = {
+ {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
+ {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+};
+BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+
+/* Keyboard scan setting */
+struct keyboard_scan_config keyscan_config = {
+ /*
+ * TODO(b/133200075): Tune this once we have the final performance
+ * out of the driver and the i2c bus.
+ */
+ .output_settle_us = 35,
+ .debounce_down_us = 5 * MSEC,
+ .debounce_up_us = 40 * MSEC,
+ .scan_period_us = 10 * MSEC,
+ .min_post_scan_delay_us = 10 * MSEC,
+ .poll_timeout_us = 100 * MSEC,
+ .actual_key_mask = {
+ 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
+ 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
+ },
+};
+
+struct ioexpander_config_t ioex_config[CONFIG_IO_EXPANDER_PORT_COUNT] = {
+ [0] = {
+ .i2c_host_port = I2C_PORT_IO_EXPANDER_IT8801,
+ .i2c_slave_addr = IT8801_I2C_ADDR,
+ .drv = &it8801_ioexpander_drv,
+ },
+};
+
+/******************************************************************************/
+/* SPI devices */
+const struct spi_device_t spi_devices[] = {
+ { CONFIG_SPI_ACCEL_PORT, 2, GPIO_EC_SENSOR_SPI_NSS },
+};
+const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
+
+const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
+ {
+ .i2c_port = I2C_PORT_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ },
+};
+
+/******************************************************************************/
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_TCPC0,
+ .addr_flags = FUSB302_I2C_SLAVE_ADDR_FLAGS,
+ },
+ .drv = &fusb302_tcpm_drv,
+ },
+};
+
+static void board_hpd_status(int port, int hpd_lvl, int hpd_irq)
+{
+ /*
+ * svdm_dp_attention() did most of the work, we only need to notify
+ * host here.
+ */
+ host_set_single_event(EC_HOST_EVENT_USB_MUX);
+}
+
+struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ /* Driver uses I2C_PORT_USB_MUX as I2C port */
+ .port_addr = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
+};
+
+uint16_t tcpc_get_alert_status(void)
+{
+ uint16_t status = 0;
+
+ if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL))
+ status |= PD_STATUS_TCPC_ALERT_0;
+
+ return status;
+}
+
+static int force_discharge;
+
+int board_set_active_charge_port(int charge_port)
+{
+ CPRINTS("New chg p%d", charge_port);
+
+ /* ignore all request when discharge mode is on */
+ if (force_discharge && charge_port != CHARGE_PORT_NONE)
+ return EC_SUCCESS;
+
+ switch (charge_port) {
+ case CHARGE_PORT_USB_C:
+ /* Don't charge from a source port */
+ if (board_vbus_source_enabled(charge_port))
+ return -1;
+ break;
+ case CHARGE_PORT_NONE:
+ /*
+ * To ensure the fuel gauge (max17055) is always powered
+ * even when battery is disconnected, keep VBAT rail on but
+ * set the charging current to minimum.
+ */
+ charger_set_current(0);
+ break;
+ default:
+ panic("Invalid charge port\n");
+ break;
+ }
+
+ return EC_SUCCESS;
+}
+
+void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_ma = (charge_ma * 95) / 100;
+ charge_set_input_current_limit(MAX(charge_ma,
+ CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
+int board_discharge_on_ac(int enable)
+{
+ int ret, port;
+
+ if (enable) {
+ port = CHARGE_PORT_NONE;
+ } else {
+ /* restore the charge port state */
+ port = charge_manager_get_override();
+ if (port == OVERRIDE_OFF)
+ port = charge_manager_get_active_charge_port();
+ }
+
+ ret = charger_discharge_on_ac(enable);
+ if (ret)
+ return ret;
+
+ force_discharge = enable;
+ return board_set_active_charge_port(port);
+}
+
+int pd_snk_is_vbus_provided(int port)
+{
+ /* TODO(b:138352732): read IT8801 GPIO EN_USBC_CHARGE_L */
+ return EC_ERROR_UNIMPLEMENTED;
+}
+
+void bc12_interrupt(enum gpio_signal signal)
+{
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0);
+}
+
+#ifndef VARIANT_KUKUI_NO_SENSORS
+static void board_spi_enable(void)
+{
+ /*
+ * Pin mux spi peripheral away from emmc, since RO might have
+ * left them there.
+ */
+ gpio_config_module(MODULE_SPI_FLASH, 0);
+#ifdef CHIP_FAMILY_STM32L4
+ /* Set I/O speed before AF configured */
+ /* EMMC SPI SLAVE: PB13/14/15 */
+ /* SENSORS SPI MASTER: PB10, PB12, PC2, PC3 */
+ STM32_GPIO_OSPEEDR(GPIO_B) |= 0xFF300000;
+ STM32_GPIO_OSPEEDR(GPIO_C) |= 0x000000F0;
+
+ /* Enable clocks to SPI2 module. */
+ clock_enable_module(MODULE_SPI_FLASH, 1);
+
+ /* Reset SPI2 to clear state left over from the emmc slave. */
+ STM32_RCC_APB1RSTR1 |= STM32_RCC_PB1_SPI2;
+ STM32_RCC_APB1RSTR1 &= ~STM32_RCC_PB1_SPI2;
+#else
+ /* Enable clocks to SPI2 module. */
+ STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2;
+
+ /* Reset SPI2 to clear state left over from the emmc slave. */
+ STM32_RCC_APB1RSTR |= STM32_RCC_PB1_SPI2;
+ STM32_RCC_APB1RSTR &= ~STM32_RCC_PB1_SPI2;
+#endif
+ /* Reinitialize spi peripheral. */
+ spi_enable(CONFIG_SPI_ACCEL_PORT, 1);
+
+ /* Pin mux spi peripheral toward the sensor. */
+ gpio_config_module(MODULE_SPI_MASTER, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
+ board_spi_enable,
+ MOTION_SENSE_HOOK_PRIO - 1);
+
+static void board_spi_disable(void)
+{
+ /* Set pins to a state calming the sensor down. */
+ gpio_set_flags(GPIO_EC_SENSOR_SPI_CK, GPIO_OUT_LOW);
+ gpio_set_level(GPIO_EC_SENSOR_SPI_CK, 0);
+ gpio_config_module(MODULE_SPI_MASTER, 0);
+
+ /* Disable spi peripheral and clocks. */
+ spi_enable(CONFIG_SPI_ACCEL_PORT, 0);
+#ifdef CHIP_FAMILY_STM32L4
+ STM32_RCC_APB1ENR1 &= ~STM32_RCC_PB1_SPI2;
+#else
+ STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
+#endif
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
+ board_spi_disable,
+ MOTION_SENSE_HOOK_PRIO + 1);
+#endif /* !VARIANT_KUKUI_NO_SENSORS */
+
+static void board_init(void)
+{
+ /* If the reset cause is external, pulse PMIC force reset. */
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN) {
+ gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 0);
+ msleep(100);
+ gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 1);
+ }
+
+ /* Enable TCPC alert interrupts */
+ gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
+
+#ifndef VARIANT_KUKUI_NO_SENSORS
+ /* Enable interrupts from BMI160 sensor. */
+ gpio_enable_interrupt(GPIO_ACCEL_INT_ODL);
+
+ /* For some reason we have to do this again in case of sysjump */
+ board_spi_enable();
+#endif /* !VARIANT_KUKUI_NO_SENSORS */
+
+ /* Enable interrupt from PMIC. */
+ gpio_enable_interrupt(GPIO_PMIC_EC_RESETB);
+
+ /* Enable BC12 interrupt */
+ gpio_enable_interrupt(GPIO_BC12_EC_INT_ODL);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+#ifndef VARIANT_KUKUI_NO_SENSORS
+/* Motion sensors */
+/* Mutexes */
+static struct mutex g_lid_mutex;
+static struct mutex g_base_mutex;
+
+/* Rotation matrixes */
+static const mat33_fp_t base_standard_ref = {
+ {0, FLOAT_TO_FP(1), 0},
+ {FLOAT_TO_FP(-1), 0, 0},
+ {0, 0, FLOAT_TO_FP(1)}
+};
+
+static const mat33_fp_t lid_standard_ref = {
+ {FLOAT_TO_FP(-1), 0, 0},
+ {0, FLOAT_TO_FP(1), 0},
+ {0, 0, FLOAT_TO_FP(-1) }
+};
+
+/* sensor private data */
+static struct stprivate_data g_lis2dwl_data;
+static struct bmi_drv_data_t g_bmi160_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_SENSORS,
+ .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS,
+ .rot_standard_ref = &lid_standard_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,
+ },
+ },
+ },
+ /*
+ * Note: bmi160: supports accelerometer and gyro sensor
+ * Requirement: accelerometer sensor must init before gyro sensor
+ * DO NOT change the order of the following table.
+ */
+ [BASE_ACCEL] = {
+ .name = "Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI160,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi160_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi160_data,
+ .port = CONFIG_SPI_ACCEL_PORT,
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
+ .rot_standard_ref = &base_standard_ref,
+ .default_range = 2, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ /* Sensor on for angle detection */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ },
+ },
+ [BASE_GYRO] = {
+ .name = "Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI160,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi160_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi160_data,
+ .port = CONFIG_SPI_ACCEL_PORT,
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_standard_ref,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
+ },
+};
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+const struct it8801_pwm_t it8801_pwm_channels[] = {
+ [IT8801_PWM_CH_KBLIGHT] = {.index = 4},
+};
+
+void board_kblight_init(void)
+{
+ kblight_register(&kblight_it8801);
+}
+
+bool board_has_kb_backlight(void)
+{
+ /* Default enable keyboard backlight */
+ return true;
+}
+#endif /* !VARIANT_KUKUI_NO_SENSORS */
+
+/* Battery functions */
+#define SB_SMARTCHARGE 0x26
+/* Quick charge enable bit */
+#define SMART_QUICK_CHARGE 0x02
+/* Quick charge support bit */
+#define MODE_QUICK_CHARGE_SUPPORT 0x01
+
+static void sb_quick_charge_mode(int enable)
+{
+ int val, rv;
+
+ rv = sb_read(SB_SMARTCHARGE, &val);
+ if (rv || !(val & MODE_QUICK_CHARGE_SUPPORT))
+ return;
+
+ if (enable)
+ val |= SMART_QUICK_CHARGE;
+ else
+ val &= ~SMART_QUICK_CHARGE;
+
+ sb_write(SB_SMARTCHARGE, val);
+}
+
+/* Called on AP S0iX -> S0 transition */
+static void board_chipset_resume(void)
+{
+#ifndef VARIANT_KUKUI_NO_SENSORS
+ if (board_has_kb_backlight())
+ ioex_set_level(IOEX_KB_BL_EN, 1);
+#endif
+
+ /* Normal charge mode */
+ sb_quick_charge_mode(0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, board_chipset_resume, HOOK_PRIO_DEFAULT);
+
+/* Called on AP S0 -> S0iX transition */
+static void board_chipset_suspend(void)
+{
+#ifndef VARIANT_KUKUI_NO_SENSORS
+ if (board_has_kb_backlight())
+ ioex_set_level(IOEX_KB_BL_EN, 0);
+#endif
+
+ /* Quick charge mode */
+ sb_quick_charge_mode(1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+
+/* Called on AP S5 -> S3 transition */
+static void board_chipset_startup(void)
+{
+ gpio_set_level(GPIO_EN_USBA_5V, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
+
+/* Called on AP S3 -> S5 transition */
+static void board_chipset_shutdown(void)
+{
+ gpio_set_level(GPIO_EN_USBA_5V, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
+
+int board_get_charger_i2c(void)
+{
+ /* TODO(b:138415463): confirm the bus allocation for future builds */
+ return I2C_PORT_CHARGER;
+}
+
+int board_get_battery_i2c(void)
+{
+ return I2C_PORT_BATTERY;
+}
+
+#ifdef SECTION_IS_RW
+static int it8801_get_target_channel(enum pwm_channel *channel,
+ int type, int index)
+{
+ switch (type) {
+ case EC_PWM_TYPE_GENERIC:
+ *channel = index;
+ break;
+ default:
+ return -1;
+ }
+
+ return *channel >= 1;
+}
+
+static enum ec_status
+host_command_pwm_set_duty(struct host_cmd_handler_args *args)
+{
+ const struct ec_params_pwm_set_duty *p = args->params;
+ enum pwm_channel channel;
+ uint16_t duty;
+
+ if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
+ return EC_RES_INVALID_PARAM;
+
+ duty = (uint32_t) p->duty * 255 / 65535;
+ it8801_pwm_set_raw_duty(channel, duty);
+ it8801_pwm_enable(channel, p->duty > 0);
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
+ host_command_pwm_set_duty,
+ EC_VER_MASK(0));
+
+static enum ec_status
+host_command_pwm_get_duty(struct host_cmd_handler_args *args)
+{
+ const struct ec_params_pwm_get_duty *p = args->params;
+ struct ec_response_pwm_get_duty *r = args->response;
+
+ enum pwm_channel channel;
+
+ if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
+ return EC_RES_INVALID_PARAM;
+
+ r->duty = (uint32_t) it8801_pwm_get_raw_duty(channel) * 65535 / 255;
+ args->response_size = sizeof(*r);
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
+ host_command_pwm_get_duty,
+ EC_VER_MASK(0));
+#endif
diff --git a/board/bellis/board.h b/board/bellis/board.h
new file mode 100644
index 0000000000..5837580751
--- /dev/null
+++ b/board/bellis/board.h
@@ -0,0 +1,186 @@
+/* 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.
+ */
+
+/* Configuration for Bellis */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#define VARIANT_KUKUI_JACUZZI
+#define VARIANT_KUKUI_BATTERY_SMART
+#define VARIANT_KUKUI_CHARGER_ISL9238
+#define VARIANT_KUKUI_EC_STM32L431
+
+#ifndef SECTION_IS_RW
+#define VARIANT_KUKUI_NO_SENSORS
+#endif /* SECTION_IS_RW */
+
+#include "baseboard.h"
+
+#undef CONFIG_CHIPSET_POWER_SEQ_VERSION
+#define CONFIG_CHIPSET_POWER_SEQ_VERSION 1
+#undef CONFIG_SYSTEM_UNLOCKED
+
+/* PLL configuration. Freq = STM32_HSE_CLOCK or HSI (16MHz) * n/m/r */
+#undef STM32_PLLM
+#undef STM32_PLLN
+#undef STM32_PLLR
+#define STM32_PLLM 1
+#ifdef STM32_HSE_CLOCK
+#define STM32_PLLN 12
+#else
+#define STM32_PLLN 10
+#endif
+#define STM32_PLLR 2
+
+#define STM32_USE_PLL
+
+#define CONFIG_BATTERY_HW_PRESENT_CUSTOM
+
+#define CONFIG_CHARGER_PSYS
+
+#define CONFIG_BC12_DETECT_PI3USB9201
+
+#define CONFIG_EXTPOWER_GPIO
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 200
+
+#define CONFIG_I2C_BITBANG
+#undef I2C_BITBANG_PORT_COUNT
+#define I2C_BITBANG_PORT_COUNT 1
+#undef CONFIG_I2C_NACK_RETRY_COUNT
+#define CONFIG_I2C_NACK_RETRY_COUNT 10
+#define CONFIG_SMBUS_PEC
+
+#define CONFIG_USB_PD_TCPM_FUSB302
+#define CONFIG_USB_PD_DISCHARGE_GPIO
+#define CONFIG_USB_PD_TCPC_LOW_POWER
+
+#define CONFIG_USB_MUX_IT5205
+
+#define CONFIG_LED_ONOFF_STATES
+#define CONFIG_LED_POWER_LED
+
+#undef CONFIG_WATCHDOG_PERIOD_MS
+#define CONFIG_WATCHDOG_PERIOD_MS 4000
+
+
+/* Motion Sensors */
+#ifndef VARIANT_KUKUI_NO_SENSORS
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_INTERRUPTS
+#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+#define CONFIG_ALS
+#define CONFIG_CMD_ACCEL_INFO
+
+#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_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
+
+#ifdef SECTION_IS_RW
+#define CONFIG_IO_EXPANDER_IT8801_PWM
+#define CONFIG_KEYBOARD_BACKLIGHT
+#endif
+
+#endif /* VARIANT_KUKUI_NO_SENSORS */
+
+/* I2C ports */
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER 2
+#define I2C_PORT_SENSORS 2
+#define I2C_PORT_IO_EXPANDER_IT8801 2
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 3
+#define I2C_PORT_TCPC0 0
+
+#undef I2C_CONTROLLER_COUNT
+#undef I2C_PORT_COUNT
+#define I2C_CONTROLLER_COUNT 3
+#define I2C_PORT_COUNT 3
+
+/* Enable Accel over SPI */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
+
+#define CONFIG_KEYBOARD_PROTOCOL_MKBP
+#define CONFIG_MKBP_EVENT
+#define CONFIG_MKBP_USE_GPIO
+/* Define the MKBP events which are allowed to wakeup AP in S3. */
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
+
+#undef CONFIG_GMR_TABLET_MODE
+#undef GMR_TABLET_MODE_GPIO_L
+#undef CONFIG_TABLET_MODE
+#undef CONFIG_TABLET_MODE_SWITCH
+
+#ifndef __ASSEMBLER__
+
+enum adc_channel {
+ /* Real ADC channels begin here */
+ ADC_BOARD_ID = 0,
+ ADC_EC_SKU_ID,
+ ADC_CH_COUNT
+};
+
+/* power signal definitions */
+enum power_signal {
+ AP_IN_S3_L,
+ PMIC_PWR_GOOD,
+
+ /* Number of signals */
+ POWER_SIGNAL_COUNT,
+};
+
+/* Motion sensors */
+enum sensor_id {
+ LID_ACCEL = 0,
+ BASE_ACCEL,
+ BASE_GYRO,
+ SENSOR_COUNT,
+};
+
+enum charge_port {
+ CHARGE_PORT_USB_C,
+};
+
+enum battery_type {
+ BATTERY_LGC,
+ BATTERY_SUNWODA,
+ BATTERY_SMP,
+ BATTERY_TYPE_COUNT,
+};
+
+enum pwm_channel {
+ IT8801_PWM_CH_KBLIGHT = 0,
+};
+
+#include "gpio_signal.h"
+#include "registers.h"
+
+#ifdef SECTION_IS_RO
+/* Interrupt handler for emmc task */
+void emmc_cmd_interrupt(enum gpio_signal signal);
+#endif
+
+void bc12_interrupt(enum gpio_signal signal);
+void board_reset_pd_mcu(void);
+int board_get_version(void);
+int board_is_sourcing_vbus(int port);
+
+/* returns the i2c port number of charger/battery */
+int board_get_charger_i2c(void);
+int board_get_battery_i2c(void);
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/bellis/build.mk b/board/bellis/build.mk
new file mode 100644
index 0000000000..f88dde8da8
--- /dev/null
+++ b/board/bellis/build.mk
@@ -0,0 +1,15 @@
+# -*- makefile -*-
+# 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.
+#
+# Board specific files build
+#
+#
+# STmicro STM32L431RCI
+CHIP:=stm32
+CHIP_FAMILY:=stm32l4
+CHIP_VARIANT:=stm32l431x
+BASEBOARD:=kukui
+
+board-y=battery.o board.o led.o
diff --git a/board/bellis/ec.tasklist b/board/bellis/ec.tasklist
new file mode 100644
index 0000000000..6efe9b1691
--- /dev/null
+++ b/board/bellis/ec.tasklist
@@ -0,0 +1,21 @@
+/* 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.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, 1024) \
+ TASK_ALWAYS(CHARGER, charger_task, NULL, 1152) \
+ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(CHIPSET, chipset_task, NULL, TRENTA_TASK_STACK_SIZE) \
+ TASK_ALWAYS_RW(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \
+ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1152) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, 1024) \
+ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \
+ TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, 1024) \
+ TASK_ALWAYS_RO(EMMC, emmc_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/bellis/gpio.inc b/board/bellis/gpio.inc
new file mode 100644
index 0000000000..b3cb1934e8
--- /dev/null
+++ b/board/bellis/gpio.inc
@@ -0,0 +1,120 @@
+/* -*- mode:c -*-
+ *
+ * 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.
+ */
+
+/*
+ * Declare symbolic names for all the GPIOs that we care about.
+ * Note: Those with interrupt handlers must be declared first.
+ */
+
+/* Interrupts */
+GPIO_INT(USB_C0_PD_INT_ODL, PIN(B, 1), GPIO_INT_FALLING | GPIO_PULL_UP,
+ tcpc_alert_event)
+GPIO_INT(POWER_BUTTON_L, PIN(A, 11), GPIO_INT_BOTH | GPIO_PULL_UP,
+ power_button_interrupt) /* EC_PWR_BTN_ODL */
+GPIO_INT(AP_IN_SLEEP_L, PIN(C, 12), GPIO_INT_BOTH | GPIO_PULL_DOWN,
+ power_signal_interrupt)
+GPIO_INT(PMIC_EC_RESETB, PIN(B, 7), GPIO_INT_BOTH | GPIO_PULL_DOWN,
+ power_signal_interrupt)
+GPIO_INT(WARM_RESET_REQ, PIN(A, 3), GPIO_INT_RISING | GPIO_PULL_DOWN,
+ chipset_reset_request_interrupt)
+GPIO_INT_RW(ACCEL_INT_ODL, PIN(A, 4), GPIO_INT_FALLING | GPIO_SEL_1P8V | GPIO_PULL_UP,
+ bmi160_interrupt)
+GPIO_INT_RO(EMMC_CMD, PIN(B, 15), GPIO_INT_FALLING,
+ emmc_cmd_interrupt)
+GPIO_INT(SPI1_NSS, PIN(A, 15), GPIO_INT_BOTH | GPIO_PULL_UP,
+ spi_event) /* SPI_AP_EC_CS_L */
+GPIO_INT(LID_OPEN, PIN(C, 5), GPIO_INT_BOTH,
+ lid_interrupt)
+GPIO_INT(AC_PRESENT, PIN(A, 6), GPIO_INT_BOTH,
+ extpower_interrupt) /* ACOK_OD */
+GPIO_INT(BC12_EC_INT_ODL, PIN(C, 9), GPIO_INT_FALLING,
+ bc12_interrupt)
+GPIO_INT(IT8801_SMB_INT, PIN(A, 8), GPIO_INT_FALLING | GPIO_PULL_UP,
+ io_expander_it8801_interrupt) /* KB_INT_ODL */
+GPIO_INT(AP_EC_WATCHDOG_L, PIN(D, 2), GPIO_INT_FALLING,
+ chipset_watchdog_interrupt)
+
+/* Unimplemented interrupts */
+GPIO(ALS_RGB_INT_ODL, PIN(C, 10), GPIO_INPUT)
+GPIO(TABLET_MODE_L, PIN(B, 11), GPIO_INPUT)
+
+/* Reset pins */
+GPIO(AP_SYS_RST_L, PIN(C, 11), GPIO_OUT_LOW)
+GPIO(PMIC_WATCHDOG_L, PIN(A, 2), GPIO_OUT_LOW)
+GPIO(PMIC_EN_ODL, PIN(H, 0), GPIO_ODR_HIGH)
+
+/*
+ * I2C pins should be configured as inputs until I2C module is
+ * initialized. This will avoid driving the lines unintentionally.
+ */
+GPIO(I2C1_SCL, PIN(B, 8), GPIO_INPUT)
+GPIO(I2C1_SDA, PIN(B, 9), GPIO_INPUT)
+GPIO(I2C3_SCL, PIN(C, 0), GPIO_INPUT)
+GPIO(I2C3_SDA, PIN(C, 1), GPIO_INPUT)
+GPIO(I2C4_SCL, PIN(A, 5), GPIO_ODR_HIGH)
+GPIO(I2C4_SDA, PIN(C, 4), GPIO_ODR_HIGH)
+
+/* Analog pins */
+GPIO(BOARD_ID, PIN(A, 0), GPIO_ANALOG)
+GPIO(EC_SKU_ID, PIN(B, 0), GPIO_ANALOG)
+
+/* Other input pins */
+GPIO(WP_L, PIN(C, 8), GPIO_INPUT) /* EC_FLASH_WP_ODL */
+GPIO(BOOT0, PIN(H, 3), GPIO_INPUT)
+GPIO(CCD_MODE_ODL, PIN(A, 1), GPIO_INPUT)
+
+/* Other output pins */
+GPIO(EC_BATT_PRES_ODL, PIN(A, 7), GPIO_INPUT)
+GPIO(EC_BL_EN_OD, PIN(A, 13), GPIO_ODR_HIGH)
+GPIO(EN_USBA_5V, PIN(C, 14), GPIO_OUT_LOW)
+GPIO(EC_SENSOR_SPI_MISO, PIN(C, 2), GPIO_INPUT)
+GPIO(EC_SENSOR_SPI_MOSI, PIN(C, 3), GPIO_OUT_LOW)
+GPIO(EC_SENSOR_SPI_NSS, PIN(B, 12), GPIO_OUT_HIGH)
+GPIO(EC_SENSOR_SPI_CK, PIN(B, 10), GPIO_OUT_LOW)
+GPIO(ENTERING_RW, PIN(C, 6), GPIO_ODR_HIGH) /* EC_ENTERING_RW_ODL */
+GPIO(EC_INT_L, PIN(C, 7), GPIO_ODR_HIGH) /* EC_AP_INT_ODL */
+GPIO(EC_BOARD_ID_EN_L, PIN(C, 15), GPIO_ODR_HIGH) /* EC_BOARD_ID_EN_ODL */
+GPIO(USB_C0_HPD_OD, PIN(H, 1), GPIO_ODR_LOW)
+GPIO(BOOTBLOCK_EN_L, PIN(A, 12), GPIO_ODR_HIGH)
+GPIO(EN_PP1800_S5_L, PIN(A, 14), GPIO_OUT_LOW)
+GPIO(USB_C0_DISCHARGE, PIN(B, 6), GPIO_OUT_LOW)
+
+IOEX(PWR_LED_WHITE_L, EXPIN(0, 1, 4), GPIO_OUT_HIGH)
+IOEX(BAT_LED_GREEN_FULL_L, EXPIN(0, 1, 3), GPIO_OUT_HIGH)
+IOEX(BAT_LED_RED_L, EXPIN(0, 1, 2), GPIO_OUT_HIGH)
+IOEX(KB_BL_EN, EXPIN(0, 0, 7), GPIO_OUT_LOW)
+
+/*
+ * TODO(b:138352732): On IT88801 expander, To be readded once IT8801 driver and
+ * gpio expander framework has landed.
+ */
+UNIMPLEMENTED(EN_PP5000_USBC)
+UNIMPLEMENTED(PMIC_FORCE_RESET_ODL)
+UNIMPLEMENTED(EN_USBC_CHARGE_L)
+
+/* USART1: PA9/PA10 */
+ALTERNATE(PIN_MASK(A, 0x0600), 7, MODULE_UART, 0)
+/* I2C MASTER: PB8/9 */
+ALTERNATE(PIN_MASK(B, 0x0300), 4, MODULE_I2C, GPIO_ODR_HIGH )
+/* I2C MASTER: PC0/C1 */
+ALTERNATE(PIN_MASK(C, 0x0003), 4, MODULE_I2C, GPIO_ODR_HIGH )
+
+
+/* SPI1 */
+/* SPI SLAVE: PB3/4/5 */
+ALTERNATE(PIN_MASK(B, 0x0038), 5, MODULE_SPI, 0)
+/* SPI SLAVE CS: PA15 */
+ALTERNATE(PIN_MASK(A, 0x8000), 5, MODULE_SPI, 0)
+
+/* SPI2 */
+/* Shared between slave for emmc and master for bmi160 */
+/* They're mutually exclusive with gpio_config_module. */
+/* EMMC SPI SLAVE: PB13/14/15 */
+ALTERNATE(PIN_MASK(B, 0xE000), 5, MODULE_SPI_FLASH, 0)
+/* SENSORS SPI MASTER: PB10, PB12, PC2, PC3 */
+ALTERNATE(PIN_MASK(B, 0x0400), 5, MODULE_SPI_MASTER, 0)
+ALTERNATE(PIN_MASK(C, 0x000C), 5, MODULE_SPI_MASTER, 0)
diff --git a/board/bellis/led.c b/board/bellis/led.c
new file mode 100644
index 0000000000..a6a926a958
--- /dev/null
+++ b/board/bellis/led.c
@@ -0,0 +1,115 @@
+/* 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.
+ *
+ * Power and battery LED control for Bellis
+ */
+#include "common.h"
+#include "ioexpander.h"
+#include "driver/ioexpander/it8801.h"
+#include "ec_commands.h"
+#include "led_common.h"
+#include "led_onoff_states.h"
+
+#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+
+__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 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_POWER_LED
+};
+const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
+
+__override void led_set_color_battery(enum ec_led_colors color)
+{
+ switch (color) {
+ case EC_LED_COLOR_GREEN:
+ ioex_set_level(IOEX_BAT_LED_GREEN_FULL_L, LED_ON_LVL);
+ ioex_set_level(IOEX_BAT_LED_RED_L, LED_OFF_LVL);
+ break;
+ case EC_LED_COLOR_AMBER:
+ ioex_set_level(IOEX_BAT_LED_GREEN_FULL_L, LED_ON_LVL);
+ ioex_set_level(IOEX_BAT_LED_RED_L, LED_ON_LVL);
+ break;
+ case EC_LED_COLOR_RED:
+ ioex_set_level(IOEX_BAT_LED_GREEN_FULL_L, LED_OFF_LVL);
+ ioex_set_level(IOEX_BAT_LED_RED_L, LED_ON_LVL);
+ break;
+ default: /* LED_OFF and other unsupported colors */
+ ioex_set_level(IOEX_BAT_LED_GREEN_FULL_L, LED_OFF_LVL);
+ ioex_set_level(IOEX_BAT_LED_RED_L, LED_OFF_LVL);
+ break;
+ }
+}
+
+__override void led_set_color_power(enum ec_led_colors color)
+{
+ switch (color) {
+ case EC_LED_COLOR_WHITE:
+ ioex_set_level(IOEX_PWR_LED_WHITE_L, LED_ON_LVL);
+ break;
+ default:
+ ioex_set_level(IOEX_PWR_LED_WHITE_L, LED_OFF_LVL);
+ break;
+ }
+}
+
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
+{
+ if (led_id == EC_LED_ID_BATTERY_LED) {
+ brightness_range[EC_LED_COLOR_GREEN] = 1;
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ brightness_range[EC_LED_COLOR_RED] = 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 (led_id == EC_LED_ID_BATTERY_LED) {
+ if (brightness[EC_LED_COLOR_GREEN] != 0)
+ led_set_color_battery(EC_LED_COLOR_GREEN);
+ else if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(EC_LED_COLOR_AMBER);
+ else if (brightness[EC_LED_COLOR_RED] != 0)
+ led_set_color_battery(EC_LED_COLOR_RED);
+ 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_power(LED_OFF);
+ } else {
+ return EC_ERROR_INVAL;
+ }
+ return EC_SUCCESS;
+}
diff --git a/board/bellis/vif_override.xml b/board/bellis/vif_override.xml
new file mode 100644
index 0000000000..32736caf64
--- /dev/null
+++ b/board/bellis/vif_override.xml
@@ -0,0 +1,3 @@
+<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
+ Definition from the USB-IF.
+-->