summaryrefslogtreecommitdiff
path: root/board/lindar
diff options
context:
space:
mode:
Diffstat (limited to 'board/lindar')
-rw-r--r--board/lindar/battery.c136
-rw-r--r--board/lindar/board.c600
-rw-r--r--board/lindar/board.h171
-rw-r--r--board/lindar/build.mk16
-rw-r--r--board/lindar/ec.tasklist26
-rw-r--r--board/lindar/gpio.inc179
-rw-r--r--board/lindar/ktd20xx.h141
-rw-r--r--board/lindar/led.c793
-rw-r--r--board/lindar/vif_override.xml3
9 files changed, 0 insertions, 2065 deletions
diff --git a/board/lindar/battery.c b/board/lindar/battery.c
deleted file mode 100644
index 503b2f11c0..0000000000
--- a/board/lindar/battery.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright 2020 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 pack vendor provided charging profile
- */
-
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "battery_smart.h"
-#include "common.h"
-#include "util.h"
-
-/*
- * Battery info for all Volteer battery types. Note that the fields
- * start_charging_min/max and charging_min/max are not used for the charger.
- * The effective temperature limits are given by discharging_min/max_c.
- *
- * Fuel Gauge (FG) parameters which are used for determining if the battery
- * is connected, the appropriate ship mode (battery cutoff) command, and the
- * charge/discharge FETs status.
- *
- * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery
- * register. For some batteries, the charge/discharge FET bits are set when
- * charging/discharging is active, in other types, these bits set mean that
- * charging/discharging is disabled. Therefore, in addition to the mask for
- * these bits, a disconnect value must be specified. Note that for TI fuel
- * gauge, the charge/discharge FET status is found in Operation Status (0x54),
- * but a read of Manufacturer Access (0x00) will return the lower 16 bits of
- * Operation status which contains the FET status bits.
- *
- * The assumption for battery types supported is that the charge/discharge FET
- * status can be read with a sb_read() command and therefore, only the register
- * address, mask, and disconnect value need to be provided.
- */
-const struct board_batt_params board_battery_info[] = {
- [BATTERY_SMP] = {
- .fuel_gauge = {
- .manuf_name = "SMP",
- .device_name = "L19M4PG2",
- .ship_mode = {
- .reg_addr = 0x34,
- .reg_data = { 0x0000, 0x1000 },
- },
- .fet = {
- .reg_addr = 0x34,
- .reg_mask = 0x0100,
- .disconnect_val = 0x0100,
- }
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7680, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 332, /* 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,
- },
- },
- [BATTERY_LGC] = {
- .fuel_gauge = {
- .manuf_name = "LGC",
- .device_name = "L19L4PG2",
- .ship_mode = {
- .reg_addr = 0x34,
- .reg_data = { 0x0000, 0x1000 },
- },
- .fet = {
- .reg_addr = 0x34,
- .reg_mask = 0x0100,
- .disconnect_val = 0x0100,
- }
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700, /* mV */
- /*
- * voltage min value and precharge current value are
- * specified by LGC directly and not shown in the SPEC.
- */
- .voltage_min = 6000, /* 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,
- },
- },
- [BATTERY_SUNWODA] = {
- .fuel_gauge = {
- .manuf_name = "SUNWODA",
- .device_name = "L19D4PG2",
- .ship_mode = {
- .reg_addr = 0x34,
- .reg_data = { 0x0000, 0x1000 },
- },
- .fet = {
- .reg_addr = 0x34,
- .reg_mask = 0x0100,
- .disconnect_val = 0x0100,
- }
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7680, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 333, /* 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,
- },
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SMP;
-
-__override bool board_battery_is_initialized(void)
-{
- bool batt_initialization_state;
- int batt_status;
-
- batt_initialization_state = (battery_status(&batt_status) ? false :
- !!(batt_status & STATUS_INITIALIZED));
- return batt_initialization_state;
-}
-
diff --git a/board/lindar/board.c b/board/lindar/board.c
deleted file mode 100644
index 030940cfb1..0000000000
--- a/board/lindar/board.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* Copyright 2020 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.
- */
-
-/* lindar board-specific configuration */
-#include "button.h"
-#include "cbi_ec_fw_config.h"
-#include "common.h"
-#include "driver/accel_lis2dh.h"
-#include "driver/accelgyro_lsm6dsm.h"
-#include "driver/bc12/pi3usb9201.h"
-#include "driver/ppc/sn5s330.h"
-#include "driver/ppc/syv682x.h"
-#include "driver/sync.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/tcpci.h"
-#include "driver/tcpm/rt1715.h"
-#include "driver/tcpm/tusb422.h"
-#include "extpower.h"
-#include "fan.h"
-#include "fan_chip.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "keyboard_scan.h"
-#include "lid_switch.h"
-#include "power.h"
-#include "power_button.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "switch.h"
-#include "system.h"
-#include "task.h"
-#include "tablet_mode.h"
-#include "uart.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-#include "usbc_ppc.h"
-#include "util.h"
-
-#include "gpio_list.h" /* Must come after other header files. */
-
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
-
-/* Keyboard scan setting */
-__override struct keyboard_scan_config keyscan_config = {
- /* Increase from 50 us, because KSO_02 passes through the H1. */
- .output_settle_us = 80,
- /* Other values should be the same as the default configuration. */
- .debounce_down_us = 9 * MSEC,
- .debounce_up_us = 30 * MSEC,
- .scan_period_us = 3 * MSEC,
- .min_post_scan_delay_us = 1000,
- .poll_timeout_us = 100 * MSEC,
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
- },
-};
-
-/******************************************************************************/
-/*
- * FW_CONFIG defaults for Malefor if the CBI data is not initialized.
- */
-union volteer_cbi_fw_config fw_config_defaults = {
- .usb_db = DB_USB3_NO_A,
-};
-
-static void board_init(void)
-{
- if (ec_cfg_has_tabletmode()) {
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_EC_IMU_INT_L);
- } else {
- motion_sensor_count = 0;
- /* Device is clamshell only */
- tablet_set_mode(0, TABLET_TRIGGER_LID);
- /* Gyro is not present, don't allow line to float */
- gpio_set_flags(GPIO_EC_IMU_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
- }
-
- /*
- * TODO: b/154447182 - Malefor will control power LED and battery LED
- * independently, and keep the max brightness of power LED and battery
- * LED as 50%.
- */
- pwm_enable(PWM_CH_LED4_SIDESEL, 1);
- pwm_set_duty(PWM_CH_LED4_SIDESEL, 50);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-int board_is_i2c_port_powered(int port)
-{
- if (port != I2C_PORT_LIGHTBAR)
- return 1;
-
- /*
- * Lightbar rails are off in S5/G3
- * Refer CL-2739008.
- */
- return chipset_in_state(CHIPSET_STATE_ANY_OFF) ? 0 : 1;
-}
-
-int board_is_lid_angle_tablet_mode(void)
-{
- return ec_cfg_has_tabletmode();
-}
-
-/* Enable or disable input devices, based on tablet mode or chipset state */
-__override void lid_angle_peripheral_enable(int enable)
-{
- if (ec_cfg_has_tabletmode()) {
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF) ||
- tablet_get_mode())
- enable = 0;
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
- }
-}
-
-/******************************************************************************/
-/* Sensors */
-/* Lid and base Sensor mutex */
-static struct mutex g_lid_accel_mutex;
-static struct mutex g_base_mutex;
-
-/* Lid and base accel private data */
-static struct stprivate_data g_lis2dh_data;
-static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
-
-/* Matrix to rotate lid and base sensor into standard reference frame */
-static const mat33_fp_t lid_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 base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-struct motion_sensor_t motion_sensors[] = {
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LIS2DE,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &lis2dh_drv,
- .mutex = &g_lid_accel_mutex,
- .drv_data = &g_lis2dh_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LIS2DH_ADDR1_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .min_frequency = LIS2DH_ODR_MIN_VAL,
- .max_frequency = LIS2DH_ODR_MAX_VAL,
- .default_range = 2, /* g, to support tablet mode */
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- /* Sensor on in S3 */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
-
- [BASE_ACCEL] = {
- .name = "Base Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
- .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_EC_IMU_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 13000 | 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 = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
- .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_EC_IMU_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 = &base_standard_ref,
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
- },
-};
-unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-/******************************************************************************/
-/* Physical fans. These are logically separate from pwm_channels. */
-
-const struct fan_conf fan_conf_0 = {
- .flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
- .pgood_gpio = -1,
- .enable_gpio = GPIO_EN_PP5000_FAN,
-};
-
-/*
- * Fan specs from datasheet:
- * Max speed 5900 rpm (+/- 7%), minimum duty cycle 30%.
- * Minimum speed not specified by RPM. Set minimum RPM to max speed (with
- * margin) x 30%.
- * 5900 x 1.07 x 0.30 = 1894, round up to 1900
- */
-const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 1900,
- .rpm_start = 1900,
- .rpm_max = 5900,
-};
-
-const struct fan_t fans[FAN_CH_COUNT] = {
- [FAN_CH_0] = {
- .conf = &fan_conf_0,
- .rpm = &fan_rpm_0,
- },
-};
-
-/******************************************************************************/
-/* EC thermal management configuration */
-
-/*
- * Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
- * 130 C. However, sensor is located next to DDR, so we need to use the lower
- * DDR temperature limit (100 C)
- */
-const static struct ec_thermal_config thermal_cpu = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
- [EC_TEMP_THRESH_HALT] = C_TO_K(100),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85),
- },
- .temp_fan_off = C_TO_K(30),
- .temp_fan_max = C_TO_K(60),
-};
-
-/*
- * Inductor limits - used for both charger and PP3300 regulator
- *
- * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
- *
- * Charger max recommended temperature 100C, max absolute temperature 125C
- * PP3300 regulator: operating range -40 C to 145 C
- *
- * Inductors: limit of 125c
- * PCB: limit is 100c
- */
-const static struct ec_thermal_config thermal_inductor = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90),
- [EC_TEMP_THRESH_HALT] = C_TO_K(100),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85),
- },
- .temp_fan_off = C_TO_K(30),
- .temp_fan_max = C_TO_K(60),
-};
-
-
-struct ec_thermal_config thermal_params[] = {
- [TEMP_SENSOR_1_CHARGER] = thermal_inductor,
- [TEMP_SENSOR_2_PP3300_REGULATOR] = thermal_inductor,
- [TEMP_SENSOR_3_DDR_SOC] = thermal_cpu,
- [TEMP_SENSOR_4_FAN] = thermal_cpu,
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-/******************************************************************************/
-/* MFT channels. These are logically separate from pwm_channels. */
-const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {
- .module = NPCX_MFT_MODULE_1,
- .clk_src = TCKC_LFCLK,
- .pwm_id = PWM_CH_FAN,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
-
-/******************************************************************************/
-/* I2C port map configuration */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C0_SENSOR_SCL,
- .sda = GPIO_EC_I2C0_SENSOR_SDA,
- },
- {
- .name = "usb_c0",
- .port = I2C_PORT_USB_C0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C1_USB_C0_SCL,
- .sda = GPIO_EC_I2C1_USB_C0_SDA,
- },
- {
- .name = "usb_c1",
- .port = I2C_PORT_USB_C1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C2_USB_C1_SCL,
- .sda = GPIO_EC_I2C2_USB_C1_SDA,
- },
- {
- .name = "lightbar",
- .port = I2C_PORT_LIGHTBAR,
- .kbps = 400,
- .scl = GPIO_EC_I2C3_LEDBAR_SCL,
- .sda = GPIO_EC_I2C3_LEDBAR_SDA,
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C5_POWER_SCL,
- .sda = GPIO_EC_I2C5_POWER_SDA,
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C7_EEPROM_SCL,
- .sda = GPIO_EC_I2C7_EEPROM_SDA,
- },
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/******************************************************************************/
-/* PWM configuration */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED4_SIDESEL] = {
- .channel = 7,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- /* Run at a higher frequency than the color PWM signals to avoid
- * timing-based color shifts.
- */
- .freq = 4800,
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
- [PWM_CH_KBLIGHT] = {
- .channel = 3,
- .flags = 0,
- /*
- * Set PWM frequency to multiple of 50 Hz and 60 Hz to prevent
- * flicker. Higher frequencies consume similar average power to
- * lower PWM frequencies, but higher frequencies record a much
- * lower maximum power.
- */
- .freq = 2400,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-
-static void kb_backlight_enable(void)
-{
- if (ec_cfg_has_keyboard_backlight() == 1)
- gpio_set_level(GPIO_EC_KB_BL_EN, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, kb_backlight_enable, HOOK_PRIO_DEFAULT);
-
-static void kb_backlight_disable(void)
-{
- if (ec_cfg_has_keyboard_backlight() == 1)
- gpio_set_level(GPIO_EC_KB_BL_EN, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT);
-
-/* USB-A charging control */
-const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_EN_PP5000_USBA,
-};
-
-static void ps8815_reset(void)
-{
- int val;
-
- gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
- gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
- msleep(PS8815_FW_INIT_DELAY_MS);
-
- /*
- * b/144397088
- * ps8815 firmware 0x01 needs special configuration
- */
-
- CPRINTS("%s: patching ps8815 registers", __func__);
-
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
- CPRINTS("ps8815: reg 0x0f was %02x", val);
-
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
- CPRINTS("ps8815: reg 0x0f set to 0x31");
-
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8751_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
- CPRINTS("ps8815: reg 0x0f now %02x", val);
-}
-
-void board_reset_pd_mcu(void)
-{
- ps8815_reset();
- usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
-}
-
-/******************************************************************************/
-/* USBC PPC configuration */
-struct ppc_config_t ppc_chips[] = {
- [USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv,
- },
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_USB_C1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-/******************************************************************************/
-/* PPC support routines */
-void ppc_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_PPC_INT_ODL:
- sn5s330_interrupt(USBC_PORT_C0);
- break;
- case GPIO_USB_C1_PPC_INT_ODL:
- syv682x_interrupt(USBC_PORT_C1);
- default:
- break;
- }
-}
-
-/******************************************************************************/
-/* BC1.2 charger detect configuration */
-const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
- [USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- },
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_USB_C1,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
-
-/******************************************************************************/
-/* USBC TCPC configuration */
-struct tcpc_config_t tcpc_config[] = {
- [USBC_PORT_C0] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C0,
- .addr_flags = RT1715_I2C_ADDR_FLAGS,
- },
- .drv = &rt1715_tcpm_drv,
- },
- [USBC_PORT_C1] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C1,
- .addr_flags = PS8751_I2C_ADDR1_FLAGS,
- },
- .flags = TCPC_FLAGS_TCPCI_REV2_0
- | TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V,
- .drv = &ps8xxx_tcpm_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
-
-/******************************************************************************/
-/* USBC mux configuration - Tiger Lake includes internal mux */
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
-};
-
-const struct usb_mux usb_muxes[] = {
- [USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = NULL,
- },
- [USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
-
-static void board_tcpc_init(void)
-{
- /* Don't reset TCPCs after initial reset */
- if (!system_jumped_late())
- board_reset_pd_mcu();
-
- /* Enable PPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
-
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
-
- /* Enable BC1.2 interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-
- if (get_board_id() <= 1) {
- tcpc_config[USBC_PORT_C0].i2c_info.addr_flags =
- TUSB422_I2C_ADDR_FLAGS;
- tcpc_config[USBC_PORT_C0].drv = &tusb422_tcpm_drv;
- tcpc_config[USBC_PORT_C0].flags = 0;
- }
-}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
-
-/******************************************************************************/
-/* TCPC support routines */
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- /*
- * Check which port has the ALERT line set
- */
- if (!gpio_get_level(GPIO_USB_C0_TCPC_INT_ODL))
- status |= PD_STATUS_TCPC_ALERT_0;
- if (!gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL))
- status |= PD_STATUS_TCPC_ALERT_1;
-
- return status;
-}
-
-int ppc_get_alert_status(int port)
-{
- if (port == USBC_PORT_C0)
- return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
- else
- return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
-}
diff --git a/board/lindar/board.h b/board/lindar/board.h
deleted file mode 100644
index d89d33582e..0000000000
--- a/board/lindar/board.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Copyright 2020 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.
- */
-
-/* Volteer board configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-/* Baseboard features */
-#include "baseboard.h"
-
-#undef CONFIG_CHIP_INIT_ROM_REGION
-
-#define CONFIG_VBOOT_EFS2
-
-#define CONFIG_POWER_BUTTON
-
-#undef CONFIG_UART_TX_BUF_SIZE
-#define CONFIG_UART_TX_BUF_SIZE 4096
-
-/* LED defines */
-#define CONFIG_LED_ONOFF_STATES
-
-/* Keyboard features */
-
-/* Sensors */
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
-
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- BIT(LID_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_ACCEL_LSM6DSM_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-
-/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-
-
-/*
- * SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
- * cables only support up to 60W.
- */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
-
-#undef CONFIG_USB_MUX_RUNTIME_CONFIG
-
-/* USB Type A Features */
-#define USB_PORT_COUNT 1
-#define CONFIG_USB_PORT_POWER_DUMB
-
-/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
-
-/* BC 1.2 */
-
-/* Volume Button feature */
-
-/* Fan features */
-
-/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
-
-/* Retimer */
-#undef CONFIG_USBC_RETIMER_INTEL_BB
-#undef CONFIG_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG
-
-/* EC console commands */
-#define CONFIG_CMD_TCPC_DUMP
-
-/*
- * Macros for GPIO signals used in common code that don't match the
- * schematic names. Signal names in gpio.inc match the schematic and are
- * then redefined here to so it's more clear which signal is being used for
- * which purpose.
- */
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_RSMRST_L_PGOOD GPIO_PG_EC_RSMRST_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_MUTE_BTN_ODL
-#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
-
-/* I2C Bus Configuration */
-#define CONFIG_I2C
-#define CONFIG_I2C_BUS_MAY_BE_UNPOWERED
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_LIGHTBAR NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define CONFIG_I2C_CONTROLLER
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h"
-#include "registers.h"
-
-enum battery_type {
- BATTERY_SMP,
- BATTERY_LGC,
- BATTERY_SUNWODA,
- BATTERY_TYPE_COUNT,
-};
-
-enum pwm_channel {
- PWM_CH_LED4_SIDESEL = 0,
- PWM_CH_FAN,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
-
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT,
-};
-
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
-
-void board_reset_pd_mcu(void);
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/lindar/build.mk b/board/lindar/build.mk
deleted file mode 100644
index 43b40c644c..0000000000
--- a/board/lindar/build.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- makefile -*-
-# Copyright 2020 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
-#
-
-CHIP:=npcx
-CHIP_FAMILY:=npcx7
-CHIP_VARIANT:=npcx7m7fc
-BASEBOARD:=volteer
-
-board-y=board.o
-board-y+=battery.o
-board-y+=led.o
diff --git a/board/lindar/ec.tasklist b/board/lindar/ec.tasklist
deleted file mode 100644
index 292de51cdb..0000000000
--- a/board/lindar/ec.tasklist
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright 2020 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, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, TASK_STACK_SIZE)
diff --git a/board/lindar/gpio.inc b/board/lindar/gpio.inc
deleted file mode 100644
index 246b83cd3f..0000000000
--- a/board/lindar/gpio.inc
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- mode:c -*-
- *
- * Copyright 2020 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. */
-
-/* Wake Source interrupts */
-GPIO_INT(EC_LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt)
-GPIO_INT(EC_WP_L, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt)
-GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt)
-
-/* Power sequencing interrupts */
-GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#endif
-GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_EC_DSW_PWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_EC_ALL_SYS_PWRGD, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt)
-
-/* Sensor Interrupts */
-GPIO_INT(EC_IMU_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt)
-GPIO(EC_ACCEL_INT_L, PIN(8, 1), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
-
-/* USB-C interrupts */
-GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_BOTH, tcpc_alert_event)
-GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_BOTH, tcpc_alert_event)
-
-GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_BOTH, ppc_interrupt)
-GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_BOTH, ppc_interrupt)
-
-GPIO_INT(USB_C0_BC12_INT_ODL, PIN(E, 4), GPIO_INT_BOTH, bc12_interrupt)
-GPIO_INT(USB_C1_MIX_INT_ODL, PIN(0, 3), GPIO_INT_BOTH, bc12_interrupt)
-
-/* HDMI interrupts */
-
-/* Volume button interrupts */
-GPIO_INT(EC_VOLDN_MUTE_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(EC_VOLUP_BTN_ODL, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-
-/* HW_ID PIN */
-GPIO(HW_ID, PIN(D, 4), GPIO_INPUT)
-
-/* Power Sequencing Signals */
-GPIO(EN_PP3300_A, PIN(A, 3), GPIO_OUT_LOW)
-GPIO(EN_PP5000_A, PIN(A, 4), GPIO_OUT_LOW)
-GPIO(EN_PPVAR_VCCIN, PIN(4, 3), GPIO_OUT_LOW) /* Enables VCCIN IMPV9 */
-
-
-/* The EC does not buffer this signal on Volteer. */
-UNIMPLEMENTED(PCH_DSW_PWROK)
-
-/* Other wake sources */
-/*
- * GPIO_INT_BOTH is required for PSL wake from hibernate, but we don't need an
- * interrupt handler because it is automatically handled by the PSL.
- *
- * We need to lock the setting so this gpio can't be reconfigured to overdrive
- * the real reset signal. (This is the PSL input pin not the real reset pin).
- */
-GPIO(EC_RST_ODL, PIN(0, 2), GPIO_INT_BOTH |
- GPIO_HIB_WAKE_HIGH |
- GPIO_LOCKED)
-
-/* AP/PCH Signals */
-GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
-GPIO(EC_PCH_RSMRST_ODL, PIN(A, 6), GPIO_ODR_LOW) /* TODO - b/140950085 - implement TGL sequencing requirement */
-GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
-GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
-GPIO(EC_ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW)
-GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
-UNIMPLEMENTED(EC_PROCHOT_IN_L)
-GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
-
-GPIO(EC_PCH_INT_ODL, PIN(B, 0), GPIO_ODR_HIGH)
-
-/* USB and USBC Signals */
-GPIO(EN_PP5000_USBA, PIN(C, 6), GPIO_OUT_LOW) /* Enable USB-A charging - all ports */
-GPIO(USB_A_LOW_PWR_OD, PIN(6, 6), GPIO_ODR_LOW) /* Don't limit USB-A charging by default - all ports */
-
-GPIO(USB_C1_RT_RST_ODL, PIN(8, 3), GPIO_ODR_LOW) /* USB_C1 Reset on boards board ID >=1 */
-GPIO(USB_C0_OC_ODL, PIN(B, 1), GPIO_ODR_HIGH)
-GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
-
-/* Don't have a load switch for retimer */
-UNIMPLEMENTED(USB_C1_LS_EN)
-
-/* Misc Signals */
-GPIO(EC_H1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
-GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) /* Case Closed Debug Mode */
-
-/*
- * Despite their names, M2_SSD_PLN and M2_SSD_PLA are active-low, and M2_SSD_PLN
- * is open-drain.
- */
-GPIO(M2_SSD_PLN, PIN(A, 0), GPIO_ODR_HIGH) /* SSD power-loss notification */
-GPIO(M2_SSD_PLA, PIN(7, 0), GPIO_INPUT) /* SSD power-loss acknoledgement */
-
-/*
- * eDP backlight - both PCH and EC have enable pins that must be high
- * for the backlight to turn on. Default state is high, and can be turned
- * off during sleep states.
- */
-GPIO(EC_EDP_BL_EN, PIN(D, 3), GPIO_OUT_HIGH)
-
-/* I2C pins - Alternate function below configures I2C module on these pins */
-GPIO(EC_I2C0_SENSOR_SCL, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(EC_I2C0_SENSOR_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(EC_I2C1_USB_C0_SCL, PIN(9, 0), GPIO_INPUT)
-GPIO(EC_I2C1_USB_C0_SDA, PIN(8, 7), GPIO_INPUT)
-GPIO(EC_I2C2_USB_C1_SCL, PIN(9, 2), GPIO_INPUT)
-GPIO(EC_I2C2_USB_C1_SDA, PIN(9, 1), GPIO_INPUT)
-GPIO(EC_I2C3_LEDBAR_SCL, PIN(D, 1), GPIO_INPUT)
-GPIO(EC_I2C3_LEDBAR_SDA, PIN(D, 0), GPIO_INPUT)
-GPIO(EC_I2C5_POWER_SCL, PIN(3, 3), GPIO_INPUT)
-GPIO(EC_I2C5_POWER_SDA, PIN(3, 6), GPIO_INPUT)
-GPIO(EC_I2C7_EEPROM_SCL, PIN(B, 3), GPIO_INPUT)
-GPIO(EC_I2C7_EEPROM_SDA, PIN(B, 2), GPIO_INPUT)
-
-/* Battery signals */
-GPIO(EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT)
-
-/* LED */
-GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH) /* Battery - Green LED */
-GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* Battery - Red LED */
-GPIO(LED_3_L, PIN(C, 2), GPIO_OUT_HIGH) /* Power - White LED */
-
-/* Alternate functions GPIO definitions */
-ALTERNATE(PIN_MASK(B, BIT(5) | BIT(4)), 0, MODULE_I2C, (GPIO_INPUT | GPIO_SEL_1P8V)) /* I2C0 */
-ALTERNATE(PIN_MASK(9, BIT(0) | BIT(2) | BIT(1)), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */
-ALTERNATE(PIN_MASK(8, BIT(7)), 0, MODULE_I2C, 0) /* I2C1 SDA */
-ALTERNATE(PIN_MASK(D, BIT(1) | BIT(0)), 0, MODULE_I2C, 0) /* I2C3 */
-ALTERNATE(PIN_MASK(3, BIT(3) | BIT(6)), 0, MODULE_I2C, 0) /* I2C5 */
-ALTERNATE(PIN_MASK(B, BIT(3) | BIT(2)), 0, MODULE_I2C, 0) /* I2C7 */
-
-/* Fan signals */
-GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW)
-ALTERNATE(PIN_MASK(B, BIT(7)), 0, MODULE_PWM, 0) /* FAN_PWM */
-ALTERNATE(PIN_MASK(4, BIT(0)), 0, MODULE_PWM, 0) /* FAN_SPEED_TACH */
-
-/* Keyboard pins */
-#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP)
-GPIO(EC_KB_BL_EN, PIN(8, 6), GPIO_OUT_LOW) /* Keyboard backlight */
-ALTERNATE(PIN_MASK(3, 0x03), 0, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* KSI_00-01 */
-ALTERNATE(PIN_MASK(2, 0xFC), 0, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* KSI_02-07 */
-ALTERNATE(PIN_MASK(2, 0x03), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO_00-01 */
-GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW) /* KSO_02 */
-ALTERNATE(PIN_MASK(1, 0x7F), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO_03-09 */
-ALTERNATE(PIN_MASK(0, 0xF0), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO_10-13 */
-ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO_14 */
-ALTERNATE(PIN_MASK(8, BIT(0)), 0, MODULE_PWM, 0) /* EC_KB_BL_PWM */
-
-/* UART */
-ALTERNATE(PIN_MASK(6, BIT(5) | BIT(4)), 0, MODULE_UART, 0) /* UART from EC to Servo */
-
-/* Power Switch Logic (PSL) inputs */
-ALTERNATE(PIN_MASK(D, BIT(2)), 0, MODULE_PMU, 0) /* GPIOD2 = EC_LID_OPEN */
-ALTERNATE(PIN_MASK(0, BIT(0) | BIT(1) | BIT(2)), 0, MODULE_PMU, 0) /* GPIO00 = ACOK_OD,
- GPIO01 = H1_EC_PWR_BTN_ODL
- GPIO02 = EC_RST_ODL */
-
-/* Temperature sensors */
-ALTERNATE(PIN_MASK(4, BIT(2) | BIT(4) | BIT(5)), 0, MODULE_ADC, 0) /* TEMP_SENSOR1,2,4 */
-ALTERNATE(PIN(F, 1), 0, MODULE_ADC, 0) /* TEMP_SENSOR3 */
-
-/* Unused signals */
-GPIO(UNUSED_GPIO60, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(UNUSED_GPIO34, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(UNUSED_GPIO96, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(UNUSED_GPIOF2, PIN(F, 2), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(UNUSED_GPIOF3, PIN(F, 3), GPIO_INPUT | GPIO_PULL_UP)
diff --git a/board/lindar/ktd20xx.h b/board/lindar/ktd20xx.h
deleted file mode 100644
index ad93ee3de8..0000000000
--- a/board/lindar/ktd20xx.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* 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.
- *
- * Public header for Kinetic 36-Channel RGB LED Drivers with I2C control,
- * including KTD2061/58/59/60.
- */
-
-#ifndef __CROS_EC_DRIVER_RGB_LED_DRIVER_KTD20XX_PUBLIC_H
-#define __CROS_EC_DRIVER_RGB_LED_DRIVER_KTD20XX_PUBLIC_H
-
-/*
- * KTD20xx Register Definition
- *
- * Reg0x00: ID Data Register
- * skip...
- * Reg0x01: MONITOR Status Register
- * skip...
- * Reg0x02: CONTROL Configuration Register
- * BIT7:6 is EN_MODE[1:0]
- * 00 = global off, 01 = Night mode,
- * 10 = Normal mode, 11 = reset as default
- * BIT5 is BrightExtendTM Enable
- * 0 = disable/1 = enable
- * BIT4:3 is CoolExtendTM Temperature Setting
- * 00 = 135°C rising, 01 = 120°C
- * 10 = 105°C, 11 = 90°C
- * BIT2:0 is Fade Rate Exponential Time-Constant Setting
- * 000 = 31ms, 001 = 63ms, 010 = 125ms, 011 = 250ms
- * 100 = 500ms, 101 = 1s, 110 = 2s, 111 = 4s
- *
- * Reg0x03: IRED0 Color Configuration Register
- * IRED_SET0[7:0] Red Current Setting 0
- * 0000 0000 = 0μA
- * 0000 0001 = 125μA
- * ...
- * 0010 1000 = 5mA
- * ...
- * 1100 0000 = 24mA
- * 1100 0001 = 24mA (reads back as 1100 0000)
- * ...
- * 1111 1111 = 24mA (reads back as 1100 0000)
- * Reg0x04: IGRN0 Color Configuration Register
- * IGRN_SET0[7:0] Green Current Setting 0
- * Reg0x05: IBLU0 Color Configuration Register
- * IBLU_SET0[7:0] Blue Current Setting 0
- * Reg0x06: IRED1 Color Configuration Register
- * IRED_SET1[7:0] Red Current Setting 1
- * Reg0x07: IGRN1 Color Configuration Register
- * IGRN_SET1[7:0] Green Current Setting 1
- * Reg0x08: IBLU1 Color Configuration Register
- * IBLU_SET1[7:0] Blue Current Setting 1
- *
- * Reg0x09: ISELA12 Selection Configuration Register
- * BIT7 is ENA1, Enable RGB with anode connected to LEDA1 pin
- * 0 = use 0μA for these LEDs (includes fade to 0μA)
- * 1 = use the settings selected by RGBA1_SEL[2:0]
- * BIT6:4 is RGBA1_SEL[2:0]
- * Current Selection for RGB with anode connected to LEDA1 pin
- * 0XX = I LEDA3 selects IRED_SET0[7:0]
- * 1XX = I LEDA3 selects IRED_SET1[7:0]
- * X0X = I LEDA2 selects IGRN_SET0[7:0]
- * X1X = I LEDA2 selects IGRN_SET1[7:0]
- * XX0 = I LEDA4 selects IBLU_SET0[7:0]
- * XX1 = I LEDA4 selects IBLU_SET1[7:0]
- * BIT3 IS ENA2
- * 0 = use 0μA for these LEDs (includes fade to 0μA)
- * 1 = use the settings selected by RGBA2_SEL[2:0]
- * BIT2:0 is RGBA2_SEL[2:0]
- * Current Selection for RGB with anode connected to LEDA2 pin
- * 0XX = I LEDA4 selects IRED_SET0[7:0]
- * 1XX = I LEDA4 selects IRED_SET1[7:0]
- * X0X = I LEDA3 selects IGRN_SET0[7:0]
- * X1X = I LEDA3 selects IGRN_SET1[7:0]
- * XX0 = I LEDA1 selects IBLU_SET0[7:0]
- * XX1 = I LEDA1 selects IBLU_SET1[7:0]
- * Reg0x0A: ISELA34 Selection Configuration Register
- * BIT7 is ENA3, Enable RGB with anode connected to LEDA3 pin
- * 0 = use 0μA for these LEDs (includes fade to 0μA)
- * 1 = use the settings selected by RGBA3_SEL[2:0]
- * BIT6:4 is RGBA3_SEL[2:0]
- * Current Selection for RGB with anode connected to LEDA3 pin
- * 0XX = I LEDA1 selects IRED_SET0[7:0]
- * 1XX = I LEDA1 selects IRED_SET1[7:0]
- * X0X = I LEDA4 selects IGRN_SET0[7:0]
- * X1X = I LEDA4 selects IGRN_SET1[7:0]
- * XX0 = I LEDA2 selects IBLU_SET0[7:0]
- * XX1 = I LEDA2 selects IBLU_SET1[7:0]
- * BIT3 IS ENA4
- * 0 = use 0μA for these LEDs (includes fade to 0μA)
- * 1 = use the settings selected by RGBA4_SEL[2:0]
- * BIT2:0 is RGBA4_SEL[2:0]
- * Current Selection for RGB with anode connected to LEDA4 pin
- * 0XX = I LEDA2 selects IRED_SET0[7:0]
- * 1XX = I LEDA2 selects IRED_SET1[7:0]
- * X0X = I LEDA1 selects IGRN_SET0[7:0]
- * X1X = I LEDA1 selects IGRN_SET1[7:0]
- * XX0 = I LEDA3 selects IBLU_SET0[7:0]
- * XX1 = I LEDA3 selects IBLU_SET1[7:0]
- * Reg0x0B: ISELB12 Selection Configuration Register
- * BIT7 is ENB1, Enable RGB with anode connected to LEDB1 pin
- * 0 = use 0μA for these LEDs (includes fade to 0μA)
- * 1 = use the settings selected by RGB1_SEL[2:0]
- * BIT6:4 is RGBB1_SEL[2:0]
- * Current Selection for RGB with anode connected to LEDB1 pin
- * 0XX = I LEDB3 selects IRED_SET0[7:0]
- * 1XX = I LEDB3 selects IRED_SET1[7:0]
- * X0X = I LEDB2 selects IGRN_SET0[7:0]
- * X1X = I LEDB2 selects IGRN_SET1[7:0]
- * XX0 = I LEDB4 selects IBLU_SET0[7:0]
- * XX1 = I LEDB4 selects IBLU_SET1[7:0]
- * BIT3 IS ENB2
- * ...
- * Reg0x0C: ISELB34 Selection Configuration Register
- * ...
- * Reg0x0D: ISELC12 Selection Configuration Register
- * ...
- * Reg0x0E: ISELC34 Selection Configuration Register
- * ...
- */
-
-enum ktd20xx_register {
- KTD20XX_ID_DATA = 0x00,
- KTD20XX_STATUS_REG = 0x01,
- KTD20XX_CTRL_CFG = 0x02,
- KTD20XX_IRED_SET0 = 0x03,
- KTD20XX_IGRN_SET0 = 0x04,
- KTD20XX_IBLU_SET0 = 0x05,
- KTD20XX_IRED_SET1 = 0x06,
- KTD20XX_IGRN_SET1 = 0x07,
- KTD20XX_IBLU_SET1 = 0x08,
- KTD20XX_ISEL_A12 = 0x09,
- KTD20XX_ISEL_A34 = 0x0A,
- KTD20XX_ISEL_B12 = 0x0B,
- KTD20XX_ISEL_B34 = 0x0C,
- KTD20XX_ISEL_C12 = 0x0D,
- KTD20XX_ISEL_C34 = 0x0E,
- KTD20XX_TOTOAL_REG
-};
-
-#endif /* __CROS_EC_DRIVER_RGB_LED_DRIVER_KTD20XX_PUBLIC_H */
diff --git a/board/lindar/led.c b/board/lindar/led.c
deleted file mode 100644
index 6d602d5c4e..0000000000
--- a/board/lindar/led.c
+++ /dev/null
@@ -1,793 +0,0 @@
-/* Copyright 2020 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 Malefor
- */
-
-#include "cbi_ssfc.h"
-#include "charge_state.h"
-#include "common.h"
-#include "cros_board_info.h"
-#include "extpower.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "i2c.h"
-#include "ktd20xx.h"
-#include "led_common.h"
-#include "led_onoff_states.h"
-#include "lid_switch.h"
-#include "stdbool.h"
-#include "task.h"
-#include "timer.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
-
-__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_power(enum ec_led_colors color)
-{
- if (color == EC_LED_COLOR_WHITE)
- gpio_set_level(GPIO_LED_3_L, LED_ON_LVL);
- else
- /* LED_OFF and unsupported colors */
- gpio_set_level(GPIO_LED_3_L, LED_OFF_LVL);
-}
-
-__override void led_set_color_battery(enum ec_led_colors color)
-{
- switch (color) {
- case EC_LED_COLOR_AMBER:
- gpio_set_level(GPIO_LED_1_L, LED_ON_LVL);
- gpio_set_level(GPIO_LED_2_L, LED_ON_LVL);
- break;
- case EC_LED_COLOR_RED:
- gpio_set_level(GPIO_LED_1_L, LED_OFF_LVL);
- gpio_set_level(GPIO_LED_2_L, LED_ON_LVL);
- break;
- case EC_LED_COLOR_GREEN:
- gpio_set_level(GPIO_LED_1_L, LED_ON_LVL);
- gpio_set_level(GPIO_LED_2_L, LED_OFF_LVL);
- break;
- default: /* LED_OFF and other unsupported colors */
- gpio_set_level(GPIO_LED_1_L, LED_OFF_LVL);
- gpio_set_level(GPIO_LED_2_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_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 (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_power(LED_OFF);
- }
-
- return EC_SUCCESS;
-}
-
-static const uint16_t ktd2061_i2c_addr = 0x68;
-static void controller_write(uint8_t reg, uint8_t val)
-{
- uint8_t buf[2];
-
- buf[0] = reg;
- buf[1] = val;
-
- i2c_xfer_unlocked(I2C_PORT_LIGHTBAR, ktd2061_i2c_addr,
- buf, 2, 0, 0,
- I2C_XFER_SINGLE);
-}
-
-enum lightbar_states {
- LB_STATE_OFF,
- LB_STATE_LID_CLOSE,
- LB_STATE_SLEEP_AC_ONLY,
- LB_STATE_SLEEP_AC_BAT_LOW,
- LB_STATE_SLEEP_AC_BAT_LV1,
- LB_STATE_SLEEP_AC_BAT_LV2,
- LB_STATE_SLEEP_AC_BAT_LV3,
- LB_STATE_SLEEP_AC_BAT_LV4,
- LB_STATE_SLEEP_BAT_LOW,
- LB_STATE_SLEEP_BAT_ONLY,
- LB_STATE_S0_AC_ONLY,
- LB_STATE_S0_BAT_LOW,
- LB_STATE_S0_BAT_LV1,
- LB_STATE_S0_BAT_LV2,
- LB_STATE_S0_BAT_LV3,
- LB_STATE_S0_BAT_LV4,
- LB_NUM_STATES
-};
-
-/*
- * All lightbar states should have one phase defined,
- * and an additional phase can be defined for blinking
- */
-enum lightbar_phase {
- LIGHTBAR_PHASE_0 = 0,
- LIGHTBAR_PHASE_1 = 1,
- LIGHTBAR_NUM_PHASES
-};
-
-enum ec_lightbar_colors {
- BAR_RESET,
- BAR_OFF,
- BAR_COLOR_ORG_20_PERCENT,
- BAR_COLOR_GRN_40_PERCENT,
- BAR_COLOR_GRN_60_PERCENT,
- BAR_COLOR_GRN_80_PERCENT,
- BAR_COLOR_GRN_FULL,
- BAR_COLOR_ORG_FULL,
- LIGHTBAR_COLOR_TOTAL
-};
-
-struct lightbar_descriptor {
- enum ec_lightbar_colors color;
- uint8_t ticks;
-};
-
-#define BAR_INFINITE UINT8_MAX
-#define LIGHTBAR_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
-#define LIGHTBAR_COUNT_FOR_RESUME_FROM_SLEEP (3 * LIGHTBAR_ONE_SEC)
-int lightbar_resume_tick;
-
-const struct lightbar_descriptor
- lb_table[LB_NUM_STATES][LIGHTBAR_NUM_PHASES] = {
- [LB_STATE_OFF] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_LID_CLOSE] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LOW] = {{BAR_COLOR_ORG_20_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV1] = {{BAR_COLOR_GRN_40_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV2] = {{BAR_COLOR_GRN_60_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV3] = {{BAR_COLOR_GRN_80_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV4] = {{BAR_COLOR_GRN_FULL, BAR_INFINITE} },
- [LB_STATE_SLEEP_BAT_LOW] = {{BAR_OFF, 5 * LIGHTBAR_ONE_SEC},
- {BAR_COLOR_ORG_FULL, LIGHTBAR_ONE_SEC} },
- [LB_STATE_SLEEP_BAT_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_S0_AC_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_S0_BAT_LOW] = {{BAR_COLOR_ORG_20_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV1] = {{BAR_COLOR_GRN_40_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV2] = {{BAR_COLOR_GRN_60_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV3] = {{BAR_COLOR_GRN_80_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV4] = {{BAR_COLOR_GRN_FULL, BAR_INFINITE} },
-};
-
-#define DISABLE_LIGHTBAR 0x00
-#define ENABLE_LIGHTBAR 0x80
-#define I_OFF 0x00
-#define GRN_I_ON 0x1E
-#define ORG_I_ON 0x28
-#define SEL_OFF 0x00
-#define SEL_1ST_LED BIT(7)
-#define SEL_2ND_LED BIT(3)
-#define SEL_BOTH (SEL_1ST_LED | SEL_2ND_LED)
-#define SKU_ID_NONE 0x00
-#define SKU_ID_INVALID 0x01
-#define LB_SUPPORTED_SKUID_LOWER 458700
-#define LB_SUPPORTED_SKUID_UPPER 458800
-
-static bool lightbar_is_supported(void)
-{
- static uint32_t skuid = SKU_ID_NONE;
- bool result;
-
- /* lindar add SSFC tag to cbi image from "board_id = 3". */
- if (get_board_id() >= 3) {
- if (get_cbi_ssfc_lightbar() == SSFC_LIGHTBAR_NONE)
- return false;
- return true;
- }
-
- if (skuid == SKU_ID_NONE) {
- if (cbi_get_sku_id(&skuid)) {
- CPRINTS("Cannot get skuid for lightbar supported");
- skuid = SKU_ID_INVALID;
- }
- }
-
- /*
- * If board_id = 1 or 2, it needs to check sku_id to know
- * if system support lightbar or not.
- */
- if (skuid >= LB_SUPPORTED_SKUID_LOWER &&
- skuid <= LB_SUPPORTED_SKUID_UPPER)
- result = true;
- else
- result = false;
-
- return result;
-}
-
-/*
- * lightbar_enter_s0ix_s3:
- * This flag is used to know if system ever enter S0ix/S3.
- * Lightbar V9 SPEC define lightbar resuming behavior, "S0ix/S3 -> S0",
- * but not include "G3/S5/S4 -> S0". "G3/S5/S4 -> S0" need to keep off.
- */
-static bool lightbar_enter_s0ix_s3;
-
-/*
- * lightbar_auto_control:
- * We need some command for testing lightbar in factory.
- * So, create this flag to stop regular action in lightbar_update().
- *
- * lightbar_demo_state:
- * It's used for testing lightbar via executing command under
- * console.
- */
-static bool lightbar_auto_control;
-static enum lightbar_states lightbar_demo_state;
-
-static void lightbar_set_auto_control(bool state)
-{
- lightbar_auto_control = state;
-}
-
-static bool lightbar_is_auto_control(void)
-{
- return lightbar_auto_control;
-}
-
-static void lightbar_set_demo_state(enum lightbar_states tmp_state)
-{
- if (tmp_state >= LB_NUM_STATES || tmp_state < LB_STATE_OFF) {
- lightbar_demo_state = LB_NUM_STATES;
- lightbar_resume_tick = 0;
- } else {
- lightbar_demo_state = tmp_state;
-
- if (lightbar_demo_state >= LB_STATE_S0_AC_ONLY)
- lightbar_resume_tick =
- LIGHTBAR_COUNT_FOR_RESUME_FROM_SLEEP;
- }
- ccprintf("lightbar_demo_state = %d; lightbar_resume_tick %d.\n",
- lightbar_demo_state,
- lightbar_resume_tick);
-}
-
-static enum lightbar_states lightbar_get_demo_state(void)
-{
- /*
- * Once tick count to zero, it needs to return LB_STATE_OFF to
- * simulate lightbar off.
- */
- if ((lightbar_demo_state != LB_NUM_STATES) &&
- (lightbar_demo_state >= LB_STATE_S0_AC_ONLY) &&
- (lightbar_resume_tick == 0))
- return LB_STATE_OFF;
-
- return lightbar_demo_state;
-}
-
-static bool lightbar_is_enabled(void)
-{
- if (!lightbar_is_supported())
- return false;
-
- /*
- * Lightbar's I2C is powered by PP3300_A, and its power will be turn
- * when system enter S4/S5. It may get I2C error if EC keep polling
- * lightbar. We should stop it when EC doesn't turn on PP330_A.
- */
- if (!board_is_i2c_port_powered(I2C_PORT_LIGHTBAR))
- return false;
-
- return true;
-}
-
-/*
- * From "board_id = 3", HW change lightbar circuit, and it only support
- * two colors, orange (amber) and green. It connects KTD20xx's red-channel
- * green color led, and green-channel to orange color led.
- * Blue-channel is unused.
- *
- * The configuration format of lightbar_xx_led_cfg's is as below.
- * ID_DAT, STATUS_REG, CTRL_CFG
- * IRED_SET0, IGRN_SET0, IBLU_SET0, IRED_SET1, IGRN_SET1, IBLU_SET1
- * ISEL_A12, ISEL_A34, ISEL_B12, ISEL_B34, ISEL_C12, ISEL_C34
- */
-const uint8_t lightbar_10_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
- [BAR_RESET] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_OFF] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_ORG_20_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_40_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_60_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_80_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF
- },
- [BAR_COLOR_ORG_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF
- }
-};
-
-const uint8_t lightbar_12_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
- [BAR_RESET] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_OFF] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_ORG_20_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_40_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_60_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_80_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED
- },
- [BAR_COLOR_GRN_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
- },
- [BAR_COLOR_ORG_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
- }
-};
-
-/*
- * lightbar_ctrl is a pointer to 2-dimension lightbar configuration. It's used
- * to base on DUT type to load different cfg.
- * Default is lightbar_10_led_cfg.
- */
-const uint8_t (*lightbar_ctrl)[KTD20XX_TOTOAL_REG] = lightbar_10_led_cfg;
-
-static void lightbar_set_color(enum ec_lightbar_colors color)
-{
- enum ktd20xx_register i;
-
- if (color >= LIGHTBAR_COLOR_TOTAL) {
- CPRINTS("Lightbar Error! Incorrect lightbard color %d", color);
- color = BAR_RESET;
- }
-
- i2c_lock(I2C_PORT_LIGHTBAR, 1);
- for (i = KTD20XX_IRED_SET0; i <= KTD20XX_ISEL_C34; i++)
- controller_write(i, lightbar_ctrl[color][i]);
-
- controller_write(KTD20XX_CTRL_CFG,
- lightbar_ctrl[color][KTD20XX_CTRL_CFG]);
-
- i2c_lock(I2C_PORT_LIGHTBAR, 0);
-}
-
-static void lightbar_init(void)
-{
- if (!lightbar_is_enabled())
- return;
-
- if (get_cbi_ssfc_lightbar() == SSFC_LIGHTBAR_12_LED)
- lightbar_ctrl = lightbar_12_led_cfg;
- else
- lightbar_ctrl = lightbar_10_led_cfg;
-
- /* Clear this flag if system doesn't enter S0ix/S3 */
- lightbar_enter_s0ix_s3 = false;
- lightbar_resume_tick = 0;
-
- lightbar_set_color(BAR_RESET);
-}
-
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, lightbar_init, HOOK_PRIO_DEFAULT);
-
-static void lightbar_sleep_entry(void)
-{
- if (!lightbar_is_enabled())
- return;
-
- lightbar_set_auto_control(true);
- /*
- * Set this flag, then EC'll base on it to set resume tick after
- * S0ix/S3 exit.
- */
- lightbar_enter_s0ix_s3 = true;
- lightbar_resume_tick = 0;
-
- lightbar_set_color(BAR_RESET);
-}
-
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, lightbar_sleep_entry, HOOK_PRIO_DEFAULT);
-
-static void lightbar_sleep_exit(void)
-{
- if (!lightbar_is_enabled())
- return;
-
- lightbar_set_auto_control(true);
- if (lightbar_enter_s0ix_s3)
- lightbar_resume_tick = LIGHTBAR_COUNT_FOR_RESUME_FROM_SLEEP;
- else
- lightbar_resume_tick = 0;
- lightbar_enter_s0ix_s3 = false;
-}
-
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, lightbar_sleep_exit, HOOK_PRIO_DEFAULT);
-
-#define LB_BAT_THRESHOLD_1 16
-#define LB_BAT_THRESHOLD_2 40
-#define LB_BAT_THRESHOLD_3 60
-#define LB_BAT_THRESHOLD_4 80
-
-static enum lightbar_states lightbar_get_state(void)
-{
- enum lightbar_states new_state = LB_NUM_STATES;
- int cur_bat_percent;
-
- cur_bat_percent = charge_get_percent();
-
- if (!lid_is_open())
- return LB_STATE_LID_CLOSE;
-
- if (lightbar_resume_tick) {
- if ((battery_is_present() == BP_YES) &&
- charge_get_display_charge()) {
- if (cur_bat_percent < LB_BAT_THRESHOLD_1)
- new_state = LB_STATE_S0_BAT_LOW;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_2)
- new_state = LB_STATE_S0_BAT_LV1;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_3)
- new_state = LB_STATE_S0_BAT_LV2;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_4)
- new_state = LB_STATE_S0_BAT_LV3;
- else
- new_state = LB_STATE_S0_BAT_LV4;
- } else
- new_state = LB_STATE_S0_AC_ONLY;
- return new_state;
- }
-
- if (!chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- return LB_STATE_OFF;
-
- if (extpower_is_present()) {
- if ((battery_is_present() == BP_YES) &&
- charge_get_display_charge()) {
- if (cur_bat_percent < LB_BAT_THRESHOLD_1)
- new_state = LB_STATE_SLEEP_AC_BAT_LOW;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_2)
- new_state = LB_STATE_SLEEP_AC_BAT_LV1;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_3)
- new_state = LB_STATE_SLEEP_AC_BAT_LV2;
- else if (cur_bat_percent < LB_BAT_THRESHOLD_4)
- new_state = LB_STATE_SLEEP_AC_BAT_LV3;
- else
- new_state = LB_STATE_SLEEP_AC_BAT_LV4;
- } else
- new_state = LB_STATE_SLEEP_AC_ONLY;
- } else {
- if (cur_bat_percent < LB_BAT_THRESHOLD_1)
- new_state = LB_STATE_SLEEP_BAT_LOW;
- else
- new_state = LB_STATE_SLEEP_BAT_ONLY;
- }
-
- return new_state;
-}
-
-#define LIGHTBAR_DEBOUNCE_TICKS 1
-static void lightbar_update(void)
-{
- static uint8_t ticks, period;
- static enum lightbar_states lb_cur_state = LB_NUM_STATES;
- static int debounce_lightbar_state_update;
- enum lightbar_states desired_state;
- int phase;
-
- if (!lightbar_is_enabled())
- return;
-
- if (lightbar_is_auto_control())
- desired_state = lightbar_get_state();
- else {
- desired_state = lightbar_get_demo_state();
- /*
- * Stop to update lb_cur_state if desired_state is equal to
- * LB_NUM_STATES.
- */
- if (desired_state == LB_NUM_STATES)
- return;
- }
-
- if (lightbar_resume_tick)
- lightbar_resume_tick--;
-
- if (desired_state != lb_cur_state &&
- desired_state < LB_NUM_STATES) {
- /* State is changing */
- lb_cur_state = desired_state;
- /* Reset ticks and period when state changes */
- ticks = 0;
-
- period = lb_table[lb_cur_state][LIGHTBAR_PHASE_0].ticks +
- lb_table[lb_cur_state][LIGHTBAR_PHASE_1].ticks;
-
- /*
- * System will be waken up when AC status change in S0ix. Due to
- * EC may be late to update chipset state and cause lightbar
- * flash a while when system transfer to S0. We add to debounce
- * for any lightbar status change.
- * It can make sure lightbar state is ready to to update.
- */
- debounce_lightbar_state_update = LIGHTBAR_DEBOUNCE_TICKS;
- }
-
- /* If this state is undefined, turn lightbar off */
- if (period == 0) {
- CPRINTS("Undefined lightbar behavior for lightbar state %d,"
- "turning off lightbar", lb_cur_state);
- lightbar_set_color(BAR_OFF);
- return;
- }
-
- if (debounce_lightbar_state_update != 0) {
- debounce_lightbar_state_update--;
- return;
- }
-
- /*
- * Determine which phase of the state table to use. The phase is
- * determined if it falls within first phase time duration.
- */
- phase = ticks < lb_table[lb_cur_state][LIGHTBAR_PHASE_0].ticks ? 0 : 1;
- ticks = (ticks + 1) % period;
-
- /* Set the color for the given state and phase */
- lightbar_set_color(lb_table[lb_cur_state][phase].color);
-
-}
-
-DECLARE_HOOK(HOOK_TICK, lightbar_update, HOOK_PRIO_DEFAULT);
-
-/****************************************************************************/
-/* EC console commands for lightbar */
-/****************************************************************************/
-static void lightbar_dump_status(void)
-{
- uint32_t cbi_bid, cbi_skuid;
- int cbi_ssfc_lightbar;
-
- ccprintf("lightbar is %ssupported, %sabled, auto_control: %sabled\n",
- lightbar_is_supported()?"":"un-",
- lightbar_is_enabled()?"en":"dis",
- lightbar_is_auto_control()?"en":"dis");
-
- cbi_bid = get_board_id();
- cbi_get_sku_id(&cbi_skuid);
- cbi_ssfc_lightbar = get_cbi_ssfc_lightbar();
- ccprintf("board id = %d, skuid = %d, ssfc_lightbar = %d\n",
- cbi_bid,
- cbi_skuid,
- cbi_ssfc_lightbar);
-}
-
-#ifdef CONFIG_CONSOLE_CMDHELP
-static int help(const char *cmd)
-{
- ccprintf("Usage:\n");
- ccprintf(" %s - dump lightbar status\n", cmd);
- ccprintf(" %s on - set on lightbar auto control\n",
- cmd);
- ccprintf(" %s off - set off lightbar auto control\n",
- cmd);
- ccprintf(" %s demo [%x - %x] - demo lightbar state\n",
- cmd, LB_STATE_OFF, (LB_NUM_STATES - 1));
- return EC_SUCCESS;
-}
-#endif
-
-static int command_lightbar(int argc, char **argv)
-{
- /* no args = dump lightbar status */
- if (argc == 1) {
- lightbar_dump_status();
- return EC_SUCCESS;
- }
-
- if (!strcasecmp(argv[1], "help")) {
- #ifdef CONFIG_CONSOLE_CMDHELP
- help(argv[0]);
- #endif
- return EC_SUCCESS;
- }
-
- if (!lightbar_is_enabled()) {
- lightbar_dump_status();
- return EC_ERROR_UNIMPLEMENTED;
- }
-
- if (!strcasecmp(argv[1], "on")) {
- lightbar_set_auto_control(true);
- return EC_SUCCESS;
- }
-
- if (!strcasecmp(argv[1], "off")) {
- lightbar_set_auto_control(false);
- lightbar_set_demo_state(LB_NUM_STATES);
- return EC_SUCCESS;
- }
-
- if (!strcasecmp(argv[1], "demo")) {
- int lb_demo_state;
- char *e;
-
- /* Need to disable auto_control before demo */
- if (lightbar_is_auto_control()) {
- ccprintf("Please set off auto control before demo.\n");
- return EC_ERROR_ACCESS_DENIED;
- }
-
- lb_demo_state = 0xff & strtoi(argv[2], &e, 16);
- lightbar_set_demo_state(lb_demo_state);
- return EC_SUCCESS;
- }
-
-#ifdef CONFIG_CONSOLE_CMDHELP
- help(argv[0]);
-#endif
-
- return EC_ERROR_INVAL;
-}
-
-DECLARE_CONSOLE_COMMAND(lightbar, command_lightbar,
- "[help | on | off | demo]",
- "get/set lightbar status");
-
-/****************************************************************************/
-/* EC host commands (ectool) for lightbar */
-/****************************************************************************/
-static enum ec_status lpc_cmd_lightbar(struct host_cmd_handler_args *args)
-{
- const struct ec_params_lightbar *in = args->params;
- int lb_demo_state;
-
- /*
- * HOST_CMD is binded with ectool. From ectool.c, it already define
- * command format.
- * We only base on "off", "on", and "seq" to do what we can do
- * now.
- * Originally, I expect to use "demo", but it limit "in->demo.num"
- * within 0~1. So, adopt "seq" command for basic testing.
- */
- switch (in->cmd) {
- case LIGHTBAR_CMD_OFF:
- lightbar_set_auto_control(false);
- lightbar_set_demo_state(LB_NUM_STATES);
- break;
- case LIGHTBAR_CMD_ON:
- lightbar_set_auto_control(true);
- break;
- case LIGHTBAR_CMD_SEQ:
- lb_demo_state = in->seq.num;
- if (lightbar_is_auto_control()) {
- CPRINTS("Please set off auto control before demo.");
- return EC_RES_ACCESS_DENIED;
- }
- lightbar_set_demo_state(lb_demo_state);
- break;
- default:
- CPRINTS("LB bad cmd 0x%x", in->cmd);
- return EC_RES_INVALID_PARAM;
- }
-
- return EC_RES_SUCCESS;
-}
-
-DECLARE_HOST_COMMAND(EC_CMD_LIGHTBAR_CMD,
- lpc_cmd_lightbar,
- EC_VER_MASK(0));
diff --git a/board/lindar/vif_override.xml b/board/lindar/vif_override.xml
deleted file mode 100644
index 32736caf64..0000000000
--- a/board/lindar/vif_override.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
- Definition from the USB-IF.
--->