diff options
Diffstat (limited to 'board/ampton')
-rw-r--r-- | board/ampton/battery.c | 122 | ||||
-rw-r--r-- | board/ampton/board.c | 388 | ||||
-rw-r--r-- | board/ampton/board.h | 105 | ||||
-rw-r--r-- | board/ampton/build.mk | 15 | ||||
-rw-r--r-- | board/ampton/ec.tasklist | 23 | ||||
-rw-r--r-- | board/ampton/gpio.inc | 141 | ||||
-rw-r--r-- | board/ampton/led.c | 76 | ||||
-rw-r--r-- | board/ampton/vif_override.xml | 3 |
8 files changed, 0 insertions, 873 deletions
diff --git a/board/ampton/battery.c b/board/ampton/battery.c deleted file mode 100644 index ee9b9b96e9..0000000000 --- a/board/ampton/battery.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2018 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_fuel_gauge.h" -#include "charge_state.h" -#include "chipset.h" -#include "common.h" -#include "hooks.h" -#include "usb_pd.h" - -/* - * Battery info for all ampton/apel battery types. Note that the fields - * start_charging_min/max and charging_min/max are not used for the charger. - * The effective temperature limits are given by discharging_min/max_c. - * - * Fuel Gauge (FG) parameters which are used for determining if the battery - * is connected, the appropriate ship mode (battery cutoff) command, and the - * charge/discharge FETs status. - * - * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery - * register. For some batteries, the charge/discharge FET bits are set when - * charging/discharging is active, in other types, these bits set mean that - * charging/discharging is disabled. Therefore, in addition to the mask for - * these bits, a disconnect value must be specified. Note that for TI fuel - * gauge, the charge/discharge FET status is found in Operation Status (0x54), - * but a read of Manufacturer Access (0x00) will return the lower 16 bits of - * Operation status which contains the FET status bits. - * - * The assumption for battery types supported is that the charge/discharge FET - * status can be read with a sb_read() command and therefore, only the register - * address, mask, and disconnect value need to be provided. - */ -const struct board_batt_params board_battery_info[] = { - [BATTERY_C214] = { - .fuel_gauge = { - .manuf_name = "AS1GUXd3KB", - .device_name = "C214-43", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x10, 0x10 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x00, - .reg_mask = 0x2000, - .disconnect_val = 0x2000, - }, - }, - .batt_info = { - .voltage_max = 13200, - .voltage_normal = 11550, - .voltage_min = 9000, - .precharge_current = 256, - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .discharging_min_c = 0, - .discharging_max_c = 60, - }, - }, - [BATTERY_C204EE] = { - .fuel_gauge = { - .manuf_name = "AS1GVCD3KB", - .device_name = "C204-35", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x10, 0x10 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x00, - .reg_mask = 0x2000, - .disconnect_val = 0x2000, - }, - }, - .batt_info = { - .voltage_max = 13200, - .voltage_normal = 11550, - .voltage_min = 9000, - .precharge_current = 256, - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .discharging_min_c = 0, - .discharging_max_c = 60, - }, - }, - [BATTERY_C424] = { - .fuel_gauge = { - .manuf_name = "AS2GVID3jB", - .device_name = "C424-35", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x10, 0x10 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x00, - .reg_mask = 0x2000, - .disconnect_val = 0x2000, - }, - }, - .batt_info = { - .voltage_max = 13200, - .voltage_normal = 11550, - .voltage_min = 9000, - .precharge_current = 256, - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .discharging_min_c = 0, - .discharging_max_c = 60, - }, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); - -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_C214; diff --git a/board/ampton/board.c b/board/ampton/board.c deleted file mode 100644 index 1634f02991..0000000000 --- a/board/ampton/board.c +++ /dev/null @@ -1,388 +0,0 @@ -/* Copyright 2018 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. - */ - -/* Ampton/Apel board-specific configuration */ - -#include "adc.h" -#include "button.h" -#include "charge_state.h" -#include "common.h" -#include "cros_board_info.h" -#include "driver/accel_bma2x2.h" -#include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi_common.h" -#include "driver/ppc/sn5s330.h" -#include "driver/sync.h" -#include "driver/tcpm/it83xx_pd.h" -#include "driver/tcpm/ps8xxx.h" -#include "driver/usb_mux/it5205.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "i2c.h" -#include "intc.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "motion_sense.h" -#include "power.h" -#include "power_button.h" -#include "spi.h" -#include "switch.h" -#include "system.h" -#include "tablet_mode.h" -#include "tcpm/tcpci.h" -#include "temp_sensor.h" -#include "temp_sensor/thermistor.h" -#include "uart.h" -#include "usb_mux.h" -#include "usbc_ppc.h" -#include "util.h" - -static uint8_t sku_id; - -static void ppc_interrupt(enum gpio_signal signal) -{ - if (signal == GPIO_USB_C0_PD_INT_ODL) - sn5s330_interrupt(0); - else if (signal == GPIO_USB_C1_PD_INT_ODL) - sn5s330_interrupt(1); -} - -int ppc_get_alert_status(int port) -{ - if (port == 0) - return gpio_get_level(GPIO_USB_C0_PD_INT_ODL) == 0; - else - return gpio_get_level(GPIO_USB_C1_PD_INT_ODL) == 0; -} - -#include "gpio_list.h" /* Must come after other header files. */ - -/******************************************************************************/ -/* USB-C MUX Configuration */ - -#define USB_PD_PORT_ITE_0 0 -#define USB_PD_PORT_ITE_1 1 - -static int tune_mux(const struct usb_mux *me); - -const struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - [USB_PD_PORT_ITE_0] = { - /* Use PS8751 as mux only */ - .usb_port = USB_PD_PORT_ITE_0, - .i2c_port = I2C_PORT_USBC0, - .i2c_addr_flags = PS8751_I2C_ADDR1_FLAGS, - .flags = USB_MUX_FLAG_NOT_TCPC, - .driver = &ps8xxx_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, - .board_init = &tune_mux, - }, - [USB_PD_PORT_ITE_1] = { - /* Use PS8751 as mux only */ - .usb_port = USB_PD_PORT_ITE_1, - .i2c_port = I2C_PORT_USBC1, - .i2c_addr_flags = PS8751_I2C_ADDR1_FLAGS, - .flags = USB_MUX_FLAG_NOT_TCPC, - .driver = &ps8xxx_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, - .board_init = &tune_mux, - } -}; - -/* Some external monitors can't display content normally (eg. ViewSonic VX2880). - * We need to turn the mux for monitors to function normally. - */ -static int tune_mux(const struct usb_mux *me) -{ - /* Auto EQ disabled, compensate for channel lost up to 3.6dB */ - RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98)); - /* DP output swing adjustment +15% */ - RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, - 0xc0)); - - return EC_SUCCESS; -} -/******************************************************************************/ -/* ADC channels */ -const struct adc_t adc_channels[] = { - /* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */ - [ADC_VBUS_C0] = {.name = "VBUS_C0", - .factor_mul = 10 * ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH13}, - /* Vbus C1 sensing (10x voltage divider). SUB_EC_ADC */ - [ADC_VBUS_C1] = {.name = "VBUS_C1", - .factor_mul = 10 * ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH14}, - /* Convert to raw mV for thermistor table lookup */ - [ADC_TEMP_SENSOR_AMB] = {.name = "TEMP_AMB", - .factor_mul = ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH3}, - /* Convert to raw mV for thermistor table lookup */ - [ADC_TEMP_SENSOR_CHARGER] = {.name = "TEMP_CHARGER", - .factor_mul = ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH5}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_BATTERY] = {.name = "Battery", - .type = TEMP_SENSOR_TYPE_BATTERY, - .read = charge_get_battery_temp}, - [TEMP_SENSOR_AMBIENT] = {.name = "Ambient", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_AMB}, - [TEMP_SENSOR_CHARGER] = {.name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_13k7_47k_4050b, - .idx = ADC_TEMP_SENSOR_CHARGER}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Motion sensors */ -/* Mutexes */ -static struct mutex g_lid_mutex; -static struct mutex g_base_mutex; - -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 = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -const mat33_fp_t gyro_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -/* sensor private data */ -static struct kionix_accel_data g_kx022_data; -static struct bmi_drv_data_t g_bmi160_data; - -/* BMA253 private data */ -static struct accelgyro_saved_data_t g_bma253_data; - -static const struct motion_sensor_t motion_sensor_bma253 = { - .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_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 */ - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 0, - }, - /* Sensor on in S3 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 0, - }, - }, -}; - -/* Drivers */ -struct motion_sensor_t motion_sensors[] = { - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_KX022, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &kionix_accel_drv, - .mutex = &g_lid_mutex, - .drv_data = &g_kx022_data, - .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = KX022_ADDR1_FLAGS, - .rot_standard_ref = &lid_standard_ref, - .default_range = 2, /* g */ - .min_frequency = KX022_ACCEL_MIN_FREQ, - .max_frequency = KX022_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - }, - /* Sensor on for lid angle detection */ - [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, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 13000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - /* Sensor on for angle detection */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - }, - }, - [BASE_GYRO] = { - .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_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 = &gyro_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, - }, - [VSYNC] = { - .name = "Camera VSYNC", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_GPIO, - .type = MOTIONSENSE_TYPE_SYNC, - .location = MOTIONSENSE_LOC_CAMERA, - .drv = &sync_drv, - .default_range = 0, - .min_frequency = 0, - .max_frequency = 1, - }, -}; - -unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -static int board_is_convertible(void) -{ - /* SKU IDs of Ampton & unprovisioned: 1, 2, 3, 4, 255 */ - return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 - || sku_id == 255; - } - -static int board_with_sensor_bma253(void) -{ - /* SKU ID 3 and 4 of Ampton with BMA253 */ - return sku_id == 3 || sku_id == 4; -} - -static void board_update_sensor_config_from_sku(void) -{ - if (board_is_convertible()) { - motion_sensor_count = ARRAY_SIZE(motion_sensors); - - if (board_with_sensor_bma253()) - motion_sensors[LID_ACCEL] = motion_sensor_bma253; - - /* Enable Base Accel interrupt */ - gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); - } else { - motion_sensor_count = 0; - gmr_tablet_switch_disable(); - - /* Base accel is not stuffed, don't allow line to float */ - gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, - GPIO_INPUT | GPIO_PULL_DOWN); - } -} - -static void board_customize_usbc_mux(uint32_t board_version) -{ - if (board_version > 0) { - /* not proto, override the mux setting */ - memcpy(usb_muxes, ampton_usb_muxes, sizeof(ampton_usb_muxes)); - } -} - -/* Read CBI from i2c eeprom and initialize variables for board variants */ -static void cbi_init(void) -{ - uint32_t val; - - if (cbi_get_sku_id(&val) != EC_SUCCESS) - return; - sku_id = val; - ccprints("SKU: %d", sku_id); - - board_update_sensor_config_from_sku(); - - if (cbi_get_board_version(&val) != EC_SUCCESS) - return; - ccprints("Board version: %d", val); - board_customize_usbc_mux(val); -} -DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); - -void board_hibernate_late(void) -{ - /* - * Set KSO/KSI pins to GPIO input function to disable keyboard scan - * while hibernating. This also prevent leakage current caused - * by internal pullup of keyboard scan module. - */ - gpio_set_flags_by_mask(GPIO_KSO_H, 0xff, GPIO_INPUT); - gpio_set_flags_by_mask(GPIO_KSO_L, 0xff, GPIO_INPUT); - gpio_set_flags_by_mask(GPIO_KSI, 0xff, GPIO_INPUT); -} - -void board_overcurrent_event(int port, int is_overcurrented) -{ - /* TODO(b/78344554): pass this signal upstream once hardware reworked */ - cprints(CC_USBPD, "p%d: overcurrent!", port); -} - -/* This callback disables keyboard when convertibles are fully open */ -__override void lid_angle_peripheral_enable(int enable) -{ - /* - * If the lid is in tablet position via other sensors, - * ignore the lid angle, which might be faulty then - * disable keyboard. - */ - if (tablet_get_mode()) - enable = 0; - if (board_is_convertible()) - keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); -} diff --git a/board/ampton/board.h b/board/ampton/board.h deleted file mode 100644 index c72378d625..0000000000 --- a/board/ampton/board.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2018 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. - */ - -/* Ampton/Apel board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -/* Select Baseboard features */ -#define VARIANT_OCTOPUS_EC_ITE8320 -#define VARIANT_OCTOPUS_CHARGER_ISL9238 -#include "baseboard.h" - -/* I2C bus configuraiton */ -#define I2C_PORT_ACCEL I2C_PORT_SENSOR - -/* EC console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO - -#define CONFIG_VOLUME_BUTTONS -#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL -#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL - -#define CONFIG_LED_COMMON - -#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 - -/* Sensors */ -#define CONFIG_TEMP_SENSOR -#define CONFIG_THERMISTOR -#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B -#define CONFIG_STEINHART_HART_3V3_13K7_47K_4050B -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PP3300 - -#define CONFIG_ACCEL_BMA255 /* Lid accel */ -#define CONFIG_ACCEL_KX022 /* Lid accel */ -#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ -#define CONFIG_SYNC /* Camera VSYNC */ - -#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT -/* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) - -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_UPDATE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL - -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_SYNC_INT_EVENT \ - TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC) - -/* Keyboard backlight is unimplemented in hardware */ -#undef CONFIG_PWM -#undef CONFIG_PWM_KBLIGHT - -#undef CONFIG_UART_TX_BUF_SIZE -#define CONFIG_UART_TX_BUF_SIZE 4096 - -#define CONFIG_USB_MUX_RUNTIME_CONFIG - -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" -#include "registers.h" - -enum adc_channel { - ADC_VBUS_C0, - ADC_VBUS_C1, - ADC_TEMP_SENSOR_AMB, - ADC_TEMP_SENSOR_CHARGER, - ADC_CH_COUNT -}; - -enum temp_sensor_id { - TEMP_SENSOR_BATTERY, - TEMP_SENSOR_AMBIENT, - TEMP_SENSOR_CHARGER, - TEMP_SENSOR_COUNT -}; - -/* Motion sensors */ -enum sensor_id { - LID_ACCEL, - BASE_ACCEL, - BASE_GYRO, - VSYNC, - SENSOR_COUNT -}; - -/* List of possible batteries */ -enum battery_type { - BATTERY_C214, - BATTERY_C204EE, - BATTERY_C424, - BATTERY_TYPE_COUNT, -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/ampton/build.mk b/board/ampton/build.mk deleted file mode 100644 index cc6b73093e..0000000000 --- a/board/ampton/build.mk +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# Copyright 2018 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:=it83xx -CHIP_FAMILY:=it8320 -CHIP_VARIANT:=it8320dx -BASEBOARD:=octopus - -board-y=board.o led.o -board-$(CONFIG_BATTERY_SMART)+=battery.o diff --git a/board/ampton/ec.tasklist b/board/ampton/ec.tasklist deleted file mode 100644 index 2703dd0b5c..0000000000 --- a/board/ampton/ec.tasklist +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2018 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(USB_CHG_P0, usb_charger_task, 0, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, ULTRA_TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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, ULTRA_TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C1, pd_task, NULL, ULTRA_TASK_STACK_SIZE) diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc deleted file mode 100644 index 724d9a98d9..0000000000 --- a/board/ampton/gpio.inc +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2018 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(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(WP_L, PIN(I, 4), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */ -GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */ -#ifdef CONFIG_LOW_POWER_IDLE -/* Used to wake up the EC from Deep Doze mode when writing to console */ -GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_BOTH, uart_deepsleep_interrupt) /* UART_SERVO_TX_EC_RX */ -#endif - -/* USB-C interrupts */ -GPIO_INT(USB_C0_PD_INT_ODL, PIN(H, 6), GPIO_INT_FALLING, ppc_interrupt) -GPIO_INT(USB_C1_PD_INT_ODL, PIN(H, 5), GPIO_INT_FALLING, ppc_interrupt) - -/* Power State interrupts */ -#ifdef CONFIG_POWER_S0IX -GPIO_INT(PCH_SLP_S0_L, PIN(G, 6), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0_L */ -#endif -GPIO_INT(PCH_SLP_S4_L, PIN(F, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S4_L */ -GPIO_INT(PCH_SLP_S3_L, PIN(F, 2), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S3_L */ -GPIO_INT(SUSPWRDNACK, PIN(E, 1), GPIO_INT_BOTH, power_signal_interrupt) /* SUSPWRDNACK */ -GPIO_INT(RSMRST_L_PGOOD, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt) /* PMIC_EC_RSMRST_ODL */ -GPIO_INT(ALL_SYS_PGOOD, PIN(F, 0), GPIO_INT_BOTH, power_signal_interrupt) /* PMIC_EC_PWROK_OD */ -GPIO_INT(AC_PRESENT, PIN(A, 7), GPIO_INT_BOTH, extpower_interrupt) /* ACOK_OD */ - -#ifdef CONFIG_HOSTCMD_ESPI -/* enable 1.8v input of EC's espi_reset pin, and then this pin takes effect. */ -GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt) /* eSPI_reset# */ -#endif - -/* Other interrupts */ -GPIO_INT(TABLET_MODE_L, PIN(H, 4), GPIO_INT_BOTH, gmr_tablet_switch_isr) -GPIO_INT(EC_VOLDN_BTN_ODL, PIN(D, 6), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(EC_VOLUP_BTN_ODL, PIN(D, 5), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt) -GPIO(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INPUT | GPIO_SEL_1P8V) - -GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) /* PLT_RST_L: Platform Reset from SoC */ -GPIO(SYS_RESET_L, PIN(B, 6), GPIO_ODR_HIGH) /* SYS_RST_ODL */ -GPIO(PCH_RTCRST, PIN(K, 7), GPIO_OUT_LOW) /* EC_PCH_RTCRST */ - -GPIO(ENTERING_RW, PIN(C, 5), GPIO_OUT_LOW) /* EC_ENTERING_RW */ -GPIO(PCH_WAKE_L, PIN(D, 1), GPIO_ODR_HIGH) /* EC_PCH_WAKE_ODL */ -GPIO(PCH_PWRBTN_L, PIN(D, 0), GPIO_ODR_HIGH) /* EC_PCH_PWR_BTN_ODL */ - -GPIO(EN_PP5000, PIN(K, 2), GPIO_OUT_LOW) /* EN_PP5000_A */ -GPIO(PP5000_PG, PIN(K, 3), GPIO_INPUT) /* PP5000_PG_OD */ -GPIO(EN_PP3300, PIN(K, 5), GPIO_OUT_LOW) /* EN_PP3300_A */ -GPIO(PP3300_PG, PIN(K, 1), GPIO_INPUT) /* PP3300_PG_OD */ -GPIO(PMIC_EN, PIN(D, 7), GPIO_OUT_LOW) /* Enable A Rails via PMIC */ -GPIO(PCH_RSMRST_L, PIN(C, 6), GPIO_OUT_LOW) /* RSMRST# to SOC. All _A rails now up. */ -GPIO(PCH_SYS_PWROK, PIN(K, 4), GPIO_OUT_LOW) /* EC_PCH_PWROK. All S0 rails now up. */ - -/* Peripheral rails */ -GPIO(ENABLE_BACKLIGHT, PIN(B, 5), GPIO_ODR_HIGH | - GPIO_SEL_1P8V) /* EC_BL_EN_OD */ -GPIO(EN_P3300_TRACKPAD_ODL, PIN(A, 2), GPIO_ODR_HIGH) - -GPIO(EC_BATT_PRES_L, PIN(C, 0), GPIO_INPUT) - -/* - * PCH_PROCHOT_ODL is primarily for monitoring the PROCHOT# signal which is - * normally driven by the PMIC. The EC can also drive this signal in the event - * that the ambient or charger temperature sensors exceeds their thresholds. - */ -GPIO(CPU_PROCHOT, PIN(C, 7), GPIO_INPUT | GPIO_SEL_1P8V) /* PCH_PROCHOT_ODL */ - -/* I2C pins - Alternate function below configures I2C module on these pins */ -GPIO(I2C0_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C_POWER_3V3_SCL */ -GPIO(I2C0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_POWER_3V3_SDA */ -GPIO(I2C1_SCL, PIN(C, 1), GPIO_INPUT | - GPIO_SEL_1P8V) /* EC_I2C_SENSOR_U_SCL */ -GPIO(I2C1_SDA, PIN(C, 2), GPIO_INPUT | - GPIO_SEL_1P8V) /* EC_I2C_SENSOR_U_SDA */ -GPIO(I2C2_SCL, PIN(F, 6), GPIO_INPUT) /* EC_I2C_USB_C0_MUX_SCL */ -GPIO(I2C2_SDA, PIN(F, 7), GPIO_INPUT) /* EC_I2C_USB_C0_MUX_SDA */ -GPIO(I2C4_SCL, PIN(E, 0), GPIO_INPUT) /* EC_I2C_USB_C1_MUX_SCL */ -GPIO(I2C4_SDA, PIN(E, 7), GPIO_INPUT) /* EC_I2C_USB_C1_MUX_SDA */ -GPIO(I2C5_SCL, PIN(A, 4), GPIO_INPUT) /* EC_I2C_PROG_SCL */ -GPIO(I2C5_SDA, PIN(A, 5), GPIO_INPUT) /* EC_I2C_PROG_SDA */ - -/* USB pins */ -GPIO(EN_USB_A0_5V, PIN(B, 7), GPIO_OUT_LOW) /* Enable A0 5V Charging */ -GPIO(EN_USB_A1_5V, PIN(H, 3), GPIO_OUT_LOW) /* Enable A1 5V Charging */ -GPIO(USB_A0_CHARGE_EN_L, PIN(K, 0), GPIO_OUT_HIGH) /* Enable A0 1.5A Charging */ -GPIO(USB_A1_CHARGE_EN_L, PIN(K, 6), GPIO_OUT_HIGH) /* Enable A1 1.5A Charging */ -GPIO(USB_C0_HPD_1V8_ODL, PIN(J, 0), GPIO_INPUT | - GPIO_SEL_1P8V) /* C0 DP Hotplug Detect */ -GPIO(USB_C1_HPD_1V8_ODL, PIN(J, 1), GPIO_INPUT | - GPIO_SEL_1P8V) /* C1 DP Hotplug Detect */ -GPIO(USB_C0_BC12_CHG_DET_L, PIN(A, 0), GPIO_INPUT) /* C0 BC1.2 Detect */ -GPIO(USB_C1_BC12_CHG_DET_L, PIN(I, 0), GPIO_INPUT) /* C1 BC1.2 Detect */ -GPIO(USB_C0_BC12_VBUS_ON, PIN(J, 4), GPIO_OUT_LOW) /* C0 BC1.2 Power */ -GPIO(USB_C1_BC12_VBUS_ON, PIN(J, 5), GPIO_OUT_LOW) /* C1 BC1.2 Power */ -GPIO(USB_C0_PD_RST_ODL, PIN(L, 6), GPIO_ODR_HIGH) /* C0 PD Reset */ -GPIO(USB_C1_PD_RST_ODL, PIN(L, 7), GPIO_ODR_HIGH) /* C1 PD Reset */ - -GPIO(CCD_MODE_ODL, PIN(C, 4), GPIO_INPUT) - -/* LED */ -GPIO(BAT_LED_AMBER, PIN(A, 6), GPIO_OUT_LOW) /* LED_1_EC */ -GPIO(BAT_LED_WHITE, PIN(A, 3), GPIO_OUT_LOW) /* LED_2_EC */ - -/* MKBP event synchronization */ -GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH) - -GPIO(WFCAM_VSYNC, PIN(D, 4), GPIO_INPUT | GPIO_PULL_DOWN) - -UNIMPLEMENTED(KB_BL_PWR_EN) - -/* NC pins, enable internal pull-down to avoid floating state. */ -GPIO(GPIOB2_NC, PIN(B, 2), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOG0_NC, PIN(G, 0), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOG1_NC, PIN(G, 1), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOH0_NC, PIN(H, 0), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOL2_NC, PIN(L, 2), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOL3_NC, PIN(L, 3), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOM6_NC, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOD3_NC, PIN(D, 3), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIOI1_NC, PIN(I, 1), GPIO_INPUT | GPIO_PULL_DOWN) -GPIO(GPIO12_NC, PIN(I, 2), GPIO_INPUT | GPIO_PULL_DOWN) - -/* Alternate functions GPIO definitions */ -/* Cr50 requires no pull-ups on UART pins. */ -ALTERNATE(PIN_MASK(B, 0x03), 0, MODULE_UART, 0) /* UART from EC to Servo */ -ALTERNATE(PIN_MASK(B, 0x18), 0, MODULE_I2C, 0) /* I2C0 */ -ALTERNATE(PIN_MASK(C, 0x06), 0, MODULE_I2C, GPIO_SEL_1P8V) /* I2C1 - 1.8V */ -ALTERNATE(PIN_MASK(F, 0xC0), 0, MODULE_I2C, 0) /* I2C2 */ -ALTERNATE(PIN_MASK(E, 0x81), 0, MODULE_I2C, 0) /* I2C4 */ -ALTERNATE(PIN_MASK(A, 0x30), 0, MODULE_I2C, 0) /* I2C5 */ -ALTERNATE(PIN_MASK(L, 0x03), 0, MODULE_ADC, 0) /* ADC13 & ADC14: ADC_USB_C0_VBUS & ADC_USB_C1_VBUS */ -ALTERNATE(PIN_MASK(I, 0x28), 0, MODULE_ADC, 0) /* ADC3 & ADC5: TEMP_SENSOR_AMB & TEMP_SENSOR_CHARGER */ diff --git a/board/ampton/led.c b/board/ampton/led.c deleted file mode 100644 index e8c2c35d11..0000000000 --- a/board/ampton/led.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Power and battery LED control for Ampton - */ - -#include "ec_commands.h" -#include "gpio.h" -#include "led_common.h" -#include "led_onoff_states.h" - -#define LED_OFF_LVL 0 -#define LED_ON_LVL 1 - -__override const int led_charge_lvl_1; - -__override const int led_charge_lvl_2 = 94; - -/* Ampton: Note there is only LED for charge / power */ -__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] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC}, - {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} }, -}; -BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES); - -const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; - -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -__override void led_set_color_battery(enum ec_led_colors color) -{ - switch (color) { - case EC_LED_COLOR_WHITE: - gpio_set_level(GPIO_BAT_LED_WHITE, LED_ON_LVL); - gpio_set_level(GPIO_BAT_LED_AMBER, LED_OFF_LVL); - break; - case EC_LED_COLOR_AMBER: - gpio_set_level(GPIO_BAT_LED_WHITE, LED_OFF_LVL); - gpio_set_level(GPIO_BAT_LED_AMBER, LED_ON_LVL); - break; - default: /* LED_OFF and other unsupported colors */ - gpio_set_level(GPIO_BAT_LED_WHITE, LED_OFF_LVL); - gpio_set_level(GPIO_BAT_LED_AMBER, LED_OFF_LVL); - break; - } -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - brightness_range[EC_LED_COLOR_WHITE] = 1; - brightness_range[EC_LED_COLOR_AMBER] = 1; -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - if (brightness[EC_LED_COLOR_WHITE] != 0) - led_set_color_battery(EC_LED_COLOR_WHITE); - else if (brightness[EC_LED_COLOR_AMBER] != 0) - led_set_color_battery(EC_LED_COLOR_AMBER); - else - led_set_color_battery(LED_OFF); - - return EC_SUCCESS; -} - diff --git a/board/ampton/vif_override.xml b/board/ampton/vif_override.xml deleted file mode 100644 index 32736caf64..0000000000 --- a/board/ampton/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. ---> |