diff options
Diffstat (limited to 'board/eldrid')
-rw-r--r-- | board/eldrid/battery.c | 106 | ||||
-rw-r--r-- | board/eldrid/board.c | 613 | ||||
-rw-r--r-- | board/eldrid/board.h | 183 | ||||
-rw-r--r-- | board/eldrid/build.mk | 19 | ||||
-rw-r--r-- | board/eldrid/ec.tasklist | 26 | ||||
-rw-r--r-- | board/eldrid/gpio.inc | 182 | ||||
-rw-r--r-- | board/eldrid/led.c | 148 | ||||
-rw-r--r-- | board/eldrid/sensors.c | 126 | ||||
-rw-r--r-- | board/eldrid/thermal.c | 210 | ||||
-rw-r--r-- | board/eldrid/vif_override.xml | 3 |
10 files changed, 0 insertions, 1616 deletions
diff --git a/board/eldrid/battery.c b/board/eldrid/battery.c deleted file mode 100644 index 3c9f2b0c21..0000000000 --- a/board/eldrid/battery.c +++ /dev/null @@ -1,106 +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[] = { - /* SMP 996QA193H Battery Information */ - [BATTERY_SIMPLO_HIGHPOWER] = { - .fuel_gauge = { - .manuf_name = "333-1D-11-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 13200, /* mV */ - .voltage_normal = 11550, /* 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 = -20, - .discharging_max_c = 60, - }, - }, - /* Cosmx CA407792G Battery Information */ - [BATTERY_COSMX] = { - .fuel_gauge = { - .manuf_name = "333-AC-11-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 13200, /* mV */ - .voltage_normal = 11550, /* 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 = -10, - .discharging_max_c = 60, - }, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); - -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SIMPLO_HIGHPOWER; - -__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/eldrid/board.c b/board/eldrid/board.c deleted file mode 100644 index 601c23df84..0000000000 --- a/board/eldrid/board.c +++ /dev/null @@ -1,613 +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-specific configuration */ -#include "button.h" -#include "common.h" -#include "accelgyro.h" -#include "cbi_ec_fw_config.h" -#include "charge_state_v2.h" -#include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.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/rt1715.h" -#include "driver/tcpm/tcpci.h" -#include "driver/tcpm/tusb422.h" -#include "extpower.h" -#include "fan.h" -#include "fan_chip.h" -#include "gpio.h" -#include "hooks.h" -#include "isl9241.h" -#include "keyboard_8042_sharedlib.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "keyboard_scan.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 "throttle_ap.h" -#include "uart.h" -#include "usb_mux.h" -#include "usb_pd.h" -#include "usb_pd_tbt.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) - -/* 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 Volteer if the CBI data is not initialized. - */ -union volteer_cbi_fw_config fw_config_defaults = { - .usb_db = DB_USB3_ACTIVE, -}; - -static void board_charger_config(void) -{ - /* - * b/166728543, we configured charger setting to throttle CPU - * when the system loading is at battery current limit. - */ - int reg; - - /* - * Set DCProchot# to 5120mA - */ - isl9241_set_dc_prochot(CHARGER_SOLO, 5120); - - /* - * Set Control1 bit<3> = 1, PSYS = 1 - */ - if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL1, ®) == EC_SUCCESS) { - reg |= ISL9241_CONTROL1_PSYS; - if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL1, reg)) - CPRINTS("Failed to set isl9241"); - } - - /* - * Set Control2 bit<10:9> = 00, PROCHOT# Debounce = 7us - */ - if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL2, ®) == EC_SUCCESS) { - reg &= ~ISL9241_CONTROL2_PROCHOT_DEBOUNCE_MASK; - if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL2, reg)) - CPRINTS("Failed to set isl9241"); - } - - /* - * Set Control4 bit<11> = 1, PSYS Rsense Ratio = 1:1 - */ - if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL4, ®) == EC_SUCCESS) { - reg |= ISL9241_CONTROL4_PSYS_RSENSE_RATIO; - if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS, - ISL9241_REG_CONTROL4, reg)) - CPRINTS("Failed to set isl9241"); - } -} - -static void board_init(void) -{ - pwm_enable(PWM_CH_LED4_SIDESEL, 1); - pwm_set_duty(PWM_CH_LED4_SIDESEL, 100); - board_charger_config(); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - if (port == USBC_PORT_C1) { - if (usb_db == DB_USB4_GEN2) { - /* - * Older boards violate 205mm trace length prior - * to connection to the re-timer and only support up - * to GEN2 speeds. - */ - return TBT_SS_U32_GEN1_GEN2; - } else if (usb_db == DB_USB4_GEN3) { - return TBT_SS_TBT_GEN3; - } - } - - /* - * Thunderbolt-compatible mode not supported - * - * TODO (b/147726366): All the USB-C ports need to support same speed. - * Need to fix once USB-C feature set is known for Volteer. - */ - return TBT_SS_RES_0; -} - -__override bool board_is_tbt_usb4_port(int port) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - /* - * Volteer reference design only supports TBT & USB4 on port 1 - * if the USB4 DB is present. - * - * TODO (b/147732807): All the USB-C ports need to support same - * features. Need to fix once USB-C feature set is known for Volteer. - */ - return ((port == USBC_PORT_C1) - && ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3))); -} - -__override void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - /* - * b/166728543 - * Set different AC_PROCHOT value when using different wattage ADT. - */ - if (max_ma * charge_mv == PD_MAX_POWER_MW * 1000) - isl9241_set_ac_prochot(0, 3840); - else - isl9241_set_ac_prochot(0, 3328); - - /* - * Follow OEM request to limit the input current to - * 90% negotiated limit. - */ - charge_ma = charge_ma * 90 / 100; - - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), - charge_mv); -} - -/******************************************************************************/ -/* 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, - }, -}; - -/******************************************************************************/ -/* 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 = "power", - .port = I2C_PORT_POWER, - .kbps = 100, - .scl = GPIO_EC_I2C5_BATTERY_SCL, - .sda = GPIO_EC_I2C5_BATTERY_SDA, - }, - { - .name = "eeprom", - .port = I2C_PORT_EEPROM, - .kbps = 400, - .scl = GPIO_EC_I2C7_EEPROM_PWR_SCL_R, - .sda = GPIO_EC_I2C7_EEPROM_PWR_SDA_R, - }, -}; -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, - /* - * If using the side select to run both LEDs at the same time, - * the frequency should be 1/2 of the color channel PWM - * frequency to drive each LED equally. - */ - .freq = 2400, - }, - [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); - -/******************************************************************************/ -/* Volteer specific USB daughter-board configuration */ - -/* USBC TCPC configuration for USB3 daughter board */ -static const struct tcpc_config_t tcpc_config_p1_usb3 = { - .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, -}; - -/* - * USB3 DB mux configuration - the top level mux still needs to be set to the - * virtual_usb_mux_driver so the AP gets notified of mux changes and updates - * the TCSS configuration on state changes. - */ -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, -}; - -static const struct usb_mux mux_config_p1_usb3_active = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - .next_mux = &usbc1_usb3_db_retimer, -}; - -static const struct usb_mux mux_config_p1_usb3_passive = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, -}; - -/******************************************************************************/ -/* USB-A charging control */ - -const int usb_port_enable[USB_PORT_COUNT] = { - GPIO_EN_PP5000_USBA, -}; - -static enum gpio_signal ps8xxx_rst_odl = GPIO_USB_C1_RT_RST_ODL; - -static void ps8815_reset(void) -{ - int val; - - gpio_set_level(ps8xxx_rst_odl, 0); - msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, - PS8815_PWR_H_RST_H_DELAY_MS)); - gpio_set_level(ps8xxx_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) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - /* No reset available for TCPC on port 0 */ - /* Daughterboard specific reset for port 1 */ - if (usb_db == DB_USB3_ACTIVE) { - ps8815_reset(); - usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED | - USB_PD_MUX_HPD_IRQ_DEASSERTED); - } -} - -/* - * Set up support for the USB3 daughterboard: - * Parade PS8815 TCPC (integrated retimer) - * Diodes PI3USB9201 BC 1.2 chip (same as USB4 board) - * Silergy SYV682A PPC (same as USB4 board) - * Virtual mux with stacked retimer - */ -static void config_db_usb3_active(void) -{ - tcpc_config[USBC_PORT_C1] = tcpc_config_p1_usb3; - usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3_active; -} - -/* - * Set up support for the passive USB3 daughterboard: - * TUSB422 TCPC (already the default) - * PI3USB9201 BC 1.2 chip (already the default) - * Silergy SYV682A PPC (already the default) - * Virtual mux without stacked retimer - */ - -static void config_db_usb3_passive(void) -{ - usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3_passive; -} - -static void config_port_discrete_tcpc(int port) -{ - /* - * Support 2 Pin-to-Pin compatible parts: TUSB422 and RT1715, for - * simplicity allow either and decide which we are using. - * Default to TUSB422, and switch to RT1715 after BOARD_ID >=1. - */ - if (get_board_id() >= 1) { - CPRINTS("C%d: RT1715", port); - tcpc_config[port].i2c_info.addr_flags = - RT1715_I2C_ADDR_FLAGS; - tcpc_config[port].drv = &rt1715_tcpm_drv; - return; - } - CPRINTS("C%d: Default to TUSB422", port); -} - -static const char *db_type_prefix = "USB DB type: "; -__override void board_cbi_init(void) -{ - enum ec_cfg_usb_db_type usb_db = ec_cfg_usb_db_type(); - - config_port_discrete_tcpc(0); - - switch (usb_db) { - case DB_USB_ABSENT: - CPRINTS("%sNone", db_type_prefix); - break; - case DB_USB4_GEN2: - CPRINTS("%sUSB4 Gen1/2", db_type_prefix); - break; - case DB_USB4_GEN3: - CPRINTS("%sUSB4 Gen3", db_type_prefix); - break; - case DB_USB3_ACTIVE: - config_db_usb3_active(); - CPRINTS("%sUSB3 Active", db_type_prefix); - break; - case DB_USB3_PASSIVE: - config_db_usb3_passive(); - CPRINTS("%sUSB3 Passive", db_type_prefix); - break; - default: - CPRINTS("%sID %d not supported", db_type_prefix, usb_db); - } - - if ((!IS_ENABLED(TEST_BUILD) && !ec_cfg_has_numeric_pad()) || - get_board_id() < 1) - keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD); - - /* - * If keyboard is US2(KB_LAYOUT_1), we need translate right ctrl - * to backslash(\|) key. - */ - if (ec_cfg_keyboard_layout() == KB_LAYOUT_1) - set_scancode_set2(4, 0, get_scancode_set2(2, 7)); -} - -/******************************************************************************/ -/* 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 = TUSB422_I2C_ADDR_FLAGS, - }, - .drv = &tusb422_tcpm_drv, - }, - [USBC_PORT_C1] = { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_USB_C1, - .addr_flags = TUSB422_I2C_ADDR_FLAGS, - }, - .drv = &tusb422_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 */ -struct usb_mux usb_muxes[] = { - [USBC_PORT_C0] = { - .usb_port = USBC_PORT_C0, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - }, - [USBC_PORT_C1] = { - .usb_port = USBC_PORT_C1, - .driver = &virtual_usb_mux_driver, - .hpd_update = &virtual_hpd_update, - }, -}; -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); -} -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/eldrid/board.h b/board/eldrid/board.h deleted file mode 100644 index 8a78f22350..0000000000 --- a/board/eldrid/board.h +++ /dev/null @@ -1,183 +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" - -/* Optional features */ -#undef CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */ -/* - * The RAM and flash size combination on the the NPCX797FC does not leave - * any unused flash space that can be used to store the .init_rom section. - */ -#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 - -/* Chipset features */ -#define CONFIG_POWER_PP5000_CONTROL - -/* LED defines */ -#define CONFIG_LED_ONOFF_STATES -#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10 - -/* Keyboard features */ - -/* - * Disable VOL up/down when tablet mode. - * TODO(b/170966461): Re-enable Vivaldi keyboard once - * 8042 and MKBP drivers can coexist. - */ -#undef CONFIG_KEYBOARD_VIVALDI - -/* Sensors */ -/* BMA253 accelerometer in base */ -#define CONFIG_ACCEL_BMA255 - -/* BMI160 accel/gyro in base */ -#define CONFIG_ACCELGYRO_BMI160 -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(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 - -/* USB Type C and USB PD defines */ -#define CONFIG_USB_PD_PORT_MAX_COUNT 2 - -/* TODO: b/144165680 - measure and check these values on Volteer */ -#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 60000 -#define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_VOLTAGE_MV 20000 - -/* 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 */ -#define CONFIG_CUSTOM_FAN_CONTROL - -/* 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 - -/* - * 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_SLP_S0_L GPIO_SLP_S0_L -#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK -#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_BTN_ODL -#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L - -/* I2C Bus Configuration */ -#define CONFIG_I2C -#define I2C_PORT_ACCEL I2C_PORT_SENSOR -#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_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_SIMPLO_HIGHPOWER, - BATTERY_COSMX, - 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/eldrid/build.mk b/board/eldrid/build.mk deleted file mode 100644 index 868a463932..0000000000 --- a/board/eldrid/build.mk +++ /dev/null @@ -1,19 +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 -board-y+=sensors.o -board-y+=thermal.o diff --git a/board/eldrid/ec.tasklist b/board/eldrid/ec.tasklist deleted file mode 100644 index 292de51cdb..0000000000 --- a/board/eldrid/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/eldrid/gpio.inc b/board/eldrid/gpio.inc deleted file mode 100644 index 1006391c4e..0000000000 --- a/board/eldrid/gpio.inc +++ /dev/null @@ -1,182 +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, bmi160_interrupt) -GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) -/* - * Lid g-sensor interrupt unused on Volteer, configure as regular input for - * power saving. - */ -GPIO(EC_ACCEL_INT, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) - -/* 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_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) - -/* 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 */ -GPIO(EC_PCH_DSW_PWROK, PIN(C, 0), GPIO_OUT_LOW) - -/* 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) -GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt) -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) -GPIO(USB_C0_OC_ODL, PIN(B, 1), GPIO_ODR_HIGH) -GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH) -/* There is currently no need to service this interrupt. */ -GPIO(USB_C1_RT_INT_ODL, PIN(F, 3), GPIO_INPUT) - -/* 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(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH) /* Battery LED: Amber */ -GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* Battery LED: White */ -GPIO(POWER_LED_GATE, PIN(C, 2), GPIO_OUT_LOW) /* Power LED: White */ - -/* - * Despite their names, M2_SSD_PLN and M2_SSD_PLA are active-low, and M2_SSD_PLN - * is open-drain. - * TODO(b/138954381): Change these names when they change on the schematic. - */ -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 acknowledgment */ -GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) /* Case Closed Debug Mode */ -GPIO(EC_SLP_S0IX, PIN(7, 2), GPIO_INPUT | GPIO_PULL_UP) - -/* Unused signals */ -GPIO(UNUSED_GPIO41, PIN(4, 1), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIOF2, PIN(F, 2), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIO96, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIO34, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIOD1, PIN(D, 1), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIOD0, PIN(D, 0), GPIO_INPUT | GPIO_PULL_UP) -GPIO(UNUSED_GPIOD4, PIN(D, 4), GPIO_INPUT | GPIO_PULL_UP) - -/* - * 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_I2C5_BATTERY_SCL, PIN(3, 3), GPIO_INPUT) -GPIO(EC_I2C5_BATTERY_SDA, PIN(3, 6), GPIO_INPUT) -GPIO(EC_I2C7_EEPROM_PWR_SCL_R, PIN(B, 3), GPIO_INPUT) -GPIO(EC_I2C7_EEPROM_PWR_SDA_R, PIN(B, 2), GPIO_INPUT) - -/* Battery signals */ -GPIO(EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT) - -/* 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(3, BIT(3) | BIT(6)), 0, MODULE_I2C, 0) /* I2C5 */ -ALTERNATE(PIN_MASK(B, BIT(3) | BIT(2)), 0, MODULE_I2C, 0) /* I2C7 */ - -/* This selects between an LED module on the motherboard and one on the daughter - * board, to be controlled by LED_{1,2,3}_L. PWM allows driving both modules at - * the same time. */ -ALTERNATE(PIN_MASK(6, BIT(0)), 0, MODULE_PWM, 0) /* LED_SIDESEL_4_L */ - -/* 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) -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 */ diff --git a/board/eldrid/led.c b/board/eldrid/led.c deleted file mode 100644 index 3cbf06c123..0000000000 --- a/board/eldrid/led.c +++ /dev/null @@ -1,148 +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. - */ - -#include "charge_manager.h" -#include "ec_commands.h" -#include "gpio.h" -#include "led_common.h" -#include "led_onoff_states.h" -#include "pwm.h" - -#define BAT_LED_ON_LVL 0 -#define BAT_LED_OFF_LVL 1 - -#define PWR_LED_ON_LVL 1 -#define PWR_LED_OFF_LVL 0 - -/* LED_SIDESEL_4_L=1, MB BAT LED open - * LED_SIDESEL_4_L=0, DB BAT LED open - */ -#define LED_SIDESEL_MB_PORT 0 -#define LED_SIDESEL_DB_PORT 1 - -__override const int led_charge_lvl_1 = 5; - -__override const int led_charge_lvl_2 = 95; - -__override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = { - {EC_LED_COLOR_WHITE, 0.4 * LED_ONE_SEC}, - {LED_OFF, 0.4 * LED_ONE_SEC} - }, - [STATE_FACTORY_TEST] = { - {EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * 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, 1 * LED_ONE_SEC} }, - [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC}, - {LED_OFF, 6 * 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) -{ - int port; - int side_select_duty; - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { - port = charge_manager_get_active_charge_port(); - switch (port) { - case LED_SIDESEL_MB_PORT: - side_select_duty = 0; - break; - case LED_SIDESEL_DB_PORT: - side_select_duty = 100; - break; - default: - /* - * We need to turn off led here since curr.ac won't update - * immediately but led will update every 200ms. - */ - side_select_duty = 50; - color = LED_OFF; - } - - pwm_set_duty(PWM_CH_LED4_SIDESEL, side_select_duty); - } - - switch (color) { - case EC_LED_COLOR_AMBER: - gpio_set_level(GPIO_LED_1_L, BAT_LED_ON_LVL); - gpio_set_level(GPIO_LED_2_L, BAT_LED_OFF_LVL); - break; - case EC_LED_COLOR_WHITE: - gpio_set_level(GPIO_LED_1_L, BAT_LED_OFF_LVL); - gpio_set_level(GPIO_LED_2_L, BAT_LED_ON_LVL); - break; - default: /* LED_OFF and other unsupported colors */ - gpio_set_level(GPIO_LED_1_L, BAT_LED_OFF_LVL); - gpio_set_level(GPIO_LED_2_L, BAT_LED_OFF_LVL); - break; - } -} - -__override void led_set_color_power(enum ec_led_colors color) -{ - if (color == EC_LED_COLOR_WHITE) - gpio_set_level(GPIO_POWER_LED_GATE, PWR_LED_ON_LVL); - else - /* LED_OFF and unsupported colors */ - gpio_set_level(GPIO_POWER_LED_GATE, PWR_LED_OFF_LVL); -} - -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_AMBER] = 1; - brightness_range[EC_LED_COLOR_WHITE] = 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) { - led_auto_control(led_id, 0); - if (brightness[EC_LED_COLOR_AMBER] != 0) - led_set_color_battery(EC_LED_COLOR_AMBER); - else if (brightness[EC_LED_COLOR_WHITE] != 0) - led_set_color_battery(EC_LED_COLOR_WHITE); - 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; -} - diff --git a/board/eldrid/sensors.c b/board/eldrid/sensors.c deleted file mode 100644 index aba3549cca..0000000000 --- a/board/eldrid/sensors.c +++ /dev/null @@ -1,126 +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 family-specific sensor configuration */ -#include "common.h" -#include "accelgyro.h" -#include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi_common.h" -#include "driver/accelgyro_bmi160.h" -#include "driver/sync.h" -#include "keyboard_scan.h" -#include "hooks.h" -#include "i2c.h" -#include "task.h" -#include "tablet_mode.h" -#include "util.h" - -/******************************************************************************/ -/* Sensors */ -static struct mutex g_lid_accel_mutex; -static struct mutex g_base_mutex; - -/* BMA253 private data */ -static struct accelgyro_saved_data_t g_bma253_data; - -/* BMI160 private data */ -static struct bmi_drv_data_t g_bmi160_data; - -/* Rotation matrix for the lid accelerometer */ -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)} -}; - -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_BMA255, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &bma2x2_accel_drv, - .mutex = &g_lid_accel_mutex, - .drv_data = &g_bma253_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMA2x2_I2C_ADDR2_FLAGS, - .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMA255_ACCEL_MIN_FREQ, - .max_frequency = BMA255_ACCEL_MAX_FREQ, - .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_BMI160, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, - .default_range = 4, /* g */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor on in S3 */ - [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_BMI160, - .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_BASE, - .drv = &bmi160_drv, - .mutex = &g_base_mutex, - .drv_data = &g_bmi160_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .default_range = 1000, /* dps */ - .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, - }, -}; -unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static void board_sensors_init(void) -{ - /* Note - BMA253 interrupt unused by EC */ - - /* Enable interrupt for the BMI160 accel/gyro sensor */ - gpio_enable_interrupt(GPIO_EC_IMU_INT_L); -} -DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_DEFAULT); diff --git a/board/eldrid/thermal.c b/board/eldrid/thermal.c deleted file mode 100644 index 4f9ac8796b..0000000000 --- a/board/eldrid/thermal.c +++ /dev/null @@ -1,210 +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. - */ - -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "fan.h" -#include "hooks.h" -#include "host_command.h" -#include "temp_sensor.h" -#include "thermal.h" -#include "util.h" - -/* Console output macros */ -#define CPUTS(outstr) cputs(CC_THERMAL, outstr) -#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args) - - -/******************************************************************************/ -/* 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 (85 C). - * TODO(b/170143672): Have different sensor placement. The temperature need to - * be changed. - */ -const static struct ec_thermal_config thermal_cpu = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(35), - .temp_fan_max = C_TO_K(50), -}; - -/* - * 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 80c - */ -const static struct ec_thermal_config thermal_inductor = { - .temp_host = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(75), - [EC_TEMP_THRESH_HALT] = C_TO_K(80), - }, - .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), - }, - .temp_fan_off = C_TO_K(40), - .temp_fan_max = C_TO_K(55), -}; - -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); - -/******************************************************************************/ -struct fan_step { - /* - * Sensor 1~4 trigger point, set -1 if we're not using this - * sensor to determine fan speed. - */ - int8_t on[TEMP_SENSOR_COUNT]; - - /* - * Sensor 1~4 trigger point, set -1 if we're not using this - * sensor to determine fan speed. - */ - int8_t off[TEMP_SENSOR_COUNT]; - - /* Fan rpm */ - uint16_t rpm[FAN_CH_COUNT]; -}; - -/* - * TODO(b/167931578) Only monitor sensor3 for now. - * Will add more sensors support if needed. - */ -static const struct fan_step fan_table[] = { - { - /* level 0 */ - .on = {-1, -1, 44, -1}, - .off = {-1, -1, 0, -1}, - .rpm = {0}, - }, - { - /* level 1 */ - .on = {-1, -1, 46, -1}, - .off = {-1, -1, 44, -1}, - .rpm = {3200}, - }, - { - /* level 2 */ - .on = {-1, -1, 50, -1}, - .off = {-1, -1, 45, -1}, - .rpm = {3600}, - }, - { - /* level 3 */ - .on = {-1, -1, 54, -1}, - .off = {-1, -1, 49, -1}, - .rpm = {4100}, - }, - { - /* level 4 */ - .on = {-1, -1, 58, -1}, - .off = {-1, -1, 53, -1}, - .rpm = {4900}, - }, - { - /* level 5 */ - .on = {-1, -1, 60, -1}, - .off = {-1, -1, 57, -1}, - .rpm = {5200}, - }, -}; - -int fan_table_to_rpm(int fan, int *temp) -{ - /* current fan level */ - static int current_level; - /* previous fan level */ - static int prev_current_level; - - /* previous sensor temperature */ - static int prev_temp[TEMP_SENSOR_COUNT]; - const int num_fan_levels = ARRAY_SIZE(fan_table); - int i; - int new_rpm = 0; - - /* - * Compare the current and previous temperature, we have - * the three paths : - * 1. decreasing path. (check the release point) - * 2. increasing path. (check the trigger point) - * 3. invariant path. (return the current RPM) - */ - - if (temp[TEMP_SENSOR_3_DDR_SOC] < prev_temp[TEMP_SENSOR_3_DDR_SOC]) { - for (i = current_level; i > 0; i--) { - if (temp[TEMP_SENSOR_3_DDR_SOC] < - fan_table[i].off[TEMP_SENSOR_3_DDR_SOC]) - current_level = i - 1; - else - break; - } - } else if (temp[TEMP_SENSOR_3_DDR_SOC] > - prev_temp[TEMP_SENSOR_3_DDR_SOC]) { - for (i = current_level; i < num_fan_levels; i++) { - if (temp[TEMP_SENSOR_3_DDR_SOC] > - fan_table[i].on[TEMP_SENSOR_3_DDR_SOC]) - current_level = i; - else - break; - } - } - - if (current_level < 0) - current_level = 0; - - if (current_level != prev_current_level) { - CPRINTS("temp: %d, prev_temp: %d", temp[TEMP_SENSOR_3_DDR_SOC], - prev_temp[TEMP_SENSOR_3_DDR_SOC]); - CPRINTS("current_level: %d", current_level); - } - - for (i = 0; i < TEMP_SENSOR_COUNT; ++i) - prev_temp[i] = temp[i]; - - prev_current_level = current_level; - - switch (fan) { - case FAN_CH_0: - new_rpm = fan_table[current_level].rpm[FAN_CH_0]; - break; - default: - break; - } - - return new_rpm; -} - -void board_override_fan_control(int fan, int *temp) -{ - if (chipset_in_state(CHIPSET_STATE_ON)) { - fan_set_rpm_mode(FAN_CH(fan), 1); - fan_set_rpm_target(FAN_CH(fan), - fan_table_to_rpm(fan, temp)); - } else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) { - /* Stop fan when enter S0ix */ - fan_set_rpm_mode(FAN_CH(fan), 1); - fan_set_rpm_target(FAN_CH(fan), 0); - } -} diff --git a/board/eldrid/vif_override.xml b/board/eldrid/vif_override.xml deleted file mode 100644 index 32736caf64..0000000000 --- a/board/eldrid/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. ---> |