mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 18:41:11 +00:00
Fizz: Initialize board directory
Noteworthy changes: * Remove motion sensors * Remove MKBP keyboard * Temp sensor (TMP432) * Remove BC1.2 * One TCPC port (PS8751) * Remove lid switch * Remove backlight * Switch PMIC to TPS650830 BUG=b:37271713 BRANCH=none TEST=Boot Fizz off of barrel jack. Change-Id: Id3b1ab1d10ad52786d75dc04bc3115c80ea31ee4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/459114 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
59c8289a69
commit
5b7e50ba20
@@ -17,30 +17,23 @@
|
||||
#include "charger.h"
|
||||
#include "chipset.h"
|
||||
#include "console.h"
|
||||
#include "driver/accelgyro_bmi160.h"
|
||||
#include "driver/als_opt3001.h"
|
||||
#include "driver/baro_bmp280.h"
|
||||
#include "driver/tcpm/anx74xx.h"
|
||||
#include "driver/pmic_tps650830.h"
|
||||
#include "driver/temp_sensor/tmp432.h"
|
||||
#include "driver/tcpm/ps8751.h"
|
||||
#include "driver/tcpm/tcpci.h"
|
||||
#include "driver/tcpm/tcpm.h"
|
||||
#include "driver/temp_sensor/bd99992gw.h"
|
||||
#include "extpower.h"
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "host_command.h"
|
||||
#include "i2c.h"
|
||||
#include "lid_switch.h"
|
||||
#include "math_util.h"
|
||||
#include "motion_lid.h"
|
||||
#include "motion_sense.h"
|
||||
#include "pi3usb9281.h"
|
||||
#include "power.h"
|
||||
#include "power_button.h"
|
||||
#include "spi.h"
|
||||
#include "switch.h"
|
||||
#include "system.h"
|
||||
#include "tablet_mode.h"
|
||||
#include "task.h"
|
||||
#include "temp_sensor.h"
|
||||
#include "timer.h"
|
||||
@@ -57,11 +50,7 @@
|
||||
|
||||
static void tcpc_alert_event(enum gpio_signal signal)
|
||||
{
|
||||
if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
|
||||
!gpio_get_level(GPIO_USB_C0_PD_RST_L))
|
||||
return;
|
||||
else if ((signal == GPIO_USB_C1_PD_INT_ODL) &&
|
||||
!gpio_get_level(GPIO_USB_C1_PD_RST_L))
|
||||
if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL))
|
||||
return;
|
||||
|
||||
#ifdef HAS_TASK_PDCMD
|
||||
@@ -72,135 +61,9 @@ static void tcpc_alert_event(enum gpio_signal signal)
|
||||
|
||||
void vbus0_evt(enum gpio_signal signal)
|
||||
{
|
||||
/* VBUS present GPIO is inverted */
|
||||
usb_charger_vbus_change(0, !gpio_get_level(signal));
|
||||
task_wake(TASK_ID_PD_C0);
|
||||
}
|
||||
|
||||
void vbus1_evt(enum gpio_signal signal)
|
||||
{
|
||||
/* VBUS present GPIO is inverted */
|
||||
usb_charger_vbus_change(1, !gpio_get_level(signal));
|
||||
task_wake(TASK_ID_PD_C1);
|
||||
}
|
||||
|
||||
void usb0_evt(enum gpio_signal signal)
|
||||
{
|
||||
task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0);
|
||||
}
|
||||
|
||||
void usb1_evt(enum gpio_signal signal)
|
||||
{
|
||||
task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
static void anx74xx_cable_det_handler(void)
|
||||
{
|
||||
int level = gpio_get_level(GPIO_USB_C0_CABLE_DET);
|
||||
|
||||
/*
|
||||
* Setting the low power is handled by DRP status hence
|
||||
* handle only the attach event.
|
||||
*/
|
||||
if (level)
|
||||
anx74xx_handle_power_mode(NPCX_I2C_PORT0_0,
|
||||
ANX74XX_NORMAL_MODE);
|
||||
|
||||
/* confirm if cable_det is asserted */
|
||||
if (!level || gpio_get_level(GPIO_USB_C0_PD_RST_L))
|
||||
return;
|
||||
|
||||
task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET, 0);
|
||||
}
|
||||
DECLARE_DEFERRED(anx74xx_cable_det_handler);
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, anx74xx_cable_det_handler, HOOK_PRIO_LAST);
|
||||
|
||||
void anx74xx_cable_det_interrupt(enum gpio_signal signal)
|
||||
{
|
||||
/* debounce for 2ms */
|
||||
hook_call_deferred(&anx74xx_cable_det_handler_data, (2 * MSEC));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Base detection and debouncing
|
||||
*
|
||||
* Lid has 100K pull-up, base has 5.1K pull-down, so the ADC
|
||||
* value should be around 5.1/(100+5.1)*3300 = 160.
|
||||
* TODO(crosbug.com/p/61098): Fine-tune these values.
|
||||
*/
|
||||
#define BASE_DETECT_DEBOUNCE_US (5 * MSEC)
|
||||
#define BASE_DETECT_MIN_MV 140
|
||||
#define BASE_DETECT_MAX_MV 180
|
||||
|
||||
static uint64_t base_detect_debounce_time;
|
||||
|
||||
static void base_detect_deferred(void);
|
||||
DECLARE_DEFERRED(base_detect_deferred);
|
||||
|
||||
enum base_status {
|
||||
BASE_DISCONNECTED = 0,
|
||||
BASE_CONNECTED = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
* This function is called whenever there is a change in the base detect
|
||||
* status. Actions taken include:
|
||||
* 1. Change in power to base
|
||||
* 2. Indicate mode change to host.
|
||||
* 3. Indicate tablet mode to host. Current assumption is that if base is
|
||||
* disconnected then the system is in tablet mode, else if the base is
|
||||
* connected, then the system is not in tablet mode.
|
||||
*/
|
||||
static void base_detect_change(enum base_status connected)
|
||||
{
|
||||
CPRINTS("Base %sconnected", (connected == BASE_DISCONNECTED) ?
|
||||
"not " : "");
|
||||
gpio_set_level(GPIO_PP3300_DX_BASE, connected);
|
||||
host_set_single_event(EC_HOST_EVENT_MODE_CHANGE);
|
||||
tablet_set_mode(!connected);
|
||||
}
|
||||
|
||||
static void base_detect_deferred(void)
|
||||
{
|
||||
uint64_t time_now = get_time().val;
|
||||
|
||||
if (base_detect_debounce_time <= time_now) {
|
||||
int v;
|
||||
|
||||
v = adc_read_channel(ADC_BASE_DET);
|
||||
if (v == ADC_READ_ERROR)
|
||||
return;
|
||||
CPRINTS("%s = %d\n", adc_channels[ADC_BASE_DET].name, v);
|
||||
|
||||
if (v >= BASE_DETECT_MIN_MV && v <= BASE_DETECT_MAX_MV)
|
||||
base_detect_change(BASE_CONNECTED);
|
||||
else {
|
||||
/*
|
||||
* TODO(crosbug.com/p/61098): Figure out what to do with
|
||||
* other ADC values that do not clearly indicate base
|
||||
* presence or absence.
|
||||
*/
|
||||
base_detect_change(BASE_DISCONNECTED);
|
||||
}
|
||||
} else {
|
||||
hook_call_deferred(&base_detect_deferred_data,
|
||||
base_detect_debounce_time - time_now);
|
||||
}
|
||||
}
|
||||
|
||||
void base_detect_interrupt(enum gpio_signal signal)
|
||||
{
|
||||
uint64_t time_now = get_time().val;
|
||||
|
||||
if (base_detect_debounce_time <= time_now)
|
||||
hook_call_deferred(&base_detect_deferred_data,
|
||||
BASE_DETECT_DEBOUNCE_US);
|
||||
|
||||
base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US;
|
||||
}
|
||||
|
||||
#include "gpio_list.h"
|
||||
|
||||
/* power signal list. Must match order of enum power_signal. */
|
||||
@@ -221,7 +84,6 @@ BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
|
||||
|
||||
/* Hibernate wake configuration */
|
||||
const enum gpio_signal hibernate_wake_pins[] = {
|
||||
GPIO_AC_PRESENT,
|
||||
GPIO_POWER_BUTTON_L,
|
||||
};
|
||||
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
|
||||
@@ -244,72 +106,33 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
|
||||
|
||||
/* I2C port map */
|
||||
const struct i2c_port_t i2c_ports[] = {
|
||||
{"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
|
||||
{"als", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
|
||||
{"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
|
||||
{"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
|
||||
{"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
|
||||
{"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
|
||||
{"eeprom", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
|
||||
{"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
|
||||
{"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
|
||||
{"thermal", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
|
||||
};
|
||||
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
|
||||
|
||||
/* TCPC mux configuration */
|
||||
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
|
||||
{NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
|
||||
{NPCX_I2C_PORT0_0, 0x16, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW},
|
||||
{NPCX_I2C_PORT0_0, I2C_ADDR_TCPC0, &tcpci_tcpm_drv,
|
||||
TCPC_ALERT_ACTIVE_LOW},
|
||||
};
|
||||
|
||||
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
|
||||
{
|
||||
.port_addr = 0, /* don't care / unused */
|
||||
.driver = &anx74xx_tcpm_usb_mux_driver,
|
||||
.hpd_update = &anx74xx_tcpc_update_hpd_status,
|
||||
},
|
||||
{
|
||||
.port_addr = 1,
|
||||
.port_addr = 0,
|
||||
.driver = &tcpci_tcpm_usb_mux_driver,
|
||||
.hpd_update = &ps8751_tcpc_update_hpd_status,
|
||||
}
|
||||
};
|
||||
|
||||
struct mutex pericom_mux_lock;
|
||||
struct pi3usb9281_config pi3usb9281_chips[] = {
|
||||
{
|
||||
.i2c_port = I2C_PORT_USB_CHARGER_0,
|
||||
.mux_lock = &pericom_mux_lock,
|
||||
},
|
||||
{
|
||||
.i2c_port = I2C_PORT_USB_CHARGER_1,
|
||||
.mux_lock = &pericom_mux_lock,
|
||||
},
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
|
||||
CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT);
|
||||
|
||||
/* called from anx74xx_set_power_mode() */
|
||||
void board_set_tcpc_power_mode(int port, int mode)
|
||||
{
|
||||
if (port == 0) {
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_L, mode);
|
||||
msleep(mode ? 10 : 1);
|
||||
gpio_set_level(GPIO_USB_C0_TCPC_PWR, mode);
|
||||
}
|
||||
}
|
||||
|
||||
void board_reset_pd_mcu(void)
|
||||
{
|
||||
/* Assert reset */
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
|
||||
gpio_set_level(GPIO_USB_C1_PD_RST_L, 0);
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_ODL, 0);
|
||||
msleep(1);
|
||||
gpio_set_level(GPIO_USB_C1_PD_RST_L, 1);
|
||||
/* Disable power */
|
||||
gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0);
|
||||
msleep(10);
|
||||
/* Enable power */
|
||||
gpio_set_level(GPIO_USB_C0_TCPC_PWR, 1);
|
||||
msleep(10);
|
||||
/* Deassert reset */
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
|
||||
gpio_set_level(GPIO_USB_C0_PD_RST_ODL, 1);
|
||||
}
|
||||
|
||||
void board_tcpc_init(void)
|
||||
@@ -318,6 +141,7 @@ void board_tcpc_init(void)
|
||||
|
||||
/* Only reset TCPC if not sysjump */
|
||||
if (!system_jumped_to_this_image()) {
|
||||
/* Power on PS8751 */
|
||||
gpio_set_level(GPIO_PP3300_USB_PD, 1);
|
||||
/* TODO(crosbug.com/p/61098): How long do we need to wait? */
|
||||
msleep(10);
|
||||
@@ -325,24 +149,14 @@ void board_tcpc_init(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Remove when Poppy is updated with PS8751 A3.
|
||||
*
|
||||
* Force PS8751 A2 to wake from low power mode.
|
||||
* If PS8751 remains in low power mode after sysjump,
|
||||
* Wake up PS8751. If PS8751 remains in low power mode after sysjump,
|
||||
* TCPM_INIT will fail due to not able to access PS8751.
|
||||
*
|
||||
* NOTE: PS8751 A3 will wake on any I2C access.
|
||||
* Note PS8751 A3 will wake on any I2C access.
|
||||
*/
|
||||
i2c_read8(NPCX_I2C_PORT0_1, 0x10, 0xA0, ®);
|
||||
i2c_read8(I2C_PORT_TCPC0, I2C_ADDR_TCPC0, 0xA0, ®);
|
||||
|
||||
/* Enable TCPC interrupts */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
|
||||
gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL);
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
/* Enable CABLE_DET interrupt for ANX3429 wake from standby */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize HPD to low; after sysjump SOC needs to see
|
||||
@@ -350,7 +164,6 @@ void board_tcpc_init(void)
|
||||
*/
|
||||
for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) {
|
||||
const struct usb_mux *mux = &usb_muxes[port];
|
||||
|
||||
mux->hpd_update(port, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -361,124 +174,197 @@ uint16_t tcpc_get_alert_status(void)
|
||||
uint16_t status = 0;
|
||||
|
||||
if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) {
|
||||
if (gpio_get_level(GPIO_USB_C0_PD_RST_L))
|
||||
if (gpio_get_level(GPIO_USB_C0_PD_RST_ODL))
|
||||
status |= PD_STATUS_TCPC_ALERT_0;
|
||||
}
|
||||
|
||||
if (!gpio_get_level(GPIO_USB_C1_PD_INT_ODL)) {
|
||||
if (gpio_get_level(GPIO_USB_C1_PD_RST_L))
|
||||
status |= PD_STATUS_TCPC_ALERT_1;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temperature sensors data; must be in same order as enum temp_sensor_id.
|
||||
* Sensor index and name must match those present in coreboot:
|
||||
* src/mainboard/google/${board}/acpi/dptf.asl
|
||||
*/
|
||||
const struct temp_sensor_t temp_sensors[] = {
|
||||
{"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0, 4},
|
||||
|
||||
/* These BD99992GW temp sensors are only readable in S0 */
|
||||
{"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
|
||||
BD99992GW_ADC_CHANNEL_SYSTHERM0, 4},
|
||||
{"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
|
||||
BD99992GW_ADC_CHANNEL_SYSTHERM1, 4},
|
||||
{"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
|
||||
BD99992GW_ADC_CHANNEL_SYSTHERM2, 4},
|
||||
{"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
|
||||
BD99992GW_ADC_CHANNEL_SYSTHERM3, 4},
|
||||
{"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp,
|
||||
0, 4},
|
||||
{"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
|
||||
TMP432_IDX_LOCAL, 4},
|
||||
{"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
|
||||
TMP432_IDX_REMOTE1, 4},
|
||||
{"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
|
||||
TMP432_IDX_REMOTE2, 4},
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
|
||||
|
||||
/* ALS instances. Must be in same order as enum als_id. */
|
||||
struct als_t als[] = {
|
||||
/* TODO(crosbug.com/p/61098): verify attenuation_factor */
|
||||
{"TI", opt3001_init, opt3001_read_lux, 5},
|
||||
/*
|
||||
* Thermal limits for each temp sensor. All temps are in degrees K. Must be in
|
||||
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
|
||||
*/
|
||||
struct ec_thermal_config thermal_params[] = {
|
||||
/* {Twarn, Thigh, Thalt}, fan_off, fan_max */
|
||||
{{0, 0, 0}, C_TO_K(35), C_TO_K(68)}, /* TMP432_Internal */
|
||||
{{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
|
||||
{{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
|
||||
{{0, 0, 0}, 0, 0}, /* Battery */
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
|
||||
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
|
||||
|
||||
const struct button_config buttons[CONFIG_BUTTON_COUNT] = {
|
||||
[BUTTON_VOLUME_DOWN] = {"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN,
|
||||
GPIO_VOLUME_DOWN_L, 30 * MSEC, 0},
|
||||
[BUTTON_VOLUME_UP] = {"Volume Up", KEYBOARD_BUTTON_VOLUME_UP,
|
||||
GPIO_VOLUME_UP_L, 30 * MSEC, 0},
|
||||
};
|
||||
/* Initialize PMIC */
|
||||
#define I2C_PMIC_READ(reg, data) \
|
||||
i2c_read8(I2C_PORT_PMIC, TPS650830_I2C_ADDR1, (reg), (data))
|
||||
|
||||
#define I2C_PMIC_WRITE(reg, data) \
|
||||
i2c_write8(I2C_PORT_PMIC, TPS650830_I2C_ADDR1, (reg), (data))
|
||||
|
||||
static void board_pmic_init(void)
|
||||
{
|
||||
int err;
|
||||
int error_count = 0;
|
||||
|
||||
/* No need to re-init PMIC since settings are sticky across sysjump */
|
||||
if (system_jumped_to_this_image())
|
||||
return;
|
||||
|
||||
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
|
||||
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3e, 0x04);
|
||||
|
||||
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
|
||||
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x30, 0x4a);
|
||||
/* Read vendor ID */
|
||||
while (1) {
|
||||
int data;
|
||||
err = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data);
|
||||
if (!err && data == TPS650830_VENDOR_ID)
|
||||
break;
|
||||
else if (error_count > 5)
|
||||
goto pmic_error;
|
||||
error_count++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set V100ACNT / V1.00A Control Register:
|
||||
* Nominal output = 1.0V.
|
||||
* VCCIOCNT register setting
|
||||
* [6] : CSDECAYEN
|
||||
* otherbits: default
|
||||
*/
|
||||
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x37, 0x1a);
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_VCCIOCNT, 0x4A);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Set V085ACNT / V0.85A Control Register:
|
||||
* Lower power mode = 0.7V.
|
||||
* Nominal output = 1.0V.
|
||||
* VRMODECTRL:
|
||||
* [4] : VCCIOLPM clear
|
||||
* otherbits: default
|
||||
*/
|
||||
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a);
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_VRMODECTRL, 0x2F);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/* VRMODECTRL - disable low-power mode for all rails */
|
||||
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x3b, 0x1f);
|
||||
/*
|
||||
* PGMASK1 : Exclude VCCIO from Power Good Tree
|
||||
* [7] : MVCCIOPG clear
|
||||
* otherbits: default
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_PGMASK1, 0x80);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* PWFAULT_MASK1 Register settings
|
||||
* [7] : 1b V4 Power Fault Masked
|
||||
* [4] : 1b V7 Power Fault Masked
|
||||
* [2] : 1b V9 Power Fault Masked
|
||||
* [0] : 1b V13 Power Fault Masked
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_PWFAULT_MASK1, 0x95);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Discharge control 4 register configuration
|
||||
* [7:6] : 00b Reserved
|
||||
* [5:4] : 01b V3.3S discharge resistance (V6S), 100 Ohm
|
||||
* [3:2] : 01b V18S discharge resistance (V8S), 100 Ohm
|
||||
* [1:0] : 01b V100S discharge resistance (V11S), 100 Ohm
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT4, 0x15);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Discharge control 3 register configuration
|
||||
* [7:6] : 01b V1.8U_2.5U discharge resistance (V9), 100 Ohm
|
||||
* [5:4] : 01b V1.2U discharge resistance (V10), 100 Ohm
|
||||
* [3:2] : 01b V100A discharge resistance (V11), 100 Ohm
|
||||
* [1:0] : 01b V085A discharge resistance (V12), 100 Ohm
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT3, 0x55);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Discharge control 2 register configuration
|
||||
* [7:6] : 01b V5ADS3 discharge resistance (V5), 100 Ohm
|
||||
* [5:4] : 01b V33A_DSW discharge resistance (V6), 100 Ohm
|
||||
* [3:2] : 01b V33PCH discharge resistance (V7), 100 Ohm
|
||||
* [1:0] : 01b V18A discharge resistance (V8), 100 Ohm
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT2, 0x55);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Discharge control 1 register configuration
|
||||
* [7:2] : 00b Reserved
|
||||
* [1:0] : 01b VCCIO discharge resistance (V4), 100 Ohm
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT1, 0x01);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* Increase Voltage
|
||||
* [7:0] : 0x2a default
|
||||
* [5:4] : 10b default
|
||||
* [5:4] : 01b 5.1V (0x1a)
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_V5ADS3CNT, 0x1a);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
/*
|
||||
* PBCONFIG Register configuration
|
||||
* [7] : 1b Power button debounce, 0ms (no debounce)
|
||||
* [6] : 0b Power button reset timer logic, no action (default)
|
||||
* [5:0] : 011111b Force an Emergency reset time, 31s (default)
|
||||
*/
|
||||
err = I2C_PMIC_WRITE(TPS650830_REG_PBCONFIG, 0x9F);
|
||||
if (err)
|
||||
goto pmic_error;
|
||||
|
||||
CPRINTS("PMIC init done");
|
||||
return;
|
||||
|
||||
pmic_error:
|
||||
CPRINTS("PMIC init failed");
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
|
||||
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_INIT_I2C + 1);
|
||||
|
||||
/**
|
||||
* Notify the AC presence GPIO to the PCH.
|
||||
*/
|
||||
static void board_extpower(void)
|
||||
{
|
||||
gpio_set_level(GPIO_PCH_ACPRESENT, extpower_is_present());
|
||||
}
|
||||
DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/* Initialize board. */
|
||||
static void board_init(void)
|
||||
{
|
||||
/* Provide AC status to the PCH */
|
||||
gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
|
||||
board_extpower();
|
||||
|
||||
/* Enable sensors power supply */
|
||||
gpio_set_level(GPIO_PP1800_DX_SENSOR, 1);
|
||||
gpio_set_level(GPIO_PP3300_DX_SENSOR, 1);
|
||||
|
||||
/* Enable VBUS interrupt */
|
||||
if (system_get_board_version() == 0) {
|
||||
/*
|
||||
* crosbug.com/p/61929: rev0 does not have VBUS detection,
|
||||
* force detection on both ports.
|
||||
*/
|
||||
gpio_set_flags(GPIO_USB_C0_VBUS_WAKE_L,
|
||||
GPIO_INPUT | GPIO_PULL_DOWN);
|
||||
gpio_set_flags(GPIO_USB_C1_VBUS_WAKE_L,
|
||||
GPIO_INPUT | GPIO_PULL_DOWN);
|
||||
|
||||
vbus0_evt(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
vbus1_evt(GPIO_USB_C1_VBUS_WAKE_L);
|
||||
} else {
|
||||
gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
gpio_enable_interrupt(GPIO_USB_C1_VBUS_WAKE_L);
|
||||
}
|
||||
|
||||
/* Enable pericom BC1.2 interrupts */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L);
|
||||
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L);
|
||||
|
||||
/* Enable base detection interrupt */
|
||||
base_detect_debounce_time = get_time().val;
|
||||
hook_call_deferred(&base_detect_deferred_data, 0);
|
||||
gpio_enable_interrupt(GPIO_BASE_DET_A);
|
||||
gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/**
|
||||
* Buffer the AC present GPIO to the PCH.
|
||||
*/
|
||||
static void board_extpower(void)
|
||||
{
|
||||
gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
|
||||
}
|
||||
DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/**
|
||||
* Set active charge port -- only one port can be active at a time.
|
||||
*
|
||||
@@ -493,8 +379,7 @@ int board_set_active_charge_port(int charge_port)
|
||||
int is_real_port = (charge_port >= 0 &&
|
||||
charge_port < CONFIG_USB_PD_PORT_COUNT);
|
||||
/* check if we are source VBUS on the port */
|
||||
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
|
||||
GPIO_USB_C1_5V_EN);
|
||||
int source = gpio_get_level(GPIO_USB_C0_5V_EN);
|
||||
|
||||
if (is_real_port && source) {
|
||||
CPRINTF("Skip enable p%d", charge_port);
|
||||
@@ -503,18 +388,12 @@ int board_set_active_charge_port(int charge_port)
|
||||
|
||||
CPRINTF("New chg p%d", charge_port);
|
||||
|
||||
if (charge_port == CHARGE_PORT_NONE) {
|
||||
/* Disable both ports */
|
||||
if (charge_port == CHARGE_PORT_NONE)
|
||||
/* Disable port */
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_L, 1);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_L, 1);
|
||||
} else {
|
||||
/* Make sure non-charging port is disabled */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
|
||||
GPIO_USB_C1_CHARGE_L, 1);
|
||||
else
|
||||
/* Enable charging port */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
|
||||
GPIO_USB_C0_CHARGE_L, 0);
|
||||
}
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_L, 0);
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
@@ -577,193 +456,3 @@ int board_is_consuming_full_charge(void)
|
||||
|
||||
return chg_perc > 2 && chg_perc < 95;
|
||||
}
|
||||
|
||||
|
||||
void board_hibernate(void)
|
||||
{
|
||||
CPRINTS("Triggering PMIC shutdown.");
|
||||
uart_flush_output();
|
||||
|
||||
/* Trigger PMIC shutdown. */
|
||||
if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) {
|
||||
/*
|
||||
* If we can't tell the PMIC to shutdown, instead reset
|
||||
* and don't start the AP. Hopefully we'll be able to
|
||||
* communicate with the PMIC next time.
|
||||
*/
|
||||
CPRINTS("PMIC i2c failed.");
|
||||
system_reset(SYSTEM_RESET_LEAVE_AP_OFF);
|
||||
}
|
||||
|
||||
/* Await shutdown. */
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
/* Lid Sensor mutex */
|
||||
static struct mutex g_lid_mutex;
|
||||
|
||||
struct bmi160_drv_data_t g_bmi160_data;
|
||||
struct bmp280_drv_data_t bmp280_drv_data;
|
||||
|
||||
/* Matrix to rotate accelrator into standard reference frame */
|
||||
const matrix_3x3_t mag_standard_ref = {
|
||||
{ FLOAT_TO_FP(-1), 0, 0},
|
||||
{ 0, FLOAT_TO_FP(1), 0},
|
||||
{ 0, 0, FLOAT_TO_FP(-1)}
|
||||
};
|
||||
|
||||
const matrix_3x3_t lid_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[] = {
|
||||
[LID_ACCEL] = {
|
||||
.name = "Lid Accel",
|
||||
.active_mask = SENSOR_ACTIVE_S0,
|
||||
.chip = MOTIONSENSE_CHIP_BMI160,
|
||||
.type = MOTIONSENSE_TYPE_ACCEL,
|
||||
.location = MOTIONSENSE_LOC_LID,
|
||||
.drv = &bmi160_drv,
|
||||
.mutex = &g_lid_mutex,
|
||||
.drv_data = &g_bmi160_data,
|
||||
.port = I2C_PORT_GYRO,
|
||||
.addr = BMI160_ADDR0,
|
||||
.rot_standard_ref = &lid_standard_ref,
|
||||
.default_range = 2, /* g, enough for laptop. */
|
||||
.config = {
|
||||
/* AP: by default use EC settings */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* EC use accel for angle detection */
|
||||
[SENSOR_CONFIG_EC_S0] = {
|
||||
.odr = 10000 | ROUND_UP_FLAG,
|
||||
.ec_rate = 100 * MSEC,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S3] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S5] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
[LID_GYRO] = {
|
||||
.name = "Lid Gyro",
|
||||
.active_mask = SENSOR_ACTIVE_S0,
|
||||
.chip = MOTIONSENSE_CHIP_BMI160,
|
||||
.type = MOTIONSENSE_TYPE_GYRO,
|
||||
.location = MOTIONSENSE_LOC_LID,
|
||||
.drv = &bmi160_drv,
|
||||
.mutex = &g_lid_mutex,
|
||||
.drv_data = &g_bmi160_data,
|
||||
.port = I2C_PORT_GYRO,
|
||||
.addr = BMI160_ADDR0,
|
||||
.default_range = 1000, /* dps */
|
||||
.rot_standard_ref = &lid_standard_ref,
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* EC does not need in S0 */
|
||||
[SENSOR_CONFIG_EC_S0] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S3] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S5] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
[LID_MAG] = {
|
||||
.name = "Lid Mag",
|
||||
.active_mask = SENSOR_ACTIVE_S0,
|
||||
.chip = MOTIONSENSE_CHIP_BMI160,
|
||||
.type = MOTIONSENSE_TYPE_MAG,
|
||||
.location = MOTIONSENSE_LOC_LID,
|
||||
.drv = &bmi160_drv,
|
||||
.mutex = &g_lid_mutex,
|
||||
.drv_data = &g_bmi160_data,
|
||||
.port = I2C_PORT_GYRO,
|
||||
.addr = BMI160_ADDR0,
|
||||
.default_range = 1 << 11, /* 16LSB / uT, fixed */
|
||||
.rot_standard_ref = &mag_standard_ref,
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* EC does not need in S0 */
|
||||
[SENSOR_CONFIG_EC_S0] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S3] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S5] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
[LID_BARO] = {
|
||||
.name = "Base Baro",
|
||||
.active_mask = SENSOR_ACTIVE_S0,
|
||||
.chip = MOTIONSENSE_CHIP_BMP280,
|
||||
.type = MOTIONSENSE_TYPE_BARO,
|
||||
.location = MOTIONSENSE_LOC_LID,
|
||||
.drv = &bmp280_drv,
|
||||
.drv_data = &bmp280_drv_data,
|
||||
.port = I2C_PORT_BARO,
|
||||
.addr = BMP280_I2C_ADDRESS1,
|
||||
.default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* EC does not need in S0 */
|
||||
[SENSOR_CONFIG_EC_S0] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S3] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
/* Sensor off in S3/S5 */
|
||||
[SENSOR_CONFIG_EC_S5] = {
|
||||
.odr = 0,
|
||||
.ec_rate = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
/* EC */
|
||||
#define CONFIG_ADC
|
||||
#define CONFIG_BOARD_VERSION
|
||||
#define CONFIG_BUTTON_COUNT 2
|
||||
#define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
|
||||
#define CONFIG_DPTF
|
||||
#define CONFIG_FLASH_SIZE 0x80000
|
||||
#define CONFIG_FPU
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_MASTER
|
||||
#define CONFIG_LID_SWITCH
|
||||
#undef CONFIG_LID_SWITCH
|
||||
#define CONFIG_POWER_BUTTON_IGNORE_LID
|
||||
#define CONFIG_LTO
|
||||
#define CONFIG_SPI_FLASH_REGS
|
||||
#define CONFIG_SPI_FLASH_W25X40
|
||||
@@ -41,8 +41,6 @@
|
||||
#define WIRELESS_GPIO_WWAN GPIO_PP3300_DX_LTE
|
||||
|
||||
/* EC console commands */
|
||||
#define CONFIG_CMD_ACCELS
|
||||
#define CONFIG_CMD_ACCEL_INFO
|
||||
#define CONFIG_CMD_BUTTON
|
||||
|
||||
/* SOC */
|
||||
@@ -50,6 +48,8 @@
|
||||
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
|
||||
#define CONFIG_CHIPSET_RESET_HOOK
|
||||
#define CONFIG_ESPI
|
||||
/* Eve and Poppy all have wires from GPIO to PCH but CONFIG_ESPI_VW_SIGNALS
|
||||
* is defined. So, those GPIOs are not used by EC. */
|
||||
#define CONFIG_ESPI_VW_SIGNALS
|
||||
#define CONFIG_LPC
|
||||
|
||||
@@ -87,37 +87,13 @@
|
||||
#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
|
||||
|
||||
/* Sensor */
|
||||
#define CONFIG_ALS
|
||||
#define CONFIG_ALS_OPT3001
|
||||
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
|
||||
#define CONFIG_TEMP_SENSOR
|
||||
#define CONFIG_TEMP_SENSOR_BD99992GW
|
||||
#define CONFIG_TEMP_SENSOR_TMP432
|
||||
/* TODO(crosbug.com/p/61098): Is this the correct thermistor? */
|
||||
#define CONFIG_THERMISTOR_NCP15WB
|
||||
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
#define CONFIG_MKBP_EVENT
|
||||
#define CONFIG_MKBP_USE_HOST_EVENT
|
||||
#define CONFIG_ACCELGYRO_BMI160
|
||||
#define CONFIG_MAG_BMI160_BMM150
|
||||
#define CONFIG_ACCEL_INTERRUPTS
|
||||
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4)
|
||||
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
|
||||
#define CONFIG_MAG_CALIBRATE
|
||||
|
||||
#define CONFIG_BARO_BMP280
|
||||
|
||||
/* FIFO size is in power of 2. */
|
||||
#define CONFIG_ACCEL_FIFO 1024
|
||||
|
||||
/* Depends on how fast the AP boots and typical ODRs */
|
||||
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
|
||||
|
||||
#define CONFIG_TABLET_MODE
|
||||
#define CONFIG_TABLET_MODE_SWITCH
|
||||
|
||||
/* USB */
|
||||
#define CONFIG_USB_CHARGER
|
||||
#undef CONFIG_USB_CHARGER /* dnojiri: verify */
|
||||
#define CONFIG_USB_PD_ALT_MODE
|
||||
#define CONFIG_USB_PD_ALT_MODE_DFP
|
||||
#define CONFIG_USB_PD_CUSTOM_VDM
|
||||
@@ -127,13 +103,11 @@
|
||||
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
#define CONFIG_USB_PD_LOGGING
|
||||
#define CONFIG_USB_PD_LOG_SIZE 512
|
||||
#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#define CONFIG_USB_PD_PORT_COUNT 1
|
||||
#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS
|
||||
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
|
||||
#define CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
#define CONFIG_USB_PD_TCPM_MUX
|
||||
#define CONFIG_USB_PD_TCPM_ANX74XX
|
||||
#define CONFIG_USB_PD_TCPM_TCPCI
|
||||
#define CONFIG_USB_PD_TCPM_PS8751
|
||||
#define CONFIG_USB_PD_TRY_SRC
|
||||
@@ -143,10 +117,6 @@
|
||||
#define CONFIG_USBC_VCONN
|
||||
#define CONFIG_USBC_VCONN_SWAP
|
||||
|
||||
/* BC 1.2 charger */
|
||||
#define CONFIG_USB_SWITCH_PI3USB9281
|
||||
#define CONFIG_USB_SWITCH_PI3USB9281_CHIP_COUNT 2
|
||||
|
||||
/* Optional feature to configure npcx chip */
|
||||
#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
|
||||
#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
|
||||
@@ -154,22 +124,14 @@
|
||||
|
||||
/* I2C ports */
|
||||
#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
|
||||
#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_0
|
||||
#define I2C_PORT_ALS NPCX_I2C_PORT0_1
|
||||
#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
|
||||
#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
|
||||
#define I2C_PORT_CHARGER NPCX_I2C_PORT1
|
||||
#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
|
||||
#define I2C_PORT_BATTERY NPCX_I2C_PORT1
|
||||
#define I2C_PORT_CHARGER NPCX_I2C_PORT1
|
||||
#define I2C_PORT_PMIC NPCX_I2C_PORT2
|
||||
#define I2C_PORT_MP2949 NPCX_I2C_PORT2
|
||||
#define I2C_PORT_GYRO NPCX_I2C_PORT3
|
||||
#define I2C_PORT_BARO NPCX_I2C_PORT3
|
||||
#define I2C_PORT_ACCEL I2C_PORT_GYRO
|
||||
#define I2C_PORT_THERMAL I2C_PORT_PMIC
|
||||
#define I2C_PORT_THERMAL NPCX_I2C_PORT3
|
||||
|
||||
/* I2C addresses */
|
||||
#define I2C_ADDR_BD99992 0x60
|
||||
#define I2C_ADDR_MP2949 0x40
|
||||
#define I2C_ADDR_TCPC0 0x16
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
@@ -188,34 +150,12 @@ enum power_signal {
|
||||
|
||||
enum temp_sensor_id {
|
||||
TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
|
||||
TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
|
||||
TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
|
||||
TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
|
||||
TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
|
||||
TEMP_SENSOR_COUNT
|
||||
};
|
||||
|
||||
enum als_id {
|
||||
ALS_OPT3001,
|
||||
ALS_COUNT
|
||||
};
|
||||
|
||||
/*
|
||||
* Motion sensors:
|
||||
* When reading through IO memory is set up for sensors (LPC is used),
|
||||
* the first 2 entries must be accelerometers, then gyroscope.
|
||||
* For BMI160, accel, gyro and compass sensors must be next to each other.
|
||||
*
|
||||
* TODO(crosbug.com/p/61098): Understand how the statement above applies
|
||||
* since we only have one accelerometer.
|
||||
*/
|
||||
enum sensor_id {
|
||||
LID_ACCEL = 0,
|
||||
LID_GYRO,
|
||||
LID_MAG,
|
||||
LID_BARO,
|
||||
};
|
||||
|
||||
enum adc_channel {
|
||||
ADC_BASE_DET,
|
||||
ADC_VBUS,
|
||||
@@ -223,12 +163,6 @@ enum adc_channel {
|
||||
ADC_CH_COUNT
|
||||
};
|
||||
|
||||
enum button {
|
||||
BUTTON_VOLUME_DOWN = 0,
|
||||
BUTTON_VOLUME_UP = 1,
|
||||
BUTTON_COUNT
|
||||
};
|
||||
|
||||
/* TODO(crosbug.com/p/61098): Verify the numbers below. */
|
||||
/*
|
||||
* delay to turn on the power supply max is ~16ms.
|
||||
@@ -251,9 +185,6 @@ int board_get_version(void);
|
||||
void board_reset_pd_mcu(void);
|
||||
void board_set_tcpc_power_mode(int port, int mode);
|
||||
|
||||
/* Sensors without hardware FIFO are in forced mode */
|
||||
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_BARO)
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __CROS_EC_BOARD_H */
|
||||
|
||||
@@ -22,15 +22,10 @@
|
||||
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, NULL, 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, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(PDCMD, pd_command_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(POWERBTN, power_button_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_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE)
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
/* Declare symbolic names for all the GPIOs that we care about.
|
||||
* Note: Those with interrupt handlers must be declared first. */
|
||||
|
||||
GPIO_INT(USB_C0_PD_INT_ODL, PIN(3, 7), GPIO_INT_FALLING, tcpc_alert_event)
|
||||
GPIO_INT(USB_C1_PD_INT_ODL, PIN(C, 5), GPIO_INT_FALLING, tcpc_alert_event)
|
||||
GPIO_INT(USB_C0_PD_INT_ODL, PIN(3, 7), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event)
|
||||
GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
|
||||
GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* MECH_PWR_BTN_ODL */
|
||||
|
||||
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
|
||||
/* Use VW signals instead of GPIOs */
|
||||
#ifndef CONFIG_ESPI_VW_SIGNALS
|
||||
@@ -19,46 +21,33 @@ GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
|
||||
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
|
||||
GPIO_INT(RSMRST_L_PGOOD, PIN(B, 0), GPIO_INT_BOTH, power_signal_interrupt)
|
||||
GPIO_INT(PMIC_DPWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
|
||||
GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
|
||||
GPIO_INT(LID_OPEN, PIN(6, 7), GPIO_INT_BOTH, lid_interrupt)
|
||||
GPIO_INT(VOLUME_DOWN_L, PIN(8, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
|
||||
GPIO_INT(VOLUME_UP_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
|
||||
GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH, switch_interrupt)
|
||||
GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
|
||||
GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(2, 2), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt)
|
||||
GPIO_INT(USB_C1_VBUS_WAKE_L, PIN(2, 3), GPIO_INT_BOTH | GPIO_PULL_UP, vbus1_evt)
|
||||
GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb0_evt)
|
||||
GPIO_INT(USB_C1_BC12_INT_L, PIN(3, 3), GPIO_INT_FALLING, usb1_evt)
|
||||
GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 0), GPIO_INT_FALLING, bmi160_interrupt)
|
||||
GPIO_INT(BASE_DET_A, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt)
|
||||
GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
|
||||
|
||||
GPIO_INT(WP_L, PIN(9, 3), GPIO_INT_BOTH, switch_interrupt)
|
||||
GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt)
|
||||
GPIO(PCH_RTCRST, PIN(E, 7), GPIO_OUT_LOW) /* RTCRST# to SOC */
|
||||
GPIO(ENABLE_BACKLIGHT, PIN(2, 6), GPIO_OUT_LOW) /* Enable Backlight */
|
||||
GPIO(WLAN_OFF_L, PIN(7, 2), GPIO_OUT_LOW) /* Disable WLAN */
|
||||
GPIO(PP3300_DX_WLAN, PIN(A, 7), GPIO_OUT_LOW) /* Enable WLAN 3.3V Power */
|
||||
GPIO(CPU_PROCHOT, PIN(8, 1), GPIO_OUT_HIGH) /* PROCHOT# to SOC */
|
||||
GPIO(PCH_ACOK, PIN(5, 0), GPIO_ODR_LOW) /* ACOK to SOC */
|
||||
GPIO(PCH_ACPRESENT, PIN(5, 0), GPIO_ODR_LOW) /* ACOK to SOC */
|
||||
GPIO(PCH_WAKE_L, PIN(A, 3), GPIO_ODR_HIGH) /* Wake SOC */
|
||||
GPIO(PCH_RSMRST_L, PIN(7, 0), GPIO_OUT_LOW) /* RSMRST# to SOC */
|
||||
GPIO(PCH_PWRBTN_L, PIN(4, 1), GPIO_ODR_HIGH) /* Power Button to SOC */
|
||||
GPIO(PCH_PWRBTN_L, PIN(7, 4), GPIO_ODR_HIGH) /* Power Button to SOC */
|
||||
GPIO(EC_PLATFORM_RST, PIN(A, 6), GPIO_OUT_LOW) /* EC Reset to LDO_EN */
|
||||
GPIO(SYS_RESET_L, PIN(6, 1), GPIO_ODR_HIGH) /* Cold Reset to SOC */
|
||||
GPIO(PMIC_SLP_SUS_L, PIN(8, 5), GPIO_OUT_LOW) /* SLP_SUS# to PMIC */
|
||||
GPIO(BATTERY_PRESENT_L, PIN(3, 4), GPIO_INPUT) /* Battery Present */
|
||||
GPIO(BATTERY_PRESENT_L, PIN(3, 4), GPIO_INPUT | GPIO_PULL_UP) /* Battery Present */
|
||||
GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT) /* Case Closed Debug Mode */
|
||||
GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_ODR_HIGH) /* H1 Reset */
|
||||
GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC Entering RW */
|
||||
GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT) /* PMIC interrupt */
|
||||
|
||||
/* Sensor interrupts, not implemented yet */
|
||||
GPIO(ALS_INT_L, PIN(2, 5), GPIO_INPUT)
|
||||
GPIO(FP_INT_L, PIN(5, 6), GPIO_INPUT)
|
||||
/* Fizz specific pins */
|
||||
GPIO(LAN_PWR_EN, PIN(8, 3), GPIO_INPUT) /* Ethernet power enabled */
|
||||
GPIO(EC_RECOVERY_L, PIN(8, 2), GPIO_INPUT) /* Recovery button */
|
||||
GPIO(PWR_RED_LED, PIN(8, 0), GPIO_OUT_HIGH) /* Power Red LED */
|
||||
GPIO(PWR_GRN_LED, PIN(B, 7), GPIO_OUT_HIGH) /* Power Green LED */
|
||||
|
||||
/* TODO(crosbug.com/p/61098): Make use of these GPIOs */
|
||||
GPIO(PP1800_DX_SENSOR, PIN(1, 4), GPIO_OUTPUT)
|
||||
GPIO(PP3300_DX_SENSOR, PIN(2, 1), GPIO_OUTPUT)
|
||||
GPIO(PP3300_USB_PD, PIN(2, 0), GPIO_OUTPUT)
|
||||
GPIO(PP3300_USB_PD, PIN(6, 7), GPIO_OUTPUT)
|
||||
|
||||
GPIO(PP5000_DX_NFC, PIN(1, 5), GPIO_OUTPUT)
|
||||
|
||||
@@ -67,41 +56,32 @@ GPIO(CAM_PMIC_RST_L, PIN(0, 7), GPIO_INPUT)
|
||||
|
||||
GPIO(WLAN_PE_RST, PIN(1, 2), GPIO_OUTPUT)
|
||||
GPIO(PP3300_DX_LTE, PIN(0, 5), GPIO_OUT_LOW)
|
||||
GPIO(LTE_GPS_OFF_L, PIN(0, 0), GPIO_OUTPUT)
|
||||
GPIO(LTE_BODY_SAR_L, PIN(0, 1), GPIO_OUTPUT)
|
||||
GPIO(LTE_WAKE_L, PIN(7, 1), GPIO_INPUT)
|
||||
|
||||
GPIO(PP3300_DX_BASE, PIN(1, 1), GPIO_OUT_LOW)
|
||||
|
||||
/* I2C pins - these will be reconfigured for alternate function below */
|
||||
GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SCL */
|
||||
GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SDA */
|
||||
GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C0_1_3V3_SCL */
|
||||
GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C0_1_3V3_SDA */
|
||||
GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C1_3V3_SCL */
|
||||
GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C1_3V3_SDA */
|
||||
GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SCL */
|
||||
GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SDA */
|
||||
GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_I2C3_SENSOR_1V8_SCL */
|
||||
GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C3_SENSOR_1V8_SDA */
|
||||
GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_USB_C0_PD_SCL */
|
||||
GPIO(I2C0_0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_USB_C0_PD_SDA */
|
||||
GPIO(I2C0_1_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C_EEPROM_SCL */
|
||||
GPIO(I2C0_1_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C_EEPROM_SDA */
|
||||
GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C_BAT_SCL */
|
||||
GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C_BAT_SDA */
|
||||
GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_ROP_I2C_CLK */
|
||||
GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_ROP_I2C_SDA */
|
||||
GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_THEM_CLK */
|
||||
GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_THEM_SDA */
|
||||
|
||||
/* 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */
|
||||
GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW) /* C0 5V Enable */
|
||||
GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW | GPIO_PULL_UP) /* C0 5V Enable */
|
||||
GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */
|
||||
GPIO(USB_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW) /* C1 5V Enable */
|
||||
GPIO(USB_C1_CHARGE_L, PIN(C, 3), GPIO_OUT_LOW) /* C1 Charge enable */
|
||||
GPIO(USB_C0_PD_RST_L, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
|
||||
GPIO(USB_C1_PD_RST_L, PIN(7, 4), GPIO_OUT_LOW) /* C1 PD Reset */
|
||||
GPIO(USB_C0_PD_RST_ODL, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
|
||||
GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */
|
||||
GPIO(USB_C1_DP_HPD, PIN(A, 5), GPIO_INPUT) /* C1 DP Hotplug Detect */
|
||||
GPIO(USB_C0_TCPC_PWR, PIN(8, 4), GPIO_OUT_LOW) /* Enable C0 TCPC Power */
|
||||
GPIO(USB2_OTG_ID, PIN(A, 1), GPIO_ODR_LOW) /* OTG ID */
|
||||
GPIO(USB2_OTG_VBUSSENSE, PIN(9, 5), GPIO_OUT_LOW) /* OTG VBUS Sense */
|
||||
GPIO(FAN_PWR_EN, PIN(9, 5), GPIO_OUT_HIGH) /* Fan power */
|
||||
|
||||
/* Board ID */
|
||||
GPIO(BOARD_VERSION1, PIN(C, 4), GPIO_INPUT) /* Board ID bit0 */
|
||||
GPIO(BOARD_VERSION2, PIN(C, 2), GPIO_INPUT) /* Board ID bit1 */
|
||||
GPIO(BOARD_VERSION3, PIN(1, 3), GPIO_INPUT) /* Board ID bit2 */
|
||||
GPIO(BOARD_VERSION1, PIN(C, 4), GPIO_INPUT) /* Board ID bit0 */
|
||||
GPIO(BOARD_VERSION2, PIN(C, 2), GPIO_INPUT) /* Board ID bit1 */
|
||||
GPIO(BOARD_VERSION3, PIN(0, 1), GPIO_INPUT) /* Board ID bit2 */
|
||||
|
||||
/* Test points */
|
||||
GPIO(TP248, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP) /* EC_GPIO57 */
|
||||
|
||||
@@ -55,47 +55,19 @@ void pd_transition_voltage(int idx)
|
||||
/* No-operation: we are always 5V */
|
||||
}
|
||||
|
||||
static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT];
|
||||
static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5};
|
||||
static uint8_t vbus_en;
|
||||
|
||||
int board_vbus_source_enabled(int port)
|
||||
{
|
||||
return vbus_en[port];
|
||||
}
|
||||
|
||||
static void board_vbus_update_source_current(int port)
|
||||
{
|
||||
enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
|
||||
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
|
||||
(GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP);
|
||||
|
||||
/*
|
||||
* Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
|
||||
* (2x 33k in parallel) on the NX5P3290 load switch ILIM pin,
|
||||
* setting a minimum OCP current of 3186 mA.
|
||||
* Putting an internal pull-up on USB_Cx_5V_EN, effectively put a 33k
|
||||
* resistor on ILIM, setting a minimum OCP current of 1505 mA.
|
||||
*/
|
||||
gpio_set_level(gpio, vbus_en[port]);
|
||||
gpio_set_flags(gpio, flags);
|
||||
}
|
||||
|
||||
void typec_set_source_current_limit(int port, int rp)
|
||||
{
|
||||
vbus_rp[port] = rp;
|
||||
|
||||
/* change the GPIO driving the load switch if needed */
|
||||
board_vbus_update_source_current(port);
|
||||
return vbus_en;
|
||||
}
|
||||
|
||||
int pd_set_power_supply_ready(int port)
|
||||
{
|
||||
/* Disable charging */
|
||||
gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
|
||||
GPIO_USB_C0_CHARGE_L, 1);
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_L, 1);
|
||||
/* Provide VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 1);
|
||||
gpio_set_level(GPIO_USB_C0_5V_EN, 1);
|
||||
|
||||
/* notify host of power info change */
|
||||
pd_send_host_event(PD_EVENT_POWER_CHANGE);
|
||||
@@ -106,8 +78,7 @@ int pd_set_power_supply_ready(int port)
|
||||
void pd_power_supply_reset(int port)
|
||||
{
|
||||
/* Disable VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 0);
|
||||
gpio_set_level(GPIO_USB_C0_5V_EN, 0);
|
||||
|
||||
/* notify host of power info change */
|
||||
pd_send_host_event(PD_EVENT_POWER_CHANGE);
|
||||
@@ -115,8 +86,7 @@ void pd_power_supply_reset(int port)
|
||||
|
||||
int pd_snk_is_vbus_provided(int port)
|
||||
{
|
||||
return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L :
|
||||
GPIO_USB_C0_VBUS_WAKE_L);
|
||||
return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
}
|
||||
|
||||
void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
|
||||
Reference in New Issue
Block a user