summaryrefslogtreecommitdiff
path: root/board/dooly
diff options
context:
space:
mode:
Diffstat (limited to 'board/dooly')
-rw-r--r--board/dooly/board.c1187
-rw-r--r--board/dooly/board.h344
-rw-r--r--board/dooly/build.mk15
-rw-r--r--board/dooly/ec.tasklist20
-rw-r--r--board/dooly/gpio.inc179
-rw-r--r--board/dooly/led.c264
-rw-r--r--board/dooly/usb_pd_policy.c84
-rw-r--r--board/dooly/vif_override.xml3
8 files changed, 0 insertions, 2096 deletions
diff --git a/board/dooly/board.c b/board/dooly/board.c
deleted file mode 100644
index b28f3d41b8..0000000000
--- a/board/dooly/board.c
+++ /dev/null
@@ -1,1187 +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.
- */
-
-/* Dooly board-specific configuration */
-
-#include "accelgyro.h"
-#include "adc.h"
-#include "button.h"
-#include "charge_manager.h"
-#include "charge_state_v2.h"
-#include "chipset.h"
-#include "common.h"
-#include "core/cortex-m/cpu.h"
-#include "cros_board_info.h"
-#include "driver/accel_bma2x2.h"
-#include "driver/als_tcs3400.h"
-#include "driver/ina3221.h"
-#include "driver/led/oz554.h"
-#include "driver/ppc/sn5s330.h"
-#include "driver/tcpm/anx7447.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/tcpci.h"
-#include "ec_commands.h"
-#include "extpower.h"
-#include "fan.h"
-#include "fan_chip.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "lid_switch.h"
-#include "power.h"
-#include "power/cometlake-discrete.h"
-#include "power_button.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "spi.h"
-#include "switch.h"
-#include "system.h"
-#include "task.h"
-#include "temp_sensor.h"
-#include "thermal.h"
-#include "temp_sensor/thermistor.h"
-#include "uart.h"
-#include "usb_charge.h"
-#include "usb_common.h"
-#include "usb_pd.h"
-#include "usbc_ppc.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-/* Sensors */
-static struct mutex g_accel_mutex;
-static struct accelgyro_saved_data_t g_bma253_data;
-
-/* TCS3400 private data */
-static struct als_drv_data_t g_tcs3400_data = {
- .als_cal.scale = 1,
- .als_cal.uscale = 0,
- .als_cal.offset = 0,
- .als_cal.channel_scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc */
- .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */
- },
-};
-static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
- /*
- * TODO: calculate the actual coefficients and scaling factors
- */
- .calibration.rgb_cal[X] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
- },
- .calibration.rgb_cal[Y] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.1),
- },
- .calibration.rgb_cal[Z] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0),
- },
- .calibration.irt = INT_TO_FP(1),
- .saturation.again = TCS_DEFAULT_AGAIN,
- .saturation.atime = TCS_DEFAULT_ATIME,
-};
-
-const mat33_fp_t screen_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-struct motion_sensor_t motion_sensors[] = {
- [SCREEN_ACCEL] = {
- .name = "Screen 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_accel_mutex,
- .drv_data = &g_bma253_data,
- .port = I2C_PORT_SENSORS,
- .i2c_spi_addr_flags = BMA2x2_I2C_ADDR2_FLAGS,
- .rot_standard_ref = &screen_standard_ref,
- .default_range = 2,
- .min_frequency = BMA255_ACCEL_MIN_FREQ,
- .max_frequency = BMA255_ACCEL_MAX_FREQ,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
- [CLEAR_ALS] = {
- .name = "Clear Light",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_TCS3400,
- .type = MOTIONSENSE_TYPE_LIGHT,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &tcs3400_drv,
- .drv_data = &g_tcs3400_data,
- .port = I2C_PORT_SENSORS,
- .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
- .rot_standard_ref = NULL,
- .default_range = 0x10000, /* scale = 1x, uscale = 0 */
- .min_frequency = TCS3400_LIGHT_MIN_FREQ,
- .max_frequency = TCS3400_LIGHT_MAX_FREQ,
- .config = {
- /* Run ALS sensor in S0 */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 1000,
- },
- },
- },
- [RGB_ALS] = {
- .name = "RGB Light",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_TCS3400,
- .type = MOTIONSENSE_TYPE_LIGHT_RGB,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &tcs3400_rgb_drv,
- .drv_data = &g_tcs3400_rgb_data,
- .rot_standard_ref = NULL,
- .default_range = 0x10000, /* scale = 1x, uscale = 0 */
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
-const struct motion_sensor_t *motion_als_sensors[] = {
- &motion_sensors[CLEAR_ALS],
-};
-BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
-
-static void power_monitor(void);
-DECLARE_DEFERRED(power_monitor);
-
-/* On ECs without an FPU, the fp_t type is backed by a 32-bit fixed precision
- * representation that can only store values in the range [-32K, +32K]. Some
- * intermediary values produced in tcs3400_translate_to_xyz() do not fit in
- * that range, so we define and use a 64-bit fixed representation instead.
- */
-typedef int64_t fp64_t;
-#define INT_TO_FP64(x) ((int64_t)(x) << 32)
-#define FP64_TO_INT(x) ((x) >> 32)
-#define FLOAT_TO_FP64(x) ((int64_t)((x) * (float)(1LL << 32)))
-
-__override void tcs3400_translate_to_xyz(struct motion_sensor_t *s,
- int32_t *crgb_data, int32_t *xyz_data)
-{
- struct tcs_saturation_t *sat_p =
- &(TCS3400_RGB_DRV_DATA(s+1)->saturation);
-
- int32_t cur_gain = (1 << (2 * sat_p->again));
- int32_t integration_time_us =
- tcs3400_get_integration_time(sat_p->atime);
-
- fp64_t c_coeff, r_coeff, g_coeff, b_coeff;
- fp64_t result;
-
- /* Use different coefficients based on n_interval = (G+B)/C */
- fp64_t gb_sum = INT_TO_FP64(crgb_data[2]) +
- INT_TO_FP64(crgb_data[3]);
- fp64_t n_interval = gb_sum / MAX(crgb_data[0], 1);
-
- if (n_interval < FLOAT_TO_FP64(0.692)) {
- const float scale = 799.797;
-
- c_coeff = FLOAT_TO_FP64(0.009 * scale);
- r_coeff = FLOAT_TO_FP64(0.056 * scale);
- g_coeff = FLOAT_TO_FP64(2.735 * scale);
- b_coeff = FLOAT_TO_FP64(-1.903 * scale);
- } else if (n_interval < FLOAT_TO_FP64(1.012)) {
- const float scale = 801.347;
-
- c_coeff = FLOAT_TO_FP64(0.202 * scale);
- r_coeff = FLOAT_TO_FP64(-1.1 * scale);
- g_coeff = FLOAT_TO_FP64(8.692 * scale);
- b_coeff = FLOAT_TO_FP64(-7.068 * scale);
- } else {
- const float scale = 795.574;
-
- c_coeff = FLOAT_TO_FP64(-0.661 * scale);
- r_coeff = FLOAT_TO_FP64(1.334 * scale);
- g_coeff = FLOAT_TO_FP64(1.095 * scale);
- b_coeff = FLOAT_TO_FP64(-1.821 * scale);
- }
-
- /* Multiply each channel by the coefficient and compute the sum.
- * Note: int * fp64_t = fp64_t and fp64_t + fp64_t = fp64_t.
- */
- result = crgb_data[0] * c_coeff +
- crgb_data[1] * r_coeff +
- crgb_data[2] * g_coeff +
- crgb_data[3] * b_coeff;
-
- /* Adjust for exposure time and sensor gain.
- * Note: fp64_t / int = fp64_t.
- */
- result /= MAX(integration_time_us * cur_gain / 1000, 1);
-
- /* Some C/R/G/B coefficients are negative, so the result could also be
- * negative and must be clamped at zero.
- *
- * The value of xyz_data[1] is stored in a 16 bit integer later on, so
- * it must be clamped at INT16_MAX.
- */
- xyz_data[1] = MIN(MAX(FP64_TO_INT(result), 0), INT16_MAX);
-}
-
-static void ppc_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_TCPPC_INT_ODL:
- sn5s330_interrupt(USB_PD_PORT_TCPC_0);
- break;
- case GPIO_USB_C1_TCPPC_INT_ODL:
- sn5s330_interrupt(USB_PD_PORT_TCPC_1);
- break;
- default:
- break;
- }
-}
-
-int ppc_get_alert_status(int port)
-{
- int status = 0;
-
- switch (port) {
- case USB_PD_PORT_TCPC_0:
- status = gpio_get_level(GPIO_USB_C0_TCPPC_INT_ODL) == 0;
- break;
- case USB_PD_PORT_TCPC_1:
- status = gpio_get_level(GPIO_USB_C1_TCPPC_INT_ODL) == 0;
- break;
- default:
- break;
- }
- return status;
-}
-
-static void tcpc_alert_event(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_TCPC_INT_ODL:
- schedule_deferred_pd_interrupt(USB_PD_PORT_TCPC_0);
- break;
- case GPIO_USB_C1_TCPC_INT_ODL:
- schedule_deferred_pd_interrupt(USB_PD_PORT_TCPC_1);
- break;
- default:
- break;
- }
-}
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
- int level;
-
- /*
- * Check which port has the ALERT line set and ignore if that TCPC has
- * its reset line active.
- */
- if (!gpio_get_level(GPIO_USB_C0_TCPC_INT_ODL)) {
- level = !!(tcpc_config[USB_PD_PORT_TCPC_0].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
- if (gpio_get_level(GPIO_USB_C0_TCPC_RST) != level)
- status |= PD_STATUS_TCPC_ALERT_0;
- }
- if (!gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL)) {
- level = !!(tcpc_config[USB_PD_PORT_TCPC_1].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
- if (gpio_get_level(GPIO_USB_C1_TCPC_RST) != level)
- status |= PD_STATUS_TCPC_ALERT_1;
- }
-
- return status;
-}
-
-/* Called when the charge manager has switched to a new port. */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
-{
- /* Blink alert if insufficient power per system_can_boot_ap(). */
- int insufficient_power =
- (charge_ma * charge_mv) <
- (CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
- led_alert(insufficient_power);
-}
-
-static uint8_t usbc_0_overcurrent;
-static uint8_t usbc_1_overcurrent;
-static int32_t base_5v_power;
-
-/*
- * Power usage for each port as measured or estimated.
- * Units are milliwatts (5v x ma current)
- */
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1603)
-#define PWR_FRONT_LOW (5*963)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
-
-/*
- * Update the 5V power usage, assuming no throttling,
- * and invoke the power monitoring.
- */
-static void update_5v_usage(void)
-{
- int front_ports = 0;
- /*
- * Recalculate the 5V load, assuming no throttling.
- */
- base_5v_power = PWR_BASE_LOAD;
- if (!gpio_get_level(GPIO_USB_A0_OC_ODL)) {
- front_ports++;
- base_5v_power += PWR_FRONT_LOW;
- }
- if (!gpio_get_level(GPIO_USB_A1_OC_ODL)) {
- front_ports++;
- base_5v_power += PWR_FRONT_LOW;
- }
- /*
- * Only 1 front port can run higher power at a time.
- */
- if (front_ports > 0)
- base_5v_power += PWR_FRONT_HIGH - PWR_FRONT_LOW;
- if (usbc_0_overcurrent)
- base_5v_power += PWR_C_HIGH;
- if (usbc_1_overcurrent)
- base_5v_power += PWR_C_HIGH;
- /*
- * Invoke the power handler immediately.
- */
- hook_call_deferred(&power_monitor_data, 0);
-}
-DECLARE_DEFERRED(update_5v_usage);
-/*
- * Start power monitoring after ADCs have been initialised.
- */
-DECLARE_HOOK(HOOK_INIT, update_5v_usage, HOOK_PRIO_INIT_ADC + 1);
-
-static void port_ocp_interrupt(enum gpio_signal signal)
-{
- hook_call_deferred(&update_5v_usage_data, 0);
-}
-
-/******************************************************************************/
-/*
- * Barrel jack power supply handling
- *
- * EN_PPVAR_BJ_ADP_L must default active to ensure we can power on when the
- * barrel jack is connected, and the USB-C port can bring the EC up fine in
- * dead-battery mode. Both the USB-C and barrel jack switches do reverse
- * protection, so we're safe to turn one on then the other off- but we should
- * only do that if the system is off since it might still brown out.
- */
-
-/*
- * Barrel-jack power adapter ratings.
- */
-static const struct {
- int voltage;
- int current;
-} bj_power[] = {
- { /* 0 - 65W (also default) */
- .voltage = 19500,
- .current = 3200
- },
- { /* 1 - 90W */
- .voltage = 19500,
- .current = 4600
- },
-};
-
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
-/* Debounced connection state of the barrel jack */
-static int8_t adp_connected = -1;
-static void adp_connect_deferred(void)
-{
- struct charge_port_info pi = { 0 };
- int connected = !gpio_get_level(GPIO_BJ_ADP_PRESENT_L);
-
- /* Debounce */
- if (connected == adp_connected)
- return;
- if (connected) {
- unsigned int bj = ec_config_get_bj_power();
-
- pi.voltage = bj_power[bj].voltage;
- pi.current = bj_power[bj].current;
- }
- charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
- DEDICATED_CHARGE_PORT, &pi);
- adp_connected = connected;
-}
-DECLARE_DEFERRED(adp_connect_deferred);
-
-/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */
-void adp_connect_interrupt(enum gpio_signal signal)
-{
- hook_call_deferred(&adp_connect_deferred_data, ADP_DEBOUNCE_MS * MSEC);
-}
-
-static void adp_state_init(void)
-{
- /*
- * Initialize all charge suppliers to 0. The charge manager waits until
- * all ports have reported in before doing anything.
- */
- for (int i = 0; i < CHARGE_PORT_COUNT; i++) {
- for (int j = 0; j < CHARGE_SUPPLIER_COUNT; j++)
- charge_manager_update_charge(j, i, NULL);
- }
-
- /* Report charge state from the barrel jack. */
- adp_connect_deferred();
-}
-DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1);
-
-
-#include "gpio_list.h" /* Must come after other header files. */
-
-/******************************************************************************/
-/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
-const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
-
-/******************************************************************************/
-/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
-};
-
-/******************************************************************************/
-/* USB-C TCPC Configuration */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC0,
- .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
- },
- .drv = &anx7447_tcpm_drv,
- .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
- },
- [USB_PD_PORT_TCPC_1] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_TCPC1,
- .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
- },
- .drv = &anx7447_tcpm_drv,
- .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
- },
-};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
- },
- [USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
- },
-};
-
-/******************************************************************************/
-/* I2C port map configuration */
-const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"ppc1", I2C_PORT_PPC1, 400, GPIO_I2C2_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C4_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-const struct adc_t adc_channels[] = {
- [ADC_SNS_PP3300] = {
- /*
- * 4700/5631 voltage divider: can take the value out of range
- * for 32-bit signed integers, so truncate to 470/563 yielding
- * <0.1% error and a maximum intermediate value of 1623457792,
- * which comfortably fits in int32.
- */
- .name = "SNS_PP3300",
- .input_ch = NPCX_ADC_CH2,
- .factor_mul = ADC_MAX_VOLT * 563,
- .factor_div = (ADC_READ_MAX + 1) * 470,
- },
- [ADC_SNS_PP1050] = {
- .name = "SNS_PP1050",
- .input_ch = NPCX_ADC_CH7,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- },
- [ADC_VBUS] = { /* 5/39 voltage divider */
- .name = "VBUS",
- .input_ch = NPCX_ADC_CH4,
- .factor_mul = ADC_MAX_VOLT * 39,
- .factor_div = (ADC_READ_MAX + 1) * 5,
- },
- [ADC_PPVAR_IMON] = { /* 500 mV/A */
- .name = "PPVAR_IMON",
- .input_ch = NPCX_ADC_CH9,
- .factor_mul = ADC_MAX_VOLT * 2, /* Milliamps */
- .factor_div = ADC_READ_MAX + 1,
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR_1",
- .input_ch = NPCX_ADC_CH0,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {
- .name = "PP3300",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-/******************************************************************************/
-/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-
-/******************************************************************************/
-/* 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 = -1,
-};
-
-const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 1900,
- .rpm_start = 2400,
- .rpm_max = 4300,
-};
-
-const struct fan_t fans[] = {
- [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, },
-};
-BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
-
-/******************************************************************************/
-/* MFT channels. These are logically separate from pwm_channels. */
-const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
-};
-BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
-
-/******************************************************************************/
-/* Thermal control; drive fan based on temperature sensors. */
-const static struct ec_thermal_config thermal_a = {
- .temp_host = {
- [EC_TEMP_THRESH_WARN] = 0,
- [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
- [EC_TEMP_THRESH_HALT] = C_TO_K(78),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_WARN] = 0,
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65),
- [EC_TEMP_THRESH_HALT] = 0,
- },
- .temp_fan_off = C_TO_K(41),
- .temp_fan_max = C_TO_K(72),
-};
-
-struct ec_thermal_config thermal_params[] = {
- [TEMP_SENSOR_1] = thermal_a,
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-/* Power sensors */
-const struct ina3221_t ina3221[] = {
- { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } },
- { I2C_PORT_INA, 0x42, { "PP3300_A", "PP3300_SSD", "PP3300_LAN" } },
- { I2C_PORT_INA, 0x43, { NULL, "PP1200_U", "PP2500_DRAM" } }
-};
-const unsigned int ina3221_count = ARRAY_SIZE(ina3221);
-
-static uint16_t board_version;
-static uint32_t sku_id;
-static uint32_t fw_config;
-
-static void cbi_init(void)
-{
- /*
- * Load board info from CBI to control per-device configuration.
- *
- * If unset it's safe to treat the board as a proto, just C10 gating
- * won't be enabled.
- */
- uint32_t val;
-
- if (cbi_get_board_version(&val) == EC_SUCCESS && val <= UINT16_MAX)
- board_version = val;
- if (cbi_get_sku_id(&val) == EC_SUCCESS)
- sku_id = val;
- if (cbi_get_fw_config(&val) == EC_SUCCESS)
- fw_config = val;
- CPRINTS("Board Version: %d, SKU ID: 0x%08x, F/W config: 0x%08x",
- board_version, sku_id, fw_config);
-}
-DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
-
-static void board_init(void)
-{
- uint8_t *memmap_batt_flags;
-
- /* Override some GPIO interrupt priorities.
- *
- * These interrupts are timing-critical for AP power sequencing, so we
- * increase their NVIC priority from the default of 3. This affects
- * whole MIWU groups of 8 GPIOs since they share an IRQ.
- *
- * Latency at the default priority level can be hundreds of
- * microseconds while other equal-priority IRQs are serviced, so GPIOs
- * requiring faster response must be higher priority.
- */
- /* CPU_C10_GATE_L on GPIO6.7: must be ~instant for ~60us response. */
- cpu_set_interrupt_priority(NPCX_IRQ_WKINTH_1, 1);
- /*
- * slp_s3_interrupt (GPIOA.5 on WKINTC_0) must respond within 200us
- * (tPLT18); less critical than the C10 gate.
- */
- cpu_set_interrupt_priority(NPCX_IRQ_WKINTC_0, 2);
-
- gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_L);
-
- /* Enable interrupt for the TCS3400 color light sensor */
- gpio_enable_interrupt(GPIO_ALS_GSENSOR_INT_ODL);
-
- /* Always claim AC is online, because we don't have a battery. */
- memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG);
- *memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT;
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-static void board_chipset_startup(void)
-{
- /*
- * Workaround to restore VBUS on PPC.
- * PP1 is sourced from PP5000_A, and when the CPU shuts down and
- * this rail drops, the PPC will internally turn off PP1_EN.
- * When the CPU starts again, and the rail is restored, the PPC
- * does not turn PP1_EN on again, causing VBUS to stay turned off.
- * The workaround is to check whether the PPC is sourcing VBUS, and
- * if so, make sure it is enabled.
- */
- if (ppc_is_sourcing_vbus(USB_PD_PORT_TCPC_0))
- ppc_vbus_source_enable(USB_PD_PORT_TCPC_0, 1);
- if (ppc_is_sourcing_vbus(USB_PD_PORT_TCPC_1))
- ppc_vbus_source_enable(USB_PD_PORT_TCPC_1, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
-/******************************************************************************/
-/* USB-C PPC Configuration */
-struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_TCPC_1] = {
- .i2c_port = I2C_PORT_PPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
-};
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-/* USB-A port control */
-const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_EN_PP5000_USB_VBUS,
-};
-
-/* Power Delivery and charging functions */
-static void board_tcpc_init(void)
-{
- /*
- * Reset TCPC if we have had a system reset.
- * With EFSv2, it is possible to be in RW without
- * having reset the TCPC.
- */
- if (system_get_reset_flags() & EC_RESET_FLAG_POWER_ON)
- board_reset_pd_mcu();
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_TCPPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
- /* Enable other overcurrent interrupts */
- gpio_enable_interrupt(GPIO_USB_A0_OC_ODL);
- gpio_enable_interrupt(GPIO_USB_A1_OC_ODL);
-
-}
-/* Make sure this is called after fw_config is initialised */
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
-
-int64_t get_time_dsw_pwrok(void)
-{
- /* DSW_PWROK is turned on before EC was powered. */
- return -20 * MSEC;
-}
-
-void board_reset_pd_mcu(void)
-{
- int level0 = !!(tcpc_config[USB_PD_PORT_TCPC_0].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
- int level1 = !!(tcpc_config[USB_PD_PORT_TCPC_1].flags &
- TCPC_FLAGS_RESET_ACTIVE_HIGH);
-
- gpio_set_level(GPIO_USB_C0_TCPC_RST, level0);
- gpio_set_level(GPIO_USB_C1_TCPC_RST, level1);
- msleep(BOARD_TCPC_C0_RESET_HOLD_DELAY);
- gpio_set_level(GPIO_USB_C0_TCPC_RST, !level0);
- gpio_set_level(GPIO_USB_C1_TCPC_RST, !level1);
- if (BOARD_TCPC_C0_RESET_POST_DELAY)
- msleep(BOARD_TCPC_C0_RESET_POST_DELAY);
-}
-
-int board_set_active_charge_port(int port)
-{
- CPRINTS("Requested charge port change to %d", port);
-
- /*
- * The charge manager may ask us to switch to no charger if we're
- * running off USB-C only but upstream doesn't support PD. It requires
- * that we accept this switch otherwise it triggers an assert and EC
- * reset; it's not possible to boot the AP anyway, but we want to avoid
- * resetting the EC so we can continue to do the "low power" LED blink.
- */
- if (port == CHARGE_PORT_NONE)
- return EC_SUCCESS;
-
- if (port < 0 || CHARGE_PORT_COUNT <= port)
- return EC_ERROR_INVAL;
-
- if (port == charge_manager_get_active_charge_port())
- return EC_SUCCESS;
-
- /* Don't charge from a source port */
- if (board_vbus_source_enabled(port))
- return EC_ERROR_INVAL;
-
- if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
- int bj_active, bj_requested;
-
- if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
- /* Change is only permitted while the system is off */
- return EC_ERROR_INVAL;
-
- /*
- * Current setting is no charge port but the AP is on, so the
- * charge manager is out of sync (probably because we're
- * reinitializing after sysjump). Reject requests that aren't
- * in sync with our outputs.
- */
- bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L);
- bj_requested = port == CHARGE_PORT_BARRELJACK;
- if (bj_active != bj_requested)
- return EC_ERROR_INVAL;
- }
-
- CPRINTS("New charger p%d", port);
-
- switch (port) {
- case CHARGE_PORT_TYPEC0:
- case CHARGE_PORT_TYPEC1:
- /* TODO(b/143975429) need to touch the PD controller? */
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
- break;
- case CHARGE_PORT_BARRELJACK:
- /* Make sure BJ adapter is sourcing power */
- if (gpio_get_level(GPIO_BJ_ADP_PRESENT_L))
- return EC_ERROR_INVAL;
- /* TODO(b/143975429) need to touch the PD controller? */
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
- break;
- default:
- return EC_ERROR_INVAL;
- }
-
- return EC_SUCCESS;
-}
-
-void board_overcurrent_event(int port, int is_overcurrented)
-{
- switch (port) {
- case USB_PD_PORT_TCPC_0:
- usbc_0_overcurrent = is_overcurrented;
- break;
- case USB_PD_PORT_TCPC_1:
- usbc_1_overcurrent = is_overcurrented;
- break;
- default:
- return;
- }
- update_5v_usage();
-}
-
-int extpower_is_present(void)
-{
- return adp_connected;
-}
-
-int board_is_c10_gate_enabled(void)
-{
- return 0;
-}
-
-void board_enable_s0_rails(int enable)
-{
-}
-
-unsigned int ec_config_get_bj_power(void)
-{
- unsigned int bj =
- (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L;
- /* Out of range value defaults to 0 */
- if (bj >= ARRAY_SIZE(bj_power))
- bj = 0;
- return bj;
-}
-
-unsigned int ec_config_get_thermal_solution(void)
-{
- return (fw_config & EC_CFG_THERMAL_MASK) >> EC_CFG_THERMAL_L;
-}
-
-/*
- * Power monitoring and management.
- *
- * The overall goal is to gracefully manage the power demand so that
- * the power budgets are met without letting the system fall into
- * power deficit (perhaps causing a brownout).
- *
- * There are 2 power budgets that need to be managed:
- * - overall system power as measured on the main power supply rail.
- * - 5V power delivered to the USB and HDMI ports.
- *
- * The actual system power demand is calculated from the VBUS voltage and
- * the input current (read from a shunt), averaged over 5 readings.
- * The power budget limit is from the charge manager.
- *
- * The 5V power cannot be read directly. Instead, we rely on overcurrent
- * inputs from the USB and HDMI ports to indicate that the port is in use
- * (and drawing maximum power).
- *
- * There are 3 throttles that can be applied (in priority order):
- *
- * - Type A BC1.2 front port restriction (3W)
- * - Type C PD (throttle to 1.5A if sourcing)
- * - Turn on PROCHOT, which immediately throttles the CPU.
- *
- * The first 2 throttles affect both the system power and the 5V rails.
- * The third is a last resort to force an immediate CPU throttle to
- * reduce the overall power use.
- *
- * The strategy is to determine what the state of the throttles should be,
- * and to then turn throttles off or on as needed to match this.
- *
- * This function runs on demand, or every 2 ms when the CPU is up,
- * and continually monitors the power usage, applying the
- * throttles when necessary.
- *
- * All measurements are in milliwatts.
- */
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
-
-/*
- * Power gain if front USB A ports are limited.
- */
-#define POWER_GAIN_TYPE_A 3200
-/*
- * Power gain if Type C port is limited.
- */
-#define POWER_GAIN_TYPE_C 8800
-/*
- * Power is averaged over 10 ms, with a reading every 2 ms.
- */
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
-
-/* PROCHOT_DEFER_OFF is to extend CPU prochot long enough
- * to pass safety requirement 30 * 2ms = 60 ms
- */
-#define PROCHOT_DEFER_OFF 30
-
-static void power_monitor(void)
-{
- static uint32_t current_state;
- static uint32_t history[POWER_READINGS];
- static uint8_t index;
- static uint8_t prochot_linger;
- int32_t delay;
- uint32_t new_state = 0, diff;
- int32_t headroom_5v = PWR_MAX - base_5v_power;
-
- /*
- * If CPU is off or suspended, no need to throttle
- * or restrict power.
- */
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
- /*
- * Slow down monitoring, assume no throttling required.
- */
- delay = 20 * MSEC;
- /*
- * Clear the first entry of the power table so that
- * it is re-initilalised when the CPU starts.
- */
- history[0] = 0;
- } else {
- int32_t charger_mw;
-
- delay = POWER_DELAY_MS * MSEC;
- /*
- * Get current charger limit (in mw).
- * If not configured yet, skip.
- */
- charger_mw = charge_manager_get_power_limit_uw() / 1000;
- if (charger_mw != 0) {
- int32_t gap, total, max, power;
- int i;
-
- /*
- * Read power usage.
- */
- power = (adc_read_channel(ADC_VBUS) *
- adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
- /* Init power table */
- if (history[0] == 0) {
- for (i = 0; i < POWER_READINGS; i++)
- history[i] = power;
- }
- /*
- * Update the power readings and
- * calculate the average and max.
- */
- history[index] = power;
- index = (index + 1) % POWER_READINGS;
- total = 0;
- max = history[0];
- for (i = 0; i < POWER_READINGS; i++) {
- total += history[i];
- if (history[i] > max)
- max = history[i];
- }
- /*
- * For Type-C power supplies, there is
- * less tolerance for exceeding the rating,
- * so use the max power that has been measured
- * over the measuring period.
- * For barrel-jack supplies, the rating can be
- * exceeded briefly, so use the average.
- */
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
- power = max;
- else
- power = total / POWER_READINGS;
- /*
- * Calculate gap, and if negative, power
- * demand is exceeding configured power budget, so
- * throttling is required to reduce the demand.
- */
- gap = charger_mw - power;
- /*
- * Limiting type-A power.
- */
- if (gap <= 0) {
- new_state |= THROT_TYPE_A;
- headroom_5v += PWR_FRONT_HIGH - PWR_FRONT_LOW;
- if (!(current_state & THROT_TYPE_A))
- gap += POWER_GAIN_TYPE_A;
- }
- /*
- * If the type-C port is sourcing power,
- * check whether it should be throttled.
- * TODO(amcrae): selectively disable ports.
- */
- if (gap <= 0 && (ppc_is_sourcing_vbus(0) ||
- ppc_is_sourcing_vbus(1))) {
- new_state |= THROT_TYPE_C;
- headroom_5v += PWR_C_HIGH - PWR_C_LOW;
- if (!(current_state & THROT_TYPE_C))
- gap += POWER_GAIN_TYPE_C * 2;
- }
- /*
- * As a last resort, turn on PROCHOT to
- * throttle the CPU.
- */
- if (gap <= 0) {
- prochot_linger = 0;
- new_state |= THROT_PROCHOT;
- } else if (prochot_linger < PROCHOT_DEFER_OFF) {
- /*
- * Do not turn off PROCHOT immediately.
- */
- prochot_linger++;
- new_state |= THROT_PROCHOT;
- }
- }
- }
- /*
- * Check the 5v power usage and if necessary,
- * adjust the throttles in priority order.
- *
- * Either throttle may have already been activated by
- * the overall power control.
- *
- * We rely on the overcurrent detection to inform us
- * if the port is in use.
- *
- * - If type C not already throttled:
- * * If not overcurrent, prefer to limit type C [1].
- * * If in overcurrentuse:
- * - limit type A first [2]
- * - If necessary, limit type C [3].
- * - If type A not throttled, if necessary limit it [2].
- */
- if (headroom_5v < 0) {
- /*
- * Check whether type C is not throttled,
- * and is not overcurrent.
- */
- if (!((new_state & THROT_TYPE_C) ||
- usbc_0_overcurrent || usbc_1_overcurrent)) {
- /*
- * [1] Type C not in overcurrent, throttle it.
- */
- headroom_5v += PWR_C_HIGH - PWR_C_LOW;
- new_state |= THROT_TYPE_C;
- }
- /*
- * [2] If type A not already throttled, and power still
- * needed, limit type A.
- */
- if (!(new_state & THROT_TYPE_A) && headroom_5v < 0) {
- headroom_5v += PWR_FRONT_HIGH - PWR_FRONT_LOW;
- new_state |= THROT_TYPE_A;
- }
- /*
- * [3] If still under-budget, limit type C.
- * No need to check if it is already throttled or not.
- */
- if (headroom_5v < 0)
- new_state |= THROT_TYPE_C;
- }
- /*
- * Turn the throttles on or off if they have changed.
- */
- diff = new_state ^ current_state;
- current_state = new_state;
- if (diff & THROT_PROCHOT) {
- int prochot = (new_state & THROT_PROCHOT) ? 0 : 1;
-
- gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
- }
- if (diff & THROT_TYPE_C) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
-
- ppc_set_vbus_source_current_limit(0, rp);
- tcpm_select_rp_value(0, rp);
- pd_update_contract(0);
-
- ppc_set_vbus_source_current_limit(1, rp);
- tcpm_select_rp_value(1, rp);
- pd_update_contract(1);
- }
- if (diff & THROT_TYPE_A) {
- int typea_bc = (new_state & THROT_TYPE_A) ? 1 : 0;
-
- gpio_set_level(GPIO_USB_A_LOW_PWR_OD, typea_bc);
- }
- hook_call_deferred(&power_monitor_data, delay);
-}
-
-__override void oz554_board_init(void)
-{
- int pin_status = 0;
-
- pin_status |= gpio_get_level(GPIO_PANEL_ID0) << 0;
- pin_status |= gpio_get_level(GPIO_PANEL_ID1) << 1;
-
- switch (pin_status) {
- case 0x00:
- CPRINTS("PANEL_HAN01.10A");
- oz554_set_config(0, 0xF3);
- oz554_set_config(2, 0x4C);
- oz554_set_config(5, 0xB7);
- break;
- case 0x02:
- CPRINTS("PANEL_WF9_SSA2");
- oz554_set_config(0, 0xF3);
- oz554_set_config(2, 0x55);
- oz554_set_config(5, 0x87);
- break;
- default:
- CPRINTS("PANEL UNKNOWN");
- break;
- }
-}
diff --git a/board/dooly/board.h b/board/dooly/board.h
deleted file mode 100644
index 927037e357..0000000000
--- a/board/dooly/board.h
+++ /dev/null
@@ -1,344 +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.
- */
-
-/* Dooly board configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-#undef CONFIG_UART_TX_BUF_SIZE
-#define CONFIG_UART_TX_BUF_SIZE 4096
-
-/*
- * By default, enable all console messages except HC, ACPI and event:
- * The sensor stack is generating a lot of activity.
- */
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
-#undef CONFIG_HOSTCMD_DEBUG_MODE
-#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-
-/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
-
-/* Internal SPI flash on NPCX796FC is 512 kB */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
-#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q80 /* Internal SPI flash type. */
-
-/* Sensor */
-#define CONFIG_ACCEL_INTERRUPTS
-/*
- * Reduce maximal sensor speed: lid accelerometer is not interrupt driven,
- * so EC does not timestamp sensor events as accurately as interrupt
- * driven ones.
- */
-#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 125000
-#define CONFIG_CMD_ACCEL_INFO
-/* Enable sensor fifo, must also define the _SIZE and _THRES */
-#define CONFIG_ACCEL_FIFO
-/* FIFO size is in power of 2. */
-#define CONFIG_ACCEL_FIFO_SIZE 256
-/* Depends on how fast the AP boots and typical ODRs */
-#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
-/* BMA253 accelerometer */
-#define CONFIG_ACCEL_BMA255
-#define CONFIG_CMD_ACCELS
-
-/* TCS3400 ALS */
-#define CONFIG_ALS
-#define ALS_COUNT 1
-#define CONFIG_ALS_TCS3400
-#define CONFIG_ALS_TCS3400_INT_EVENT\
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
-
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(SCREEN_ACCEL) | BIT(CLEAR_ALS))
-
-/* EC Defines */
-#define CONFIG_ADC
-#define CONFIG_BOARD_HAS_RTC_RESET
-#define CONFIG_BOARD_VERSION_CBI
-#define CONFIG_DEDICATED_RECOVERY_BUTTON
-#define CONFIG_BOARD_RESET_AFTER_POWER_ON
-#define CONFIG_CRC8
-#define CONFIG_CBI_EEPROM
-#define CONFIG_EMULATED_SYSRQ
-#undef CONFIG_KEYBOARD_BOOT_KEYS
-#define CONFIG_MKBP_INPUT_DEVICES
-#define CONFIG_MKBP_USE_HOST_EVENT
-#undef CONFIG_KEYBOARD_RUNTIME_KEYS
-#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
-#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
-#define CONFIG_LTO
-#define CONFIG_PWM
-#define CONFIG_VBOOT_EFS2
-#define CONFIG_VBOOT_HASH
-#define CONFIG_VSTORE
-#define CONFIG_VSTORE_SLOT_COUNT 1
-#define CONFIG_SHA256
-
-
-/* EC Commands */
-#define CONFIG_CMD_BUTTON
-/* Include CLI command needed to support CCD testing. */
-#define CONFIG_CMD_CHARGEN
-#undef CONFIG_CMD_FASTCHARGE
-#undef CONFIG_CMD_KEYBOARD
-#define CONFIG_HOSTCMD_PD_CONTROL
-#undef CONFIG_CMD_PWR_AVG
-#define CONFIG_CMD_PPC_DUMP
-#define CONFIG_CMD_TCPC_DUMP
-#ifdef SECTION_IS_RO
-/* Reduce RO size by removing less-relevant commands. */
-#undef CONFIG_CMD_APTHROTTLE
-#undef CONFIG_CMD_CHARGEN
-#undef CONFIG_CMD_HCDEBUG
-#undef CONFIG_CMD_MMAPINFO
-#endif
-
-#undef CONFIG_CONSOLE_CMDHELP
-
-/* Don't generate host command debug by default */
-#undef CONFIG_HOSTCMD_DEBUG_MODE
-#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-
-/* Enable AP Reset command for TPM with old firmware version to detect it. */
-#define CONFIG_CMD_AP_RESET_LOG
-#define CONFIG_HOSTCMD_AP_RESET
-
-/* Chipset config */
-#define CONFIG_CHIPSET_COMETLAKE_DISCRETE
-/* check */
-#define CONFIG_CHIPSET_CAN_THROTTLE
-#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
-
-/* Dedicated barreljack charger port */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
-#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
-#define DEDICATED_CHARGE_PORT 2
-
-#define CONFIG_VOLUME_BUTTONS
-
-#define CONFIG_POWER_BUTTON
-#define CONFIG_POWER_BUTTON_IGNORE_LID
-#define CONFIG_POWER_BUTTON_X86
-/* Check: */
-#define CONFIG_POWER_BUTTON_INIT_IDLE
-#define CONFIG_POWER_COMMON
-#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
-#define CONFIG_DELAY_DSW_PWROK_TO_PWRBTN
-#define CONFIG_POWER_PP5000_CONTROL
-#define CONFIG_POWER_S0IX
-#define CONFIG_POWER_SLEEP_FAILURE_DETECTION
-#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
-#define CONFIG_INA3221
-
-/* b/143501304 */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
-#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
-
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
-
-/* Fan and temp. */
-#define CONFIG_FANS 1
-#undef CONFIG_FAN_INIT_SPEED
-#define CONFIG_FAN_INIT_SPEED 0
-#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
-#define CONFIG_THERMISTOR
-#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_THROTTLE_AP
-
-/* Charger */
-#define CONFIG_CHARGE_MANAGER
-/* Less than this much blocks AP power-on. */
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 30000
-#undef CONFIG_CHARGE_MANAGER_SAFE_MODE
-
-/* USB type C */
-#define CONFIG_USB_PD_TCPMV2 /* Use TCPMv2 */
-#define CONFIG_USB_PD_REV30 /* Enable PD 3.0 functionality */
-#define CONFIG_USB_PD_DECODE_SOP
-#undef CONFIG_USB_CHARGER
-#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PID 0x5040
-#define CONFIG_USB_PD_ALT_MODE
-#define CONFIG_USB_PD_ALT_MODE_DFP
-#define CONFIG_USB_PD_DISCHARGE_PPC
-#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_VBUS_DETECT_PPC
-#define CONFIG_USBC_PPC_SN5S330
-#define CONFIG_USBC_PPC_DEDICATED_INT
-#define CONFIG_USB_PD_TCPM_MUX
-#define CONFIG_USB_PD_TCPM_TCPCI
-#define CONFIG_USB_PD_TCPM_ANX7447
-#define CONFIG_USB_PD_TRY_SRC
-#define CONFIG_USB_DRP_ACC_TRYSRC
-#define CONFIG_USBC_SS_MUX
-#define CONFIG_USBC_SS_MUX_DFP_ONLY
-#define CONFIG_USBC_VCONN
-#define CONFIG_USBC_VCONN_SWAP
-
-#define USB_PD_PORT_TCPC_0 0
-#define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
-#define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
-#define USB_PD_PORT_TCPC_1 1
-#define BOARD_TCPC_C1_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
-#define BOARD_TCPC_C1_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
-
-/* USB Type A Features */
-#define CONFIG_USB_PORT_POWER_DUMB
-/* There are two ports, but power enable is ganged across all of them. */
-#define USB_PORT_COUNT 1
-
-/* I2C Bus Configuration */
-#define CONFIG_I2C
-#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_SENSORS NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_PPC1 NPCX_I2C_PORT2_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0
-
-/*
- * LED backlight controller
- */
-#define CONFIG_LED_DRIVER_OZ554
-
-#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h"
-#include "registers.h"
-
-enum charge_port {
- CHARGE_PORT_TYPEC0,
- CHARGE_PORT_TYPEC1,
- CHARGE_PORT_BARRELJACK,
-};
-
-enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
- /* Number of ADC channels */
- ADC_CH_COUNT
-};
-
-enum pwm_channel {
- PWM_CH_FAN,
- PWM_CH_LED_RED,
- PWM_CH_LED_WHITE,
- /* Number of PWM channels */
- PWM_CH_COUNT
-};
-
-enum fan_channel {
- FAN_CH_0,
- /* Number of FAN channels */
- FAN_CH_COUNT
-};
-
-enum mft_channel {
- MFT_CH_0 = 0,
- /* Number of MFT channels */
- MFT_CH_COUNT,
-};
-
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_COUNT
-};
-
-enum sensor_id {
- SCREEN_ACCEL = 0,
- CLEAR_ALS,
- RGB_ALS,
- SENSOR_COUNT,
-};
-
-
-/* Board specific handlers */
-void board_reset_pd_mcu(void);
-void board_set_tcpc_power_mode(int port, int mode);
-void led_alert(int enable);
-void show_critical_error(void);
-
-/*
- * firmware config fields - keep in sync with Puff.
- */
-/*
- * Barrel-jack power (4 bits).
- */
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
-#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
-/*
- * USB Connector 4 not present (1 bit) (not used).
- */
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
-#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
-/*
- * Thermal solution config (3 bits).
- */
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
-#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
-
-unsigned int ec_config_get_bj_power(void);
-unsigned int ec_config_get_thermal_solution(void);
-
-#endif /* !__ASSEMBLER__ */
-
-/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_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_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
-
-/*
- * There is no RSMRST input, so alias it to the output. This short-circuits
- * common_intel_x86_handle_rsmrst.
- */
-#define GPIO_RSMRST_L_PGOOD GPIO_PCH_RSMRST_L
-
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/dooly/build.mk b/board/dooly/build.mk
deleted file mode 100644
index 0f55c45f77..0000000000
--- a/board/dooly/build.mk
+++ /dev/null
@@ -1,15 +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:=npcx7m6fc
-
-board-y=board.o
-board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
-board-y+=led.o
diff --git a/board/dooly/ec.tasklist b/board/dooly/ec.tasklist
deleted file mode 100644
index 72b81be8d8..0000000000
--- a/board/dooly/ec.tasklist
+++ /dev/null
@@ -1,20 +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(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 2048) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_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/dooly/gpio.inc b/board/dooly/gpio.inc
deleted file mode 100644
index d4b06d1443..0000000000
--- a/board/dooly/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.
- * Pin names follow the schematic, and are aliased to other names if necessary.
- * Note: Those with interrupt handlers must be declared first. */
-
-/* Latency on this interrupt is extremely critical, so it comes first to ensure
- * it gets placed first in gpio_wui_table so gpio_interrupt() needs to do
- * minimal scanning. */
-GPIO_INT(CPU_C10_GATE_L, PIN(6, 7), GPIO_INT_BOTH, c10_gate_interrupt)
-
-/* Wake Source interrupts */
-GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt)
-
-/* Power sequencing interrupts */
-GPIO_INT(PG_PP5000_A_OD, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_PP1800_A_OD, PIN(3, 1), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
-/* EC output, but also interrupt so this can be polled as a power signal */
-GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
-GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
-#endif
-GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
-#endif
-GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(IMVP8_VRRDY_OD, PIN(1, 6), GPIO_INT_BOTH, power_signal_interrupt)
-
-/* Other interrupts */
-GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(USB_C1_TCPPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(E, 4), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(PANEL_BACKLIGHT_EN, PIN(B, 1), GPIO_INT_RISING, backlight_enable_interrupt)
-
-/* Sensor Interrupts */
-GPIO_INT(ALS_GSENSOR_INT_ODL, PIN(9, 6), GPIO_INT_FALLING, tcs3400_interrupt)
-
-/*
- * Directly connected recovery button.
- */
-GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(F, 1), GPIO_INT_BOTH, button_interrupt)
-/*
- * Recovery button input from H1.
- */
-GPIO_INT(H1_EC_RECOVERY_BTN_ODL, PIN(2, 4), GPIO_INT_BOTH, button_interrupt)
-GPIO_INT(BJ_ADP_PRESENT_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
-
-/* Port power control interrupts */
-GPIO_INT(USB_A0_OC_ODL, PIN(F, 5), GPIO_INT_BOTH, port_ocp_interrupt)
-GPIO_INT(USB_A1_OC_ODL, PIN(0, 3), GPIO_INT_BOTH, port_ocp_interrupt)
-
-/* 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(8, 0), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-
-/* PCH/CPU signals */
-GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
-GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
-GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
-GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
-GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
-GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
-GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
-
-/* Power control outputs */
-GPIO(EN_PP5000_A, PIN(A, 4), GPIO_OUT_LOW)
-GPIO(EN_PP3300_INA_H1_EC_ODL, PIN(5, 7), GPIO_ODR_HIGH)
-GPIO(EN_PP1800_A, PIN(1, 5), GPIO_OUT_LOW)
-GPIO(VCCST_PG_OD, PIN(1, 4), GPIO_ODR_LOW)
-GPIO(EN_S0_RAILS, PIN(1, 1), GPIO_OUT_LOW)
-GPIO(EN_ROA_RAILS, PIN(A, 3), GPIO_OUT_LOW)
-GPIO(EN_PP950_VCCIO, PIN(1, 0), GPIO_OUT_LOW)
-GPIO(EC_IMVP8_PE, PIN(A, 7), GPIO_OUT_LOW)
-GPIO(EN_IMVP8_VR, PIN(F, 4), GPIO_OUT_LOW)
-
-/* Barreljack */
-GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 4), GPIO_OUT_LOW)
-
-/* USB type A */
-GPIO(EN_PP5000_USB_VBUS, PIN(8, 3), GPIO_OUT_LOW)
-GPIO(USB_A_LOW_PWR_OD, PIN(9, 4), GPIO_ODR_LOW)
-GPIO(USB_A0_STATUS_L, PIN(6, 1), GPIO_INPUT) /* Marked as A2 */
-GPIO(USB_A1_STATUS_L, PIN(C, 7), GPIO_INPUT) /* Marked as A3 */
-
-/* USB type C */
-GPIO(USB_C0_TCPC_RST, PIN(9, 7), GPIO_OUT_LOW)
-GPIO(USB_C1_TCPC_RST, PIN(D, 2), GPIO_OUT_LOW)
-
-/* Misc. */
-GPIO(M2_SSD_PLN, PIN(A, 0), GPIO_INPUT)
-GPIO(EC_ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW)
-GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_ODR_HIGH)
-GPIO(PACKET_MODE_EN, PIN(7, 5), GPIO_OUT_LOW)
-
-/* I2C pins - Alternate function below configures I2C module on these pins */
-GPIO(I2C0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_INA_SCL */
-GPIO(I2C0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_INA_SDA */
-GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C_USB_C0_TCPPC_SCL */
-GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C_USB_C0_TCPPC_SDA */
-GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_I2C_USB_C1_TCPPC_SCL */
-GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C_USB_C1_TCPPC_SDA */
-GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_I2C_USB_C0_TCPC_SCL */
-GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C_USB_C0_TCPC_SDA */
-GPIO(I2C4_SCL, PIN(F, 3), GPIO_INPUT) /* EC_I2C_USB_C1_TCPC_SCL */
-GPIO(I2C4_SDA, PIN(F, 2), GPIO_INPUT) /* EC_I2C_USB_C1_TCPC_SDA */
-GPIO(I2C5_SCL, PIN(3, 3), GPIO_INPUT) /* EC_I2C_IMVP8_SCL */
-GPIO(I2C5_SDA, PIN(3, 6), GPIO_INPUT) /* EC_I2C_IMVP8_SDA */
-/*
- * Also used for LCM backlight.
- */
-GPIO(I2C7_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C_EEPROM_SCL */
-GPIO(I2C7_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C_EEPROM_SDA */
-
-/* Alternate functions GPIO definitions */
-ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, 0) /* I2C0 */
-ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */
-ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2C1 SDA */
-ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* I2C3 */
-ALTERNATE(PIN_MASK(F, 0x0C), 0, MODULE_I2C, 0) /* I2C4 */
-ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* I2C5 */
-ALTERNATE(PIN_MASK(B, 0x0C), 0, MODULE_I2C, 0) /* I2C7 */
-
-/* PWM */
-ALTERNATE(PIN_MASK(C, 0x08), 0, MODULE_PWM, 0) /* PWM0 - Red Led */
-ALTERNATE(PIN_MASK(C, 0x10), 0, MODULE_PWM, 0) /* PWM2 - White Led */
-ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* PWM5 - Fan 1 */
-ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* TA2 - Fan Tachometer */
-
-/* ADC */
-ALTERNATE(PIN_MASK(4, 0x3A), 0, MODULE_ADC, 0) /* ADC0 - ADC2, ADC4 */
-ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* ADC7 */
-ALTERNATE(PIN_MASK(F, 0x01), 0, MODULE_ADC, 0) /* ADC9 */
-
-/* UART */
-ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART from EC to Servo */
-
-/* PANEL ID */
-GPIO(PANEL_ID0, PIN(0, 2), GPIO_INPUT)
-GPIO(PANEL_ID1, PIN(C, 6), GPIO_INPUT)
-
-/* EDID write protect control */
-GPIO(EC_EDID_WP_DISABLE_L, PIN(D, 3), GPIO_OUT_HIGH) /* LOW to disable EDID WP */
-
-/* Unused pins */
-UNUSED(PIN(9, 5)) /* H10 TP54 */
-UNUSED(PIN(4, 0)) /* E4 TP56 */
-UNUSED(PIN(5, 0)) /* G4 NC */
-UNUSED(PIN(0, 7)) /* E8 TP991 */
-UNUSED(PIN(0, 6)) /* B10 TP992 */
-UNUSED(PIN(D, 6)) /* F6 */
-UNUSED(PIN(3, 2)) /* E5 */
-UNUSED(PIN(B, 0)) /* G8 TP49 */
-UNUSED(PIN(1, 3)) /* EC_GP_SEL1_ODL */
-UNUSED(PIN(C, 0)) /* FAN_PWM_2 */
-UNUSED(PIN(4, 2)) /* ADC3/TEMP_SENSOR_3 */
-UNUSED(PIN(C, 2)) /* A12 NC */
-UNUSED(PIN(1, 2)) /* C6 NC */
-UNUSED(PIN(6, 6)) /* H4 NC */
-UNUSED(PIN(8, 1)) /* L6 NC */
-UNUSED(PIN(E, 2)) /* B8 NC */
-UNUSED(PIN(8, 5)) /* L7 NC */
-UNUSED(PIN(0, 0)) /* D11 NC */
-UNUSED(PIN(3, 5)) /* F5 NC */
-UNUSED(PIN(5, 6)) /* M2 NC */
-UNUSED(PIN(8, 6)) /* J8 NC */
-UNUSED(PIN(7, 2)) /* H6 NC */
diff --git a/board/dooly/led.c b/board/dooly/led.c
deleted file mode 100644
index fefa8908fe..0000000000
--- a/board/dooly/led.c
+++ /dev/null
@@ -1,264 +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 LED control for Puff.
- * Solid green - active power
- * Green flashing - suspended
- * Red flashing - alert
- * Solid red - critical
- */
-
-#include "chipset.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "led_common.h"
-#include "pwm.h"
-#include "timer.h"
-#include "util.h"
-
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
-
-/*
- * Due to the CSME-Lite processing, upon startup the CPU transitions through
- * S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
- * delay turning off the LED during suspend/shutdown.
- */
-#define LED_CPU_DELAY_MS (2000 * MSEC)
-
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-enum led_color {
- LED_OFF = 0,
- LED_RED,
- LED_WHITE,
- LED_AMBER,
- /* Number of colors, not a color itself */
- LED_COLOR_COUNT
-};
-
-static int set_color_power(enum led_color color, int duty)
-{
- int white = 0;
- int red = 0;
-
- if (duty < 0 || 100 < duty)
- return EC_ERROR_UNKNOWN;
-
- switch (color) {
- case LED_OFF:
- break;
- case LED_WHITE:
- white = 1;
- break;
- case LED_RED:
- red = 1;
- break;
- case LED_AMBER:
- white = 1;
- red = 1;
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
-
- if (red)
- pwm_set_duty(PWM_CH_LED_RED, duty);
- else
- pwm_set_duty(PWM_CH_LED_RED, 0);
-
- if (white)
- pwm_set_duty(PWM_CH_LED_WHITE, duty);
- else
- pwm_set_duty(PWM_CH_LED_WHITE, 0);
-
- return EC_SUCCESS;
-}
-
-static int set_color(enum ec_led_id id, enum led_color color, int duty)
-{
- switch (id) {
- case EC_LED_ID_POWER_LED:
- return set_color_power(color, duty);
- default:
- return EC_ERROR_UNKNOWN;
- }
-}
-
-#define LED_PULSE_US (2 * SECOND)
-/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
-
-/* When pulsing is enabled, brightness is incremented by <duty_inc> every
- * <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
- * likewise in LED_PULSE_US usec. */
-static struct {
- uint32_t interval;
- int duty_inc;
- enum led_color color;
- int duty;
-} led_pulse;
-
-#define CONFIGURE_TICK(interval, color) \
- config_tick((interval), 100 / (LED_PULSE_US / (interval)), (color))
-
-static void config_tick(uint32_t interval, int duty_inc, enum led_color color)
-{
- led_pulse.interval = interval;
- led_pulse.duty_inc = duty_inc;
- led_pulse.color = color;
- led_pulse.duty = 0;
-}
-
-static void pulse_power_led(enum led_color color)
-{
- set_color(EC_LED_ID_POWER_LED, color, led_pulse.duty);
- if (led_pulse.duty + led_pulse.duty_inc > 100)
- led_pulse.duty_inc = led_pulse.duty_inc * -1;
- else if (led_pulse.duty + led_pulse.duty_inc < 0)
- led_pulse.duty_inc = led_pulse.duty_inc * -1;
- led_pulse.duty += led_pulse.duty_inc;
-}
-
-static void led_tick(void);
-DECLARE_DEFERRED(led_tick);
-static void led_tick(void)
-{
- uint32_t elapsed;
- uint32_t next = 0;
- uint32_t start = get_time().le.lo;
-
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- pulse_power_led(led_pulse.color);
- elapsed = get_time().le.lo - start;
- next = led_pulse.interval > elapsed ? led_pulse.interval - elapsed : 0;
- hook_call_deferred(&led_tick_data, next);
-}
-
-static void led_suspend(void)
-{
- CONFIGURE_TICK(LED_PULSE_TICK_US, LED_WHITE);
- led_tick();
-}
-DECLARE_DEFERRED(led_suspend);
-
-static void led_shutdown(void)
-{
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- set_color(EC_LED_ID_POWER_LED, LED_OFF, 0);
-}
-DECLARE_DEFERRED(led_shutdown);
-
-static void led_shutdown_hook(void)
-{
- hook_call_deferred(&led_tick_data, -1);
- hook_call_deferred(&led_suspend_data, -1);
- hook_call_deferred(&led_shutdown_data, LED_CPU_DELAY_MS);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, led_shutdown_hook, HOOK_PRIO_DEFAULT);
-
-static void led_suspend_hook(void)
-{
- hook_call_deferred(&led_shutdown_data, -1);
- hook_call_deferred(&led_suspend_data, LED_CPU_DELAY_MS);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, led_suspend_hook, HOOK_PRIO_DEFAULT);
-
-static void led_resume(void)
-{
- /* Assume there is no race condition with led_tick, which also
- * runs in hook_task. */
- hook_call_deferred(&led_tick_data, -1);
- /*
- * Avoid invoking the suspend/shutdown delayed hooks.
- */
- hook_call_deferred(&led_suspend_data, -1);
- hook_call_deferred(&led_shutdown_data, -1);
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- set_color(EC_LED_ID_POWER_LED, LED_WHITE, 100);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, led_resume, HOOK_PRIO_DEFAULT);
-
-static void led_init(void)
-{
- pwm_enable(PWM_CH_LED_WHITE, 1);
- pwm_enable(PWM_CH_LED_RED, 1);
-}
-DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_INIT_PWM + 1);
-
-void led_alert(int enable)
-{
- if (enable) {
- /* Overwrite the current signal */
- config_tick(1 * SECOND, 100, LED_RED);
- led_tick();
- } else {
- /* Restore the previous signal */
- if (chipset_in_state(CHIPSET_STATE_ON))
- led_resume();
- else if (chipset_in_state(CHIPSET_STATE_SUSPEND))
- led_suspend_hook();
- else if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- led_shutdown_hook();
- }
-}
-
-void show_critical_error(void)
-{
- hook_call_deferred(&led_tick_data, -1);
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
-}
-
-static int command_led(int argc, char **argv)
-{
- enum ec_led_id id = EC_LED_ID_POWER_LED;
-
- if (argc < 2)
- return EC_ERROR_PARAM_COUNT;
-
- if (!strcasecmp(argv[1], "debug")) {
- led_auto_control(id, !led_auto_control_is_enabled(id));
- ccprintf("o%s\n", led_auto_control_is_enabled(id) ? "ff" : "n");
- } else if (!strcasecmp(argv[1], "off")) {
- set_color(id, LED_OFF, 0);
- } else if (!strcasecmp(argv[1], "red")) {
- set_color(id, LED_RED, 100);
- } else if (!strcasecmp(argv[1], "white")) {
- set_color(id, LED_WHITE, 100);
- } else if (!strcasecmp(argv[1], "amber")) {
- set_color(id, LED_AMBER, 100);
- } else if (!strcasecmp(argv[1], "alert")) {
- led_alert(1);
- } else if (!strcasecmp(argv[1], "crit")) {
- show_critical_error();
- } else {
- return EC_ERROR_PARAM1;
- }
- return EC_SUCCESS;
-}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|white|amber|off|alert|crit]",
- "Turn on/off LED.");
-
-void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
-{
- brightness_range[EC_LED_COLOR_WHITE] = 100;
- brightness_range[EC_LED_COLOR_RED] = 100;
- brightness_range[EC_LED_COLOR_AMBER] = 100;
-}
-
-int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
-{
- if (brightness[EC_LED_COLOR_WHITE])
- return set_color(id, LED_WHITE, brightness[EC_LED_COLOR_WHITE]);
- else if (brightness[EC_LED_COLOR_RED])
- return set_color(id, LED_RED, brightness[EC_LED_COLOR_RED]);
- else if (brightness[EC_LED_COLOR_AMBER])
- return set_color(id, LED_AMBER, brightness[EC_LED_COLOR_AMBER]);
- else
- return set_color(id, LED_OFF, 0);
-}
diff --git a/board/dooly/usb_pd_policy.c b/board/dooly/usb_pd_policy.c
deleted file mode 100644
index a8d89130c2..0000000000
--- a/board/dooly/usb_pd_policy.c
+++ /dev/null
@@ -1,84 +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.
- */
-
-/* Shared USB-C policy for Dooly boards */
-
-#include "charge_manager.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "system.h"
-#include "tcpm/tcpci.h"
-#include "tcpm/tcpm.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usbc_ppc.h"
-#include "util.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
-
-int pd_check_vconn_swap(int port)
-{
- /* Only allow vconn swap if pp5000_A rail is enabled */
- return gpio_get_level(GPIO_EN_PP5000_A);
-}
-
-void pd_power_supply_reset(int port)
-{
- int prev_en;
-
- prev_en = ppc_is_sourcing_vbus(port);
-
- /* Disable VBUS. */
- ppc_vbus_source_enable(port, 0);
-
- /* Enable discharge if we were previously sourcing 5V */
- if (prev_en)
- pd_set_vbus_discharge(port, 1);
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-}
-
-int pd_set_power_supply_ready(int port)
-{
- int rv;
-
- /* Disable charging. */
- rv = ppc_vbus_sink_enable(port, 0);
- if (rv)
- return rv;
-
- pd_set_vbus_discharge(port, 0);
-
- /* Provide Vbus. */
- rv = ppc_vbus_source_enable(port, 1);
- if (rv)
- return rv;
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS;
-}
-
-#ifdef CONFIG_USB_PD_VBUS_DETECT_PPC
-int pd_snk_is_vbus_provided(int port)
-{
- return ppc_is_vbus_present(port);
-}
-#endif
-
-int board_vbus_source_enabled(int port)
-{
- /* Ignore non-PD ports (the barrel jack). */
- if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
- return 0;
- return ppc_is_sourcing_vbus(port);
-}
diff --git a/board/dooly/vif_override.xml b/board/dooly/vif_override.xml
deleted file mode 100644
index 32736caf64..0000000000
--- a/board/dooly/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.
--->