diff options
Diffstat (limited to 'baseboard/volteer')
-rw-r--r-- | baseboard/volteer/baseboard.c | 93 | ||||
-rw-r--r-- | baseboard/volteer/baseboard.h | 285 | ||||
-rw-r--r-- | baseboard/volteer/baseboard_usbc_config.h | 18 | ||||
-rw-r--r-- | baseboard/volteer/battery_presence.c | 89 | ||||
-rw-r--r-- | baseboard/volteer/build.mk | 17 | ||||
-rw-r--r-- | baseboard/volteer/cbi.c | 53 | ||||
-rw-r--r-- | baseboard/volteer/cbi.h | 21 | ||||
-rw-r--r-- | baseboard/volteer/cbi_ec_fw_config.c | 55 | ||||
-rw-r--r-- | baseboard/volteer/cbi_ec_fw_config.h | 124 | ||||
-rw-r--r-- | baseboard/volteer/cbi_ssfc.c | 41 | ||||
-rw-r--r-- | baseboard/volteer/cbi_ssfc.h | 73 | ||||
-rw-r--r-- | baseboard/volteer/charger.c | 104 | ||||
-rw-r--r-- | baseboard/volteer/power.c | 56 | ||||
-rw-r--r-- | baseboard/volteer/usb_pd_policy.c | 201 | ||||
-rw-r--r-- | baseboard/volteer/usbc_config.c | 77 |
15 files changed, 0 insertions, 1307 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c deleted file mode 100644 index 6b3ad33a35..0000000000 --- a/baseboard/volteer/baseboard.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific configuration */ -#include "adc.h" -#include "button.h" -#include "cbi_ec_fw_config.h" -#include "charger.h" -#include "charge_ramp.h" -#include "cros_board_info.h" -#include "driver/charger/isl9241.h" -#include "driver/tcpm/ps8xxx.h" -#include "driver/temp_sensor/thermistor.h" -#include "gpio.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "system.h" -#include "task.h" -#include "temp_sensor.h" -#ifdef CONFIG_ZEPHYR -#include "usbc_config.h" -#endif - -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args) - -/******************************************************************************/ -/* ADC configuration */ -const struct adc_t adc_channels[] = { - [ADC_TEMP_SENSOR_1_CHARGER] = { - .name = "TEMP_CHARGER", - .input_ch = NPCX_ADC_CH0, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_TEMP_SENSOR_2_PP3300_REGULATOR] = { - .name = "TEMP_PP3300_REGULATOR", - .input_ch = NPCX_ADC_CH1, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_TEMP_SENSOR_3_DDR_SOC] = { - .name = "TEMP_DDR_SOC", - .input_ch = NPCX_ADC_CH8, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, - [ADC_TEMP_SENSOR_4_FAN] = { - .name = "TEMP_FAN", - .input_ch = NPCX_ADC_CH3, - .factor_mul = ADC_MAX_VOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/******************************************************************************/ -/* Wake up pins */ -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_LID_OPEN, - GPIO_ACOK_OD, - GPIO_POWER_BUTTON_L, - GPIO_EC_RST_ODL, -}; -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); - -/******************************************************************************/ -/* Temperature sensor configuration */ -const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1_CHARGER] = {.name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_1_CHARGER}, - [TEMP_SENSOR_2_PP3300_REGULATOR] = {.name = "PP3300 Regulator", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_2_PP3300_REGULATOR}, - [TEMP_SENSOR_3_DDR_SOC] = {.name = "DDR and SOC", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_3_DDR_SOC}, - [TEMP_SENSOR_4_FAN] = {.name = "Fan", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_4_FAN}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h deleted file mode 100644 index 38a464813a..0000000000 --- a/baseboard/volteer/baseboard.h +++ /dev/null @@ -1,285 +0,0 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer baseboard configuration */ - -#ifndef __CROS_EC_BASEBOARD_H -#define __CROS_EC_BASEBOARD_H - -#include <stdbool.h> - -/* - * By default, enable all console messages excepted HC - */ -#define CC_DEFAULT (CC_ALL & ~(BIT(CC_HOSTCMD))) - -/* NPCX7 config */ -#define NPCX7_PWM1_SEL 1 /* GPIO C2 is 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. */ - -/* Allow objects to be linked into a flash resident section */ -#define CONFIG_CHIP_INIT_ROM_REGION - -/* EC Defines */ -#define CONFIG_LTO -#define CONFIG_BOARD_VERSION_CBI -#define CONFIG_CRC8 -#define CONFIG_CBI_EEPROM -#define CONFIG_DPTF -#define CONFIG_FPU -#define CONFIG_HIBERNATE_PSL -#define CONFIG_PWM -#define CONFIG_VBOOT_HASH -#define CONFIG_VSTORE -#define CONFIG_VSTORE_SLOT_COUNT 1 -#define CONFIG_VOLUME_BUTTONS -#define CONFIG_LOW_POWER_IDLE -#define CONFIG_BOARD_RESET_AFTER_POWER_ON - -/* Host communication */ -#define CONFIG_HOSTCMD_ESPI -#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4 - -/* Chipset config */ -#define CONFIG_CHIPSET_TIGERLAKE -#define CONFIG_CHIPSET_PP3300_RAIL_FIRST -#define CONFIG_CHIPSET_SLP_S3_L_OVERRIDE -#define CONFIG_CHIPSET_X86_RSMRST_DELAY -#define CONFIG_CHIPSET_RESET_HOOK -#define CONFIG_CPU_PROCHOT_ACTIVE_LOW -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_POWER_COMMON -#define CONFIG_POWER_S0IX -#define CONFIG_POWER_SLEEP_FAILURE_DETECTION -#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE -#define CONFIG_BOARD_HAS_RTC_RESET - -/* Common Keyboard Defines */ -#define CONFIG_CMD_KEYBOARD - -#define CONFIG_KEYBOARD_COL2_INVERTED -#define CONFIG_KEYBOARD_KEYPAD -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 -#define CONFIG_PWM_KBLIGHT - -/* Sensors */ -#define CONFIG_TABLET_MODE -#define CONFIG_GMR_TABLET_MODE - -#define CONFIG_MKBP_EVENT -#define CONFIG_MKBP_USE_GPIO -#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT -#define CONFIG_ACCEL_INTERRUPTS - -/* 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) - -/* Sensor console commands */ -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO - -/* Thermal features */ -#define CONFIG_FANS FAN_CH_COUNT -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PG_EC_DSW_PWROK -#define CONFIG_THERMISTOR -#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B -#define CONFIG_THROTTLE_AP -#define CONFIG_CHIPSET_CAN_THROTTLE - -/* Common charger defines */ -#define CONFIG_CHARGE_MANAGER -#define CONFIG_CHARGER -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHARGER_INPUT_CURRENT 512 - -/* - * Hardware based charge ramp is broken in the ISL9241 (b/169350714). - */ -#define CONFIG_CHARGE_RAMP_SW -#define CONFIG_CHARGER_ISL9241 -/* Setting ISL9241 Register Control1 switching frequency to 724kHz. */ -#define CONFIG_ISL9241_SWITCHING_FREQ ISL9241_CONTROL1_SWITCHING_FREQ_724KHZ - -#define CONFIG_USB_CHARGER -#define CONFIG_BC12_DETECT_PI3USB9201 - -/* - * Don't allow the system to boot to S0 when the battery is low and unable to - * communicate on locked systems (which haven't PD negotiated) - */ -#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT 15000 -#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 15001 - -/* Common battery defines */ -#define CONFIG_BATTERY_SMART -#define CONFIG_BATTERY_FUEL_GAUGE -#define CONFIG_BATTERY_CUT_OFF -#define CONFIG_BATTERY_PRESENT_CUSTOM -#define CONFIG_BATTERY_HW_PRESENT_CUSTOM -#define CONFIG_BATTERY_REVIVE_DISCONNECT - -/* Common LED defines */ -#define CONFIG_LED_COMMON - -/* EDP back-light control defines */ -#define CONFIG_BACKLIGHT_LID -#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EDP_BL_EN - -/* USB Type C and USB PD defines */ -/* Enable the new USB-C PD stack */ -#define CONFIG_USB_PD_TCPMV2 -#define CONFIG_USB_DRP_ACC_TRYSRC -#define CONFIG_USB_PD_REV30 - -/* - * TODO(b/158572770): TCPMv2: Conserve flash space - * Add these console commands as flash space permits. - */ -#undef CONFIG_CMD_HCDEBUG -#undef CONFIG_CMD_ACCELS -#undef CONFIG_CMD_ACCEL_INFO -#undef CONFIG_CMD_ACCELSPOOF -#undef CONFIG_CMD_PPC_DUMP - -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_ALT_MODE -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USB_PD_ALT_MODE_UFP -#define CONFIG_USB_PD_DISCHARGE_PPC -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_TCPC_RUNTIME_CONFIG -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE -#define CONFIG_USB_PD_TCPC_LOW_POWER -#define CONFIG_USB_PD_TCPM_TCPCI -#define CONFIG_USB_PD_TCPM_RT1715 -#define CONFIG_USB_PD_TCPM_TUSB422 /* USBC port C0 */ -#define CONFIG_USB_PD_TCPM_PS8815 /* USBC port USB3 DB */ -#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID -#define CONFIG_USB_PD_TCPM_MUX -#define CONFIG_HOSTCMD_PD_CONTROL /* Needed for TCPC FW update */ -#define CONFIG_CMD_USB_PD_PE - -/* - * Because of the CSE Lite, an extra cold AP reset is needed, and older cr50 - * firmware will not be able to detect it because of updated cr50 pin straps. - * Therefore, the AP will require the EC to reset it so that the proper reset - * signal will be read and verstage can execute again. - */ -#define CONFIG_CMD_AP_RESET_LOG -#define CONFIG_HOSTCMD_AP_RESET - -/* - * The PS8815 TCPC was found to require a 50ms delay to consistently work - * with non-PD chargers. Override the default low-power mode exit delay. - */ -#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE -#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (50*MSEC) - -/* Enable USB3.2 DRD */ -#define CONFIG_USB_PD_USB32_DRD - -#define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_PD_VBUS_DETECT_TCPC - -#define CONFIG_USB_MUX_RUNTIME_CONFIG - -#define CONFIG_USBC_PPC -/* Note - SN5S330 support automatically adds - * CONFIG_USBC_PPC_POLARITY - * CONFIG_USBC_PPC_SBU - * CONFIG_USBC_PPC_VCONN - */ -#define CONFIG_USBC_PPC_DEDICATED_INT - -#define CONFIG_USBC_SS_MUX -#define CONFIG_USB_MUX_VIRTUAL - -#define CONFIG_USBC_VCONN -#define CONFIG_USBC_VCONN_SWAP - -/* Enabling SOP* communication */ -#define CONFIG_CMD_USB_PD_CABLE -#define CONFIG_USB_PD_DECODE_SOP - -/* UART COMMAND */ -#define CONFIG_CMD_CHARGEN - -/* - * USB ID - * This is allocated specifically for Volteer - * http://google3/hardware/standards/usb/ - */ -#define CONFIG_USB_PID 0x503E -/* Device version of product. */ -#define CONFIG_USB_BCD_DEV 0x0000 - -/* Retimer */ -#define CONFIG_USBC_RETIMER_INTEL_BB -#define CONFIG_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG -#define CONFIG_USBC_RETIMER_FW_UPDATE - -/* Enable volume button command in EC console */ -#define CONFIG_CMD_BUTTON - -/* Enable volume button in ectool */ -#define CONFIG_HOSTCMD_BUTTON - -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" -#include "common.h" -#include "baseboard_usbc_config.h" -#include "cbi.h" - -enum adc_channel { - ADC_TEMP_SENSOR_1_CHARGER, - ADC_TEMP_SENSOR_2_PP3300_REGULATOR, - ADC_TEMP_SENSOR_3_DDR_SOC, - ADC_TEMP_SENSOR_4_FAN, - ADC_CH_COUNT -}; - -enum fan_channel { - FAN_CH_0 = 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_CHARGER, - TEMP_SENSOR_2_PP3300_REGULATOR, - TEMP_SENSOR_3_DDR_SOC, - TEMP_SENSOR_4_FAN, - TEMP_SENSOR_COUNT -}; - -/* - * Check battery disconnect state. - * This function will return if battery is initialized or not. - * @return true - initialized. false - not. - */ -__override_proto bool board_battery_is_initialized(void); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BASEBOARD_H */ diff --git a/baseboard/volteer/baseboard_usbc_config.h b/baseboard/volteer/baseboard_usbc_config.h deleted file mode 100644 index bf02b1cb34..0000000000 --- a/baseboard/volteer/baseboard_usbc_config.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* volteer family-specific USB-C configuration */ - -#ifndef __CROS_EC_BASEBOARD_USBC_CONFIG_H -#define __CROS_EC_BASEBOARD_USBC_CONFIG_H - -#include "gpio_signal.h" - -/* Common definition for the USB PD interrupt handlers. */ -void ppc_interrupt(enum gpio_signal signal); -void tcpc_alert_event(enum gpio_signal signal); -void bc12_interrupt(enum gpio_signal signal); - -#endif /* __CROS_EC_BASEBOARD_USBC_CONFIG_H */ diff --git a/baseboard/volteer/battery_presence.c b/baseboard/volteer/battery_presence.c deleted file mode 100644 index 4953d7a49e..0000000000 --- a/baseboard/volteer/battery_presence.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2019 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. - * - * Common battery presence checking for Volteer family. - * Each board should implement board_battery_info[] to define the specific - * battery packs supported. - */ -#include <stdbool.h> - -#include "battery.h" -#include "battery_smart.h" -#include "gpio.h" - -static enum battery_present batt_pres_prev = BP_NOT_SURE; - -enum battery_present battery_hw_present(void) -{ - /* The GPIO is low when the battery is physically present */ - return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; -} - -static bool battery_init(void) -{ - int batt_status; - - return battery_status(&batt_status) ? 0 : - !!(batt_status & STATUS_INITIALIZED); -} - -__overridable bool board_battery_is_initialized(void) -{ - /* - * Set default to return true - */ - return true; -} - -/* - * Physical detection of battery. - */ -static enum battery_present battery_check_present_status(void) -{ - enum battery_present batt_pres; - bool batt_initialization_state; - - /* Get the physical hardware status */ - batt_pres = battery_hw_present(); - - /* - * If the battery is not physically connected, then no need to perform - * any more checks. - */ - if (batt_pres != BP_YES) - return batt_pres; - - /* - * If the battery is present now and was present last time we checked, - * return early. - */ - if (batt_pres == batt_pres_prev) - return batt_pres; - - /* - * Check battery initialization. If the battery is not initialized, - * then return BP_NOT_SURE. Battery could be in ship - * mode and might require pre-charge current to wake it up. BP_NO is not - * returned here because charger state machine will not provide - * pre-charge current assuming that battery is not present. - */ - batt_initialization_state = board_battery_is_initialized(); - if (!batt_initialization_state) - return BP_NOT_SURE; - /* - * Ensure that battery is: - * 1. Not in cutoff - * 2. Initialized - */ - if (battery_is_cut_off() || !battery_init()) - batt_pres = BP_NO; - - return batt_pres; -} - -enum battery_present battery_is_present(void) -{ - batt_pres_prev = battery_check_present_status(); - return batt_pres_prev; -} diff --git a/baseboard/volteer/build.mk b/baseboard/volteer/build.mk deleted file mode 100644 index 08b68c5816..0000000000 --- a/baseboard/volteer/build.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -*- makefile -*- -# Copyright 2019 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Volteer baseboard specific files build -# - -baseboard-y=baseboard.o -baseboard-y+=battery_presence.o -baseboard-y+=charger.o -baseboard-y+=usb_pd_policy.o -baseboard-y+=cbi.o -baseboard-y+=cbi_ec_fw_config.o -baseboard-y+=cbi_ssfc.o -baseboard-y+=power.o -baseboard-y+=usbc_config.o diff --git a/baseboard/volteer/cbi.c b/baseboard/volteer/cbi.c deleted file mode 100644 index ea446acc4e..0000000000 --- a/baseboard/volteer/cbi.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific functions, shared with Zephyr */ - -#include "cbi_ec_fw_config.h" -#include "common.h" -#include "cros_board_info.h" -#include "hooks.h" -#include "system.h" - -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args) - -static uint8_t board_id; - -uint8_t get_board_id(void) -{ - return board_id; -} - -__overridable void board_cbi_init(void) -{ -} - -/* - * Read CBI from i2c eeprom and initialize variables for board variants - * - * Example for configuring for a USB3 DB: - * ectool cbi set 6 2 4 10 - */ -static void cbi_init(void) -{ - uint32_t cbi_val; - - /* Board ID */ - if (cbi_get_board_version(&cbi_val) != EC_SUCCESS || - cbi_val > UINT8_MAX) - CPRINTS("CBI: Read Board ID failed"); - else - board_id = cbi_val; - - CPRINTS("Board ID: %d", board_id); - - /* FW config */ - init_fw_config(); - - /* Allow the board project to make runtime changes based on CBI data */ - board_cbi_init(); -} -DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_FIRST); diff --git a/baseboard/volteer/cbi.h b/baseboard/volteer/cbi.h deleted file mode 100644 index 049c0f65e2..0000000000 --- a/baseboard/volteer/cbi.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific CBI functions, shared with Zephyr */ - -#ifndef __CROS_EC_BASEBOARD_CBI_H -#define __CROS_EC_BASEBOARD_CBI_H - -unsigned char get_board_id(void); - -/** - * Configure run-time data structures and operation based on CBI data. This - * typically includes customization for changes in the BOARD_VERSION and - * FW_CONFIG fields in CBI. This routine is called from the baseboard after - * the CBI data has been initialized. - */ -__override_proto void board_cbi_init(void); - -#endif /* __CROS_EC_BASEBOARD_CBI_H */ diff --git a/baseboard/volteer/cbi_ec_fw_config.c b/baseboard/volteer/cbi_ec_fw_config.c deleted file mode 100644 index e602691aeb..0000000000 --- a/baseboard/volteer/cbi_ec_fw_config.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "common.h" -#include "console.h" -#include "cbi_ec_fw_config.h" -#include "cros_board_info.h" - -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) - -static union volteer_cbi_fw_config fw_config; -BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t)); - -/**************************************************************************** - * Volteer FW_CONFIG access - */ -void init_fw_config(void) -{ - if (cbi_get_fw_config(&fw_config.raw_value)) { - CPRINTS("CBI: Read FW_CONFIG failed, using board defaults"); - fw_config = fw_config_defaults; - } -} - -union volteer_cbi_fw_config get_fw_config(void) -{ - return fw_config; -} - -enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void) -{ - return fw_config.usb_db; -} - -bool ec_cfg_has_tabletmode(void) -{ - return (fw_config.tabletmode == TABLETMODE_ENABLED); -} - -bool ec_cfg_has_keyboard_backlight(void) -{ - return (fw_config.kb_bl == KEYBOARD_BACKLIGHT_ENABLED); -} - -bool ec_cfg_has_numeric_pad(void) -{ - return (fw_config.num_pad == NUMERIC_PAD_ENABLED); -} - -enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void) -{ - return fw_config.kb_layout; -} diff --git a/baseboard/volteer/cbi_ec_fw_config.h b/baseboard/volteer/cbi_ec_fw_config.h deleted file mode 100644 index 0a44e1f9e4..0000000000 --- a/baseboard/volteer/cbi_ec_fw_config.h +++ /dev/null @@ -1,124 +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. - */ - -#ifndef __VOLTEER_CBI_EC_FW_CONFIG_H_ -#define __VOLTEER_CBI_EC_FW_CONFIG_H_ - -#include "stdbool.h" -#include "stdint.h" - -/**************************************************************************** - * CBI FW_CONFIG layout shared by all Volteer boards - * - * Source of truth is the program/volteer/program.star configuration file. - */ - -enum ec_cfg_usb_db_type { - DB_USB_ABSENT = 0, - DB_USB4_GEN2 = 1, - DB_USB3_ACTIVE = 2, - DB_USB4_GEN3 = 3, - DB_USB3_PASSIVE = 4, - DB_USB3_NO_A = 5, - DB_USB_COUNT -}; - -/* - * Tablet Mode (1 bit), shared by all Volteer boards - */ -enum ec_cfg_tabletmode_type { - TABLETMODE_DISABLED = 0, - TABLETMODE_ENABLED = 1, -}; - -enum ec_cfg_keyboard_backlight_type { - KEYBOARD_BACKLIGHT_DISABLED = 0, - KEYBOARD_BACKLIGHT_ENABLED = 1 -}; - -enum ec_cfg_numeric_pad_type { - NUMERIC_PAD_DISABLED = 0, - NUMERIC_PAD_ENABLED = 1 -}; - -enum ec_cfg_keyboard_layout { - KB_LAYOUT_DEFAULT = 0, - KB_LAYOUT_1 = 1 -}; - -union volteer_cbi_fw_config { - struct { - enum ec_cfg_usb_db_type usb_db : 4; - uint32_t thermal : 4; - uint32_t audio : 3; - enum ec_cfg_tabletmode_type tabletmode : 1; - uint32_t lte_db : 2; - enum ec_cfg_keyboard_backlight_type kb_bl : 1; - enum ec_cfg_numeric_pad_type num_pad : 1; - uint32_t sd_db : 4; - enum ec_cfg_keyboard_layout kb_layout : 2; - uint32_t reserved_2 : 10; - }; - uint32_t raw_value; -}; - -/* - * Each Volteer board must define the default FW_CONFIG options to use - * if the CBI data has not been initialized. - */ -extern union volteer_cbi_fw_config fw_config_defaults; - -/** - * Initialize the FW_CONFIG from CBI data. If the CBI data is not valid, set the - * FW_CONFIG to the board specific defaults. - */ -void init_fw_config(void); - -/** - * Read the cached FW_CONFIG. Guaranteed to have valid values. - * - * @return the FW_CONFIG for the board. - */ -union volteer_cbi_fw_config get_fw_config(void); - -/** - * Get the USB daughter board type from FW_CONFIG. - * - * @return the USB daughter board type. - */ -enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void); - -/** - * Check if the FW_CONFIG has enabled tablet mode operation. - * - * @return true if board supports tablet mode, false if the board supports - * clamshell operation only. - */ -bool ec_cfg_has_tabletmode(void); - -/** - * Check if the FW_CONFIG has enabled keyboard backlight. - * - * @return true if board supports keyboard backlight, false if the board - * doesn't support it. - */ -bool ec_cfg_has_keyboard_backlight(void); - -/** - * Check if the FW_CONFIG has enabled numeric pad. - * - * @return true if board supports numeric pad, false if the board - * doesn't support it. - */ -bool ec_cfg_has_numeric_pad(void); - -/** - * Get keyboard type from FW_CONFIG. - * - * @return the keyboard type. - */ -enum ec_cfg_keyboard_layout ec_cfg_keyboard_layout(void); - -#endif /* __VOLTEER_CBI_EC_FW_CONFIG_H_ */ diff --git a/baseboard/volteer/cbi_ssfc.c b/baseboard/volteer/cbi_ssfc.c deleted file mode 100644 index 42b11c4a1c..0000000000 --- a/baseboard/volteer/cbi_ssfc.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "cbi_ssfc.h" -#include "common.h" -#include "console.h" -#include "cros_board_info.h" -#include "hooks.h" - -#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args) - -/* Cache SSFC on init since we don't expect it to change in runtime */ -static union volteer_cbi_ssfc cached_ssfc; -BUILD_ASSERT(sizeof(cached_ssfc) == sizeof(uint32_t)); - -static void cbi_ssfc_init(void) -{ - if (cbi_get_ssfc(&cached_ssfc.raw_value) != EC_SUCCESS) - /* Default to 0 when CBI isn't populated */ - cached_ssfc.raw_value = 0; - - CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc.raw_value); -} -DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST); - -enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void) -{ - return cached_ssfc.base_sensor; -} - -enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void) -{ - return cached_ssfc.lid_sensor; -} - -enum ec_ssfc_lightbar get_cbi_ssfc_lightbar(void) -{ - return cached_ssfc.lightbar; -} diff --git a/baseboard/volteer/cbi_ssfc.h b/baseboard/volteer/cbi_ssfc.h deleted file mode 100644 index 27db1d3809..0000000000 --- a/baseboard/volteer/cbi_ssfc.h +++ /dev/null @@ -1,73 +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. - */ - -#ifndef _VOLTEER_CBI_SSFC__H_ -#define _VOLTEER_CBI_SSFC__H_ - -#include "stdint.h" - -/**************************************************************************** - * Volteer CBI Second Source Factory Cache - */ - -/* - * Base Sensor (Bits 0-2) - */ -enum ec_ssfc_base_sensor { - SSFC_SENSOR_BASE_DEFAULT = 0, - SSFC_SENSOR_BASE_BMI160 = 1, - SSFC_SENSOR_BASE_ICM426XX = 2 -}; - -/* - * Lid Sensor (Bits 3-5) - */ -enum ec_ssfc_lid_sensor { - SSFC_SENSOR_LID_DEFAULT = 0, - SSFC_SENSOR_LID_BMA255 = 1, - SSFC_SENSOR_LID_KX022 = 2 -}; - -/* - * Lightbar (Bits 6-7) - */ -enum ec_ssfc_lightbar { - SSFC_LIGHTBAR_NONE = 0, - SSFC_LIGHTBAR_10_LED = 1, - SSFC_LIGHTBAR_12_LED = 2 -}; - -union volteer_cbi_ssfc { - struct { - enum ec_ssfc_base_sensor base_sensor : 3; - enum ec_ssfc_lid_sensor lid_sensor : 3; - enum ec_ssfc_lightbar lightbar : 2; - uint32_t reserved_2 : 24; - }; - uint32_t raw_value; -}; - -/** - * Get the Base sensor type from SSFC_CONFIG. - * - * @return the Base sensor board type. - */ -enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void); - -/** - * Get the Lid sensor type from SSFC_CONFIG. - * - * @return the Lid sensor board type. - */ -enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void); - -/** - * Get lightbar type from SSFC_CONFIG. - * - * @return the lightbar type. - */ -enum ec_ssfc_lightbar get_cbi_ssfc_lightbar(void); - -#endif /* _Volteer_CBI_SSFC__H_ */ diff --git a/baseboard/volteer/charger.c b/baseboard/volteer/charger.c deleted file mode 100644 index a674b98f41..0000000000 --- a/baseboard/volteer/charger.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific configuration */ -#include "common.h" -#include "charger.h" -#include "charge_manager.h" -#include "charge_state.h" -#include "driver/charger/isl9241_public.h" -#include "gpio.h" -#ifdef CONFIG_ZEPHYR -#include "usbc_config.h" -#endif -#include "usbc_ppc.h" -#include "util.h" - -#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) - -/* Charger Chip Configuration */ -const struct charger_config_t chg_chips[] = { - { - .i2c_port = I2C_PORT_CHARGER, - .i2c_addr_flags = ISL9241_ADDR_FLAGS, - .drv = &isl9241_drv, - }, -}; - -int board_set_active_charge_port(int port) -{ - int is_valid_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); - int i; - - if (port == CHARGE_PORT_NONE) { - CPRINTSUSB("Disabling all charger ports"); - - /* Disable all ports. */ - for (i = 0; i < ppc_cnt; i++) { - /* - * Do not return early if one fails otherwise we can - * get into a boot loop assertion failure. - */ - if (ppc_vbus_sink_enable(i, 0)) - CPRINTSUSB("Disabling C%d as sink failed.", i); - } - - return EC_SUCCESS; - } else if (!is_valid_port) { - return EC_ERROR_INVAL; - } - - - /* Check if the port is sourcing VBUS. */ - if (ppc_is_sourcing_vbus(port)) { - CPRINTFUSB("Skip enable C%d", port); - return EC_ERROR_INVAL; - } - - CPRINTSUSB("New charge port: C%d", port); - - /* - * Turn off the other ports' sink path FETs, before enabling the - * requested charge port. - */ - for (i = 0; i < ppc_cnt; i++) { - if (i == port) - continue; - - if (ppc_vbus_sink_enable(i, 0)) - CPRINTSUSB("C%d: sink path disable failed.", i); - } - - /* Enable requested charge port. */ - if (ppc_vbus_sink_enable(port, 1)) { - CPRINTSUSB("C%d: sink path enable failed.", port); - return EC_ERROR_UNKNOWN; - } - - return EC_SUCCESS; -} - -__overridable void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), - charge_mv); -} - -void board_overcurrent_event(int port, int is_overcurrented) -{ - /* Note that the level is inverted because the pin is active low. */ - switch (port) { - case USBC_PORT_C0: - gpio_set_level(GPIO_USB_C0_OC_ODL, !is_overcurrented); - break; - case USBC_PORT_C1: - gpio_set_level(GPIO_USB_C1_OC_ODL, !is_overcurrented); - break; - } -} diff --git a/baseboard/volteer/power.c b/baseboard/volteer/power.c deleted file mode 100644 index fa20cfa93f..0000000000 --- a/baseboard/volteer/power.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "gpio.h" -#include "hooks.h" -#include "power/icelake.h" - -/* - * PWROK signal configuration, see the PWROK Generation Flow Diagram (Figure - * 235) in the Tiger Lake Platform Design Guide for the list of potential - * signals. - * - * Volteer uses this power sequence: - * GPIO_EN_PPVAR_VCCIN - Turns on the VCCIN rail. Also used as a delay to - * the VCCST_PWRGD input to the AP so this signal must be delayed - * 5 ms to meet the tCPU00 timing requirement. - * GPIO_EC_PCH_SYS_PWROK - Asserts the SYS_PWROK input to the AP. Delayed - * a total of 50 ms after ALL_SYS_PWRGD input is asserted. See - * b/144478941 for full discussion. - * - * Volteer does not provide direct EC control for the VCCST_PWRGD and PCH_PWROK - * signals. If your board adds these signals to the EC, copy this array - * to your board.c file and modify as needed. - */ -const struct intel_x86_pwrok_signal pwrok_signal_assert_list[] = { - { - .gpio = GPIO_EN_PPVAR_VCCIN, - .delay_ms = 5, - }, - { - .gpio = GPIO_EC_PCH_SYS_PWROK, - .delay_ms = 50 - 5, - }, -}; -const int pwrok_signal_assert_count = ARRAY_SIZE(pwrok_signal_assert_list); - -const struct intel_x86_pwrok_signal pwrok_signal_deassert_list[] = { - /* No delays needed during S0 exit */ - { - .gpio = GPIO_EC_PCH_SYS_PWROK, - }, - /* Turn off VCCIN last */ - { - .gpio = GPIO_EN_PPVAR_VCCIN, - }, -}; -const int pwrok_signal_deassert_count = ARRAY_SIZE(pwrok_signal_deassert_list); - -static void baseboard_init(void) -{ - /* Enable monitoring of the PROCHOT input to the EC */ - gpio_enable_interrupt(GPIO_EC_PROCHOT_IN_L); -} -DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_DEFAULT); diff --git a/baseboard/volteer/usb_pd_policy.c b/baseboard/volteer/usb_pd_policy.c deleted file mode 100644 index f939998b3d..0000000000 --- a/baseboard/volteer/usb_pd_policy.c +++ /dev/null @@ -1,201 +0,0 @@ -/* Copyright 2019 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 Volteer boards */ -#include "charge_manager.h" -#include "chipset.h" -#include "compile_time_macros.h" -#include "console.h" -#include "gpio.h" -#include "usb_common.h" -#include "usb_mux.h" -#include "usbc_ppc.h" -#include "usb_pd.h" -#include "system.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 /* defined(CONFIG_USB_PD_VBUS_DETECT_PPC) */ - -int board_vbus_source_enabled(int port) -{ - return ppc_is_sourcing_vbus(port); -} - -/* ----------------- Vendor Defined Messages ------------------ */ -/* Responses specifically for the enablement of TBT mode in the role of UFP */ - -#define OPOS_TBT 1 - -static const union tbt_mode_resp_device vdo_tbt_modes[1] = { - { - .tbt_alt_mode = 0x0001, - .tbt_adapter = TBT_ADAPTER_TBT3, - .intel_spec_b0 = 0, - .vendor_spec_b0 = 0, - .vendor_spec_b1 = 0, - } -}; - -static const uint32_t vdo_idh = VDO_IDH( - 1, /* Data caps as USB host */ - 0, /* Not a USB device */ - IDH_PTYPE_PERIPH, - 1, /* Supports alt modes */ - USB_VID_GOOGLE); - -static const uint32_t vdo_idh_rev30 = VDO_IDH_REV30( - 1, /* Data caps as USB host */ - 0, /* Not a USB device */ - IDH_PTYPE_PERIPH, - 1, /* Supports alt modes */ - IDH_PTYPE_DFP_HOST, - USB_TYPEC_RECEPTACLE, - USB_VID_GOOGLE); - -static const uint32_t vdo_product = VDO_PRODUCT( - CONFIG_USB_PID, CONFIG_USB_BCD_DEV); - -/* TODO(b/168890624): add USB4 to capability once USB4 response implemented */ -static const uint32_t vdo_ufp1 = VDO_UFP1( - (VDO_UFP1_CAPABILITY_USB20 - | VDO_UFP1_CAPABILITY_USB32), - USB_TYPEC_RECEPTACLE, - VDO_UFP1_ALT_MODE_TBT3, - USB_R30_SS_U40_GEN3); - -static const uint32_t vdo_dfp = VDO_DFP( - (VDO_DFP_HOST_CAPABILITY_USB20 - | VDO_DFP_HOST_CAPABILITY_USB32 - | VDO_DFP_HOST_CAPABILITY_USB4), - USB_TYPEC_RECEPTACLE, - 1 /* Port 1 */); - -static int svdm_tbt_compat_response_identity(int port, uint32_t *payload) -{ - /* TODO(b/154962766): Get an XID */ - payload[VDO_I(CSTAT)] = VDO_CSTAT(0); - payload[VDO_I(PRODUCT)] = vdo_product; - - if (pd_get_rev(port, TCPCI_MSG_SOP) == PD_REV30) { - /* PD Revision 3.0 */ - payload[VDO_I(IDH)] = vdo_idh_rev30; - payload[VDO_I(PTYPE_UFP1_VDO)] = vdo_ufp1; - /* TODO(b/156749387): Find power number for USB3/4 */ - payload[VDO_I(PTYPE_UFP2_VDO)] = 0; - payload[VDO_I(PTYPE_DFP_VDO)] = vdo_dfp; - return VDO_I(PTYPE_DFP_VDO) + 1; - } - - /* PD Revision 2.0 */ - payload[VDO_I(IDH)] = vdo_idh; - return VDO_I(PRODUCT) + 1; -} - -static int svdm_tbt_compat_response_svids(int port, uint32_t *payload) -{ - payload[1] = VDO_SVID(USB_VID_INTEL, 0); - return 2; -} - -static int svdm_tbt_compat_response_modes(int port, uint32_t *payload) -{ - if (PD_VDO_VID(payload[0]) == USB_VID_INTEL) { - memcpy(payload + 1, vdo_tbt_modes, sizeof(vdo_tbt_modes)); - return ARRAY_SIZE(vdo_tbt_modes) + 1; - } else { - return 0; /* NAK */ - } -} - -static int svdm_tbt_compat_response_enter_mode( - int port, uint32_t *payload) -{ - mux_state_t mux_state = 0; - - /* Do not enter mode while CPU is off. */ - if (chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF)) - return 0; /* NAK */ - - if ((PD_VDO_VID(payload[0]) != USB_VID_INTEL) || - (PD_VDO_OPOS(payload[0]) != OPOS_TBT)) - return 0; /* NAK */ - - mux_state = usb_mux_get(port); - /* - * Ref: USB PD 3.0 Spec figure 6-21 Successful Enter Mode sequence - * UFP (responder) should be in USB mode or safe mode before sending - * Enter Mode Command response. - */ - if ((mux_state & USB_PD_MUX_USB_ENABLED) || - (mux_state & USB_PD_MUX_SAFE_MODE)) { - pd_ufp_set_enter_mode(port, payload); - set_tbt_compat_mode_ready(port); - CPRINTS("UFP Enter TBT mode"); - return 1; /* ACK */ - } - - CPRINTS("UFP failed to enter TBT mode(mux=0x%x)", mux_state); - return 0; -} - -const struct svdm_response svdm_rsp = { - .identity = &svdm_tbt_compat_response_identity, - .svids = &svdm_tbt_compat_response_svids, - .modes = &svdm_tbt_compat_response_modes, - .enter_mode = &svdm_tbt_compat_response_enter_mode, - .amode = NULL, - .exit_mode = NULL, -}; diff --git a/baseboard/volteer/usbc_config.c b/baseboard/volteer/usbc_config.c deleted file mode 100644 index 1e483eae34..0000000000 --- a/baseboard/volteer/usbc_config.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Volteer family-specific USB-C configuration */ - -#include "common.h" -#include "charge_manager.h" -#include "charge_ramp.h" -#include "charge_state.h" -#include "gpio.h" -#include "task.h" -#ifdef CONFIG_ZEPHYR -#include "usbc_config.h" -#include "baseboard_usbc_config.h" -#endif -#include "usbc_ppc.h" -#include "usb_pd.h" -#include "usb_charge.h" -#include "util.h" -#include "driver/charger/isl9241_public.h" - -/******************************************************************************/ -void tcpc_alert_event(enum gpio_signal signal) -{ - /* TODO: b/140572591 - check correct operation for Volteer */ - - int port = -1; - - switch (signal) { - case GPIO_USB_C0_TCPC_INT_ODL: - port = USBC_PORT_C0; - break; - case GPIO_USB_C1_TCPC_INT_ODL: - port = USBC_PORT_C1; - break; - default: - return; - } - - schedule_deferred_pd_interrupt(port); -} - -void bc12_interrupt(enum gpio_signal signal) -{ - switch (signal) { - case GPIO_USB_C0_BC12_INT_ODL: - task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12); - break; - - case GPIO_USB_C1_BC12_INT_ODL: - task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12); - break; - - default: - break; - } -} - -/** - * Return if VBUS is too low - */ -int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state) -{ - int voltage; - - if (charger_get_vbus_voltage(port, &voltage)) - voltage = 0; - - /* - * For legacy BC1.2 charging with CONFIG_CHARGE_RAMP_SW, ramp up input - * current until voltage drops to the minimum input voltage of the - * charger, 4.096V. - */ - return voltage < ISL9241_BC12_MIN_VOLTAGE; -} |