diff options
Diffstat (limited to 'board/host')
-rw-r--r-- | board/host/battery.c | 82 | ||||
-rw-r--r-- | board/host/board.c | 134 | ||||
-rw-r--r-- | board/host/board.h | 97 | ||||
-rw-r--r-- | board/host/build.mk | 15 | ||||
-rw-r--r-- | board/host/charger.c | 175 | ||||
-rw-r--r-- | board/host/chipset.c | 76 | ||||
-rw-r--r-- | board/host/ec.tasklist | 13 | ||||
-rw-r--r-- | board/host/fan.c | 85 | ||||
-rw-r--r-- | board/host/gpio.inc | 38 | ||||
-rw-r--r-- | board/host/usb_pd_config.c | 35 | ||||
-rw-r--r-- | board/host/usb_pd_config.h | 24 | ||||
-rw-r--r-- | board/host/usb_pd_policy.c | 81 | ||||
-rw-r--r-- | board/host/vif_override.xml | 3 |
13 files changed, 0 insertions, 858 deletions
diff --git a/board/host/battery.c b/board/host/battery.c deleted file mode 100644 index 1228485ab7..0000000000 --- a/board/host/battery.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2013 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. - * - * Smart battery driver. - */ - -#include "battery.h" -#include "battery_smart.h" -#include "common.h" -#include "console.h" -#include "test_util.h" -#include "util.h" - -static uint16_t mock_smart_battery[SB_MANUFACTURER_DATA + 1]; - -int sb_i2c_xfer(int port, uint16_t slave_addr_flags, - const uint8_t *out, int out_size, - uint8_t *in, int in_size, int flags) -{ - if (out_size == 0) - return EC_SUCCESS; - - if (port != I2C_PORT_BATTERY || slave_addr_flags != BATTERY_ADDR_FLAGS) - return EC_ERROR_INVAL; - if (out[0] >= ARRAY_SIZE(mock_smart_battery)) - return EC_ERROR_UNIMPLEMENTED; - if (out_size == 1) { - /* Read */ - if (in_size != 2) - /* We are not doing a read16, assume read string */ - return EC_SUCCESS; - else - *(uint16_t *)in = mock_smart_battery[out[0]]; - } else { - /* write */ - if (out_size != 3) - /* We are only expecting write 16 */ - return EC_ERROR_UNIMPLEMENTED; - else - mock_smart_battery[out[0]] = (out[2] << 8) | out[1]; - } - return EC_SUCCESS; -} -DECLARE_TEST_I2C_XFER(sb_i2c_xfer); - -int battery_time_at_rate(int rate, int *minutes) -{ - return EC_SUCCESS; -} - -static const struct battery_info bat_info = { - /* - * Design voltage - * max = 8.4V - * normal = 7.4V - * min = 6.0V - */ - .voltage_max = 8400, - .voltage_normal = 7400, - .voltage_min = 6000, - - /* Pre-charge current: I <= 0.01C */ - .precharge_current = 64, /* mA */ - - /* - * Operational temperature range - * 0 <= T_charge <= 50 deg C - * -20 <= T_discharge <= 60 deg C - */ - .start_charging_min_c = 0, - .start_charging_max_c = 50, - .charging_min_c = 0, - .charging_max_c = 50, - .discharging_min_c = -20, - .discharging_max_c = 60, -}; - -const struct battery_info *battery_get_info(void) -{ - return &bat_info; -} diff --git a/board/host/board.c b/board/host/board.c deleted file mode 100644 index 191fd832e1..0000000000 --- a/board/host/board.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2013 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. - */ -/* Emulator board-specific configuration */ - -#include "battery.h" -#include "button.h" -#include "cros_board_info.h" -#include "extpower.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "inductive_charging.h" -#include "lid_switch.h" -#include "motion_sense.h" -#include "motion_lid.h" -#include "power_button.h" -#include "spi.h" -#include "temp_sensor.h" -#include "test_util.h" -#include "timer.h" -#include "util.h" - -/* - * GPIO_0 is the name generated by the gpio.inc GPIO macros for all of the host - * GPIO ports. This maps back to 0, which is then ignored by the host GPIO mock - * code. - */ -#define GPIO_0 0 - -#include "gpio_list.h" - -test_mockable enum battery_present battery_is_present(void) -{ - return BP_YES; -} - -test_mockable_static int mock_temp_get_val(int idx, int *temp_ptr) -{ - *temp_ptr = 0; - return EC_SUCCESS; -} - -const struct temp_sensor_t temp_sensors[] = { - {"CPU", TEMP_SENSOR_TYPE_CPU, mock_temp_get_val, 0}, - {"Board", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 1}, - {"Case", TEMP_SENSOR_TYPE_CASE, mock_temp_get_val, 2}, - {"Battery", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 3}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -test_mockable void button_interrupt(enum gpio_signal signal) -{ -} - -test_mockable void fps_event(enum gpio_signal signal) -{ -} - -#ifdef CONFIG_I2C -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { -#ifdef I2C_PORT_BATTERY - {"battery", I2C_PORT_BATTERY, 100, 0, 0}, -#elif defined I2C_PORT_LIGHTBAR - {"lightbar", I2C_PORT_LIGHTBAR, 100, 0, 0}, -#elif defined I2C_PORT_HOST_TCPC - {"tcpc", I2C_PORT_HOST_TCPC, 100, 0, 0}, -#elif defined I2C_PORT_EEPROM - {"eeprom", I2C_PORT_EEPROM, 100, 0, 0}, -#elif defined I2C_PORT_WLC - {"wlc", I2C_PORT_WLC, 100, 0, 0}, -#endif -}; - -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -#endif - -#ifdef CONFIG_SPI_CONTROLLER -/* SPI devices */ -const struct spi_device_t spi_devices[] = { - /* Fingerprint sensor (SCLK at 4Mhz) */ - { CONFIG_SPI_FP_PORT, 3, GPIO_SPI1_NSS }, -}; - -const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); -#endif - -#ifdef TEST_BUILD -/* Poor source of entropy for testing purpose. */ -int board_get_entropy(void *buffer, int len) -{ - static uint32_t seed = 0xcafecafe; - int i = 0; - uint8_t *data = buffer; - - for (i = 0; i < len; i++) { - seed *= 7; - data[i] = seed + (seed >> 24); - } - - return 1; -} -#endif - -static uint8_t eeprom[CBI_IMAGE_SIZE]; - -int eeprom_i2c_xfer(int port, uint16_t addr_flags, - const uint8_t *out, int out_size, - uint8_t *in, int in_size, int flags) -{ - static int offset; - - if (port != I2C_PORT_EEPROM || addr_flags != I2C_ADDR_EEPROM_FLAGS) - return EC_ERROR_INVAL; - - if (out_size == 1 && (flags & I2C_XFER_START)) { - offset = *out; - } else { - if (offset + out_size > sizeof(eeprom)) - return EC_ERROR_OVERFLOW; - memcpy(&eeprom[offset], out, out_size); - } - - if (in) { - if (offset + in_size > sizeof(eeprom)) - return EC_ERROR_OVERFLOW; - memcpy(in, &eeprom[offset], in_size); - } - - return EC_SUCCESS; -} -DECLARE_TEST_I2C_XFER(eeprom_i2c_xfer); diff --git a/board/host/board.h b/board/host/board.h deleted file mode 100644 index f9d00961e7..0000000000 --- a/board/host/board.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2013 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. - */ - -/* Emulator board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -/* Optional features */ -/* Default-yes, override to no by including fake_battery module. */ -#define CONFIG_BATTERY_PRESENT_CUSTOM -#undef CONFIG_CMD_PD -#define CONFIG_CBI_EEPROM -#define CONFIG_EXTPOWER_GPIO -#undef CONFIG_FMAP -#define CONFIG_POWER_BUTTON -#undef CONFIG_WATCHDOG -#define CONFIG_SWITCH -#define CONFIG_INDUCTIVE_CHARGING - -#undef CONFIG_CONSOLE_HISTORY -#define CONFIG_CONSOLE_HISTORY 4 - -#define CONFIG_WP_ACTIVE_HIGH - -#define CONFIG_LIBCRYPTOC - -#define CONFIG_USB_PD_CUSTOM_PDO -#define CONFIG_USB_PD_DUAL_ROLE - -#include "gpio_signal.h" - -enum temp_sensor_id { - TEMP_SENSOR_CPU = 0, - TEMP_SENSOR_BOARD, - TEMP_SENSOR_CASE, - TEMP_SENSOR_BATTERY, - - TEMP_SENSOR_COUNT -}; - -enum adc_channel { - ADC_CH_CHARGER_CURRENT, - ADC_AC_ADAPTER_ID_VOLTAGE, - - ADC_CH_COUNT -}; - -/* Fake test charge suppliers */ -enum { - CHARGE_SUPPLIER_TEST1, - CHARGE_SUPPLIER_TEST2, - CHARGE_SUPPLIER_TEST3, - CHARGE_SUPPLIER_TEST4, - CHARGE_SUPPLIER_TEST5, - CHARGE_SUPPLIER_TEST6, - CHARGE_SUPPLIER_TEST7, - CHARGE_SUPPLIER_TEST8, - CHARGE_SUPPLIER_TEST9, - CHARGE_SUPPLIER_TEST10, - CHARGE_SUPPLIER_TEST_COUNT -}; - -/* Standard-current Rp */ -#define PD_SRC_VNC PD_SRC_DEF_VNC_MV -#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV - -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 20000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 20000 /* us */ - -/* Define typical operating power and max power */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 60000 -#define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_VOLTAGE_MV 20000 - -#define PD_MIN_CURRENT_MA 500 -#define PD_MIN_POWER_MW 7500 - -/* Configuration for fake Fingerprint Sensor */ -#define CONFIG_SPI_CONTROLLER -#define CONFIG_SPI_FP_PORT 1 /* SPI1: third master config */ - -#define CONFIG_RNG -void fps_event(enum gpio_signal signal); - -#define CONFIG_CRC8 - -#define CONFIG_I2C -#define CONFIG_I2C_CONTROLLER -#define I2C_PORT_EEPROM 0 -#define I2C_ADDR_EEPROM_FLAGS 0x50 - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/host/build.mk b/board/host/build.mk deleted file mode 100644 index 241f197342..0000000000 --- a/board/host/build.mk +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# Copyright 2013 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:=host - -board-y=board.o -board-$(HAS_TASK_CHIPSET)+=chipset.o -board-$(CONFIG_BATTERY_MOCK)+=battery.o charger.o -board-$(CONFIG_FANS)+=fan.o -board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o usb_pd_config.o diff --git a/board/host/charger.c b/board/host/charger.c deleted file mode 100644 index 4db1f44351..0000000000 --- a/board/host/charger.c +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright 2012 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. - * - * Mock battery charger driver. - */ - -#include "battery_smart.h" -#include "charger.h" -#include "console.h" -#include "common.h" -#include "util.h" - -static const struct charger_info mock_charger_info = { - .name = "MockCharger", - .voltage_max = 19200, - .voltage_min = 1024, - .voltage_step = 16, - .current_max = 8192, - .current_min = 128, - .current_step = 128, - .input_current_max = 8064, - .input_current_min = 128, - .input_current_step = 128, -}; - -#define OPTION_CHARGE_INHIBIT BIT(0) - -static uint32_t mock_option; -static uint32_t mock_mode; -static uint32_t mock_current; -static uint32_t mock_voltage; -static uint32_t mock_input_current; - -static const struct charger_info *mock_get_info(int chgnum) -{ - return &mock_charger_info; -} - - -static enum ec_error_list mock_get_status(int chgnum, int *status) -{ - *status = CHARGER_LEVEL_2; - if (mock_mode & CHARGE_FLAG_INHIBIT_CHARGE) - *status |= CHARGER_CHARGE_INHIBITED; - - return EC_SUCCESS; -} - - -static enum ec_error_list mock_set_mode(int chgnum, int mode) -{ - if (mode & CHARGE_FLAG_INHIBIT_CHARGE) - mock_mode |= OPTION_CHARGE_INHIBIT; - else - mock_mode &= ~OPTION_CHARGE_INHIBIT; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_get_current(int chgnum, int *current) -{ - *current = mock_current; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_set_current(int chgnum, int current) -{ - const struct charger_info *info = mock_get_info(chgnum); - - if (current > 0 && current < info->current_min) - current = info->current_min; - if (current > info->current_max) - current = info->current_max; - - if (mock_current != current) - ccprintf("Charger set current: %d\n", current); - mock_current = current; - return EC_SUCCESS; -} - -static enum ec_error_list mock_get_voltage(int chgnum, int *voltage) -{ - *voltage = mock_voltage; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_set_voltage(int chgnum, int voltage) -{ - mock_voltage = voltage; - ccprintf("Charger set voltage: %d\n", voltage); - return EC_SUCCESS; -} - - -static enum ec_error_list mock_get_option(int chgnum, int *option) -{ - *option = mock_option; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_set_option(int chgnum, int option) -{ - mock_option = option; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_manufacturer_id(int chgnum, int *id) -{ - return EC_SUCCESS; -} - - -static enum ec_error_list mock_device_id(int chgnum, int *id) -{ - return EC_SUCCESS; -} - -static enum ec_error_list mock_get_input_current_limit(int chgnum, - int *input_current) -{ - *input_current = mock_input_current; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_set_input_current_limit(int chgnum, int current) -{ - const struct charger_info *info = mock_get_info(chgnum); - - if (current < info->input_current_min) - current = info->input_current_min; - if (current > info->input_current_max) - current = info->input_current_max; - - if (mock_input_current != current) - ccprintf("Charger set input current: %d\n", current); - - mock_input_current = current; - return EC_SUCCESS; -} - - -static enum ec_error_list mock_post_init(int chgnum) -{ - mock_current = mock_input_current = CONFIG_CHARGER_INPUT_CURRENT; - return EC_SUCCESS; -} - -const struct charger_drv mock_drv = { - .post_init = &mock_post_init, - .get_info = &mock_get_info, - .get_status = &mock_get_status, - .set_mode = &mock_set_mode, - .get_current = &mock_get_current, - .set_current = &mock_set_current, - .get_voltage = &mock_get_voltage, - .set_voltage = &mock_set_voltage, - .set_input_current_limit = &mock_set_input_current_limit, - .get_input_current_limit = &mock_get_input_current_limit, - .manufacturer_id = &mock_manufacturer_id, - .device_id = &mock_device_id, - .get_option = &mock_get_option, - .set_option = &mock_set_option, -}; - -const struct charger_config_t chg_chips[] = { - { - .drv = &mock_drv, - }, -}; diff --git a/board/host/chipset.c b/board/host/chipset.c deleted file mode 100644 index 3cb859eb29..0000000000 --- a/board/host/chipset.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2013 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. - */ - -/* Chipset module for emulator */ - -#include <stdio.h> -#include "chipset.h" -#include "common.h" -#include "hooks.h" -#include "task.h" -#include "test_util.h" - -static int chipset_state = CHIPSET_STATE_SOFT_OFF; -static int power_on_req; -static int power_off_req; - -test_mockable void chipset_reset(enum chipset_reset_reason reason) -{ - fprintf(stderr, "Chipset reset: %d!\n", reason); -} - -test_mockable void chipset_throttle_cpu(int throttle) -{ - /* Do nothing */ -} - -test_mockable void chipset_force_shutdown(enum chipset_shutdown_reason reason) -{ - /* Do nothing */ -} - -test_mockable int chipset_in_state(int state_mask) -{ - return state_mask & chipset_state; -} - -test_mockable int chipset_in_or_transitioning_to_state(int state_mask) -{ - return state_mask & chipset_state; -} - -void test_chipset_on(void) -{ - if (chipset_in_state(CHIPSET_STATE_ON)) - return; - power_on_req = 1; - task_wake(TASK_ID_CHIPSET); -} - -void test_chipset_off(void) -{ - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - return; - power_off_req = 1; - task_wake(TASK_ID_CHIPSET); -} - -test_mockable void chipset_task(void) -{ - while (1) { - while (!power_on_req) - task_wait_event(-1); - power_on_req = 0; - hook_notify(HOOK_CHIPSET_PRE_INIT); - chipset_state = CHIPSET_STATE_ON; - hook_notify(HOOK_CHIPSET_STARTUP); - while (!power_off_req) - task_wait_event(-1); - power_off_req = 0; - chipset_state = CHIPSET_STATE_SOFT_OFF; - hook_notify(HOOK_CHIPSET_SHUTDOWN); - hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE); - } -} diff --git a/board/host/ec.tasklist b/board/host/ec.tasklist deleted file mode 100644 index c056c51e8a..0000000000 --- a/board/host/ec.tasklist +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright 2013 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, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/host/fan.c b/board/host/fan.c deleted file mode 100644 index 1e1001f1cd..0000000000 --- a/board/host/fan.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2013 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. - */ - -/* Mocked fan implementation for tests */ - -#include "fan.h" -#include "util.h" - -const struct fan_conf fan_conf_0 = { - .flags = FAN_USE_RPM_MODE, - .ch = 0, - .pgood_gpio = -1, - .enable_gpio = -1, -}; - -const struct fan_rpm fan_rpm_0 = { - .rpm_min = 1000, - .rpm_start = 1500, - .rpm_max = 5000, -}; - -const struct fan_t fans[CONFIG_FANS] = { - { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, -}; - -static int mock_enabled; -void fan_set_enabled(int ch, int enabled) -{ - mock_enabled = enabled; -} -int fan_get_enabled(int ch) -{ - return mock_enabled; -} - -static int mock_percent; -void fan_set_duty(int ch, int percent) -{ - mock_percent = percent; -} -int fan_get_duty(int ch) -{ - return mock_percent; -} - -static int mock_rpm_mode; -void fan_set_rpm_mode(int ch, int rpm_mode) -{ - mock_rpm_mode = rpm_mode; -} -int fan_get_rpm_mode(int ch) -{ - return mock_rpm_mode; -} - -int mock_rpm; -void fan_set_rpm_target(int ch, int rpm) -{ - mock_rpm = rpm; -} -int fan_get_rpm_actual(int ch) -{ - return mock_rpm; -} -int fan_get_rpm_target(int ch) -{ - return mock_rpm; -} - -enum fan_status fan_get_status(int ch) -{ - return FAN_STATUS_LOCKED; -} - -int fan_is_stalled(int ch) -{ - return 0; -} - -void fan_channel_setup(int ch, unsigned int flags) -{ - /* nothing to do */ -} diff --git a/board/host/gpio.inc b/board/host/gpio.inc deleted file mode 100644 index ce69385259..0000000000 --- a/board/host/gpio.inc +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2014 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. */ - -GPIO_INT(LID_OPEN, PIN(0, 0), GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(POWER_BUTTON_L, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(AC_PRESENT, PIN(0, 2), GPIO_INT_BOTH, extpower_interrupt) -GPIO_INT(VOLUME_DOWN_L, PIN(0, 3), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(VOLUME_UP_L, PIN(0, 4), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(CHARGE_DONE, PIN(0, 5), GPIO_INT_BOTH, inductive_charging_interrupt) -/* Fingerprint */ -GPIO_INT(FPS_INT, PIN(0, 14), GPIO_INT_RISING, fps_event) - -GPIO(EC_INT_L, PIN(0, 6), 0) -GPIO(WP, PIN(0, 7), 0) -GPIO(ENTERING_RW, PIN(0, 8), 0) -GPIO(PCH_BKLTEN, PIN(0, 9), 0) -GPIO(ENABLE_BACKLIGHT, PIN(0, 10), 0) - -/* Inductive charging */ -GPIO(CHARGE_EN, PIN(0, 11), 0) -GPIO(BASE_CHG_VDD_EN, PIN(0, 12), 0) - -/* Fingerprint */ -GPIO(SPI1_NSS, PIN(0, 13), GPIO_OUT_HIGH) - -GPIO(USB_C0_DISCHARGE, PIN(0, 15), 0) - -GPIO(I2C_SCL, PIN(0, 16), GPIO_INPUT) -GPIO(I2C_SDA, PIN(0, 17), GPIO_INPUT) - -GPIO(EC_CBI_WP, PIN(0, 18), GPIO_OUT_LOW) diff --git a/board/host/usb_pd_config.c b/board/host/usb_pd_config.c deleted file mode 100644 index 91c30d1755..0000000000 --- a/board/host/usb_pd_config.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2014 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. - */ - -/* USB Power delivery board configuration */ - -#include "test_util.h" - -test_mockable void pd_select_polarity(int port, int polarity) -{ - /* Not implemented */ -} - -test_mockable void pd_tx_init(void) -{ - /* Not implemented */ -} - -test_mockable void pd_set_host_mode(int port, int enable) -{ - /* Not implemented */ -} - -test_mockable void pd_config_init(int port, uint8_t power_role) -{ - /* Not implemented */ -} - -test_mockable int pd_adc_read(int port, int cc) -{ - /* Not implemented */ - return 0; -} - diff --git a/board/host/usb_pd_config.h b/board/host/usb_pd_config.h deleted file mode 100644 index fb12b2ce7d..0000000000 --- a/board/host/usb_pd_config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2014 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. - */ - -/* USB Power delivery board configuration */ - -#ifndef __CROS_EC_USB_PD_CONFIG_H -#define __CROS_EC_USB_PD_CONFIG_H - -/* Use software CRC */ -#define CONFIG_SW_CRC - -void pd_select_polarity(int port, int polarity); - -void pd_tx_init(void); - -void pd_set_host_mode(int port, int enable); - -void pd_config_init(int port, uint8_t power_role); - -int pd_adc_read(int port, int cc); - -#endif /* __CROS_EC_USB_PD_CONFIG_H */ diff --git a/board/host/usb_pd_policy.c b/board/host/usb_pd_policy.c deleted file mode 100644 index 23285f4838..0000000000 --- a/board/host/usb_pd_policy.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2014 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "common.h" -#include "console.h" -#include "usb_pd.h" -#include "util.h" - -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) - -#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP) - -const uint32_t pd_src_pdo[] = { - PDO_FIXED(5000, 900, PDO_FIXED_FLAGS), - PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS), -}; -const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo); - -const uint32_t pd_snk_pdo[] = { - PDO_FIXED(5000, 500, PDO_FIXED_FLAGS), - PDO_BATT(4750, 21000, 15000), - PDO_VAR(4750, 21000, 3000), -}; -const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); - -test_mockable int pd_set_power_supply_ready(int port) -{ - /* Not implemented */ - return EC_SUCCESS; -} - -test_mockable void pd_power_supply_reset(int port) -{ - /* Not implemented */ -} - -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - /* Not implemented */ -} - -test_mockable int pd_snk_is_vbus_provided(int port) -{ - /* Not implemented */ - return 1; -} - -__override int pd_check_power_swap(int port) -{ - /* Always allow power swap */ - return 1; -} - -__override int pd_check_data_swap(int port, - enum pd_data_role data_role) -{ - /* Always allow data swap */ - return 1; -} - -__override void pd_check_pr_role(int port, - enum pd_power_role pr_role, - int flags) -{ -} - -__override void pd_check_dr_role(int port, - enum pd_data_role dr_role, - int flags) -{ -} - -__override int pd_custom_vdm(int port, int cnt, uint32_t *payload, - uint32_t **rpayload) -{ - return 0; -} diff --git a/board/host/vif_override.xml b/board/host/vif_override.xml deleted file mode 100644 index 32736caf64..0000000000 --- a/board/host/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. ---> |