From 62dfe288411de85766ac136c2ccc10b2d73a9a89 Mon Sep 17 00:00:00 2001 From: David Huang Date: Tue, 30 Jun 2020 15:40:26 +0800 Subject: volteer: move ppc_chips[] from baseboard to board Move ppc_chips[] to board for board customize. BUG=b:151978872 BRANCH=master TEST=check ppc init succeed and switch source/sink correct with type c device. Change-Id: I287bbe44b163d72c19a3764dca431c84d86bbdec Signed-off-by: David Huang Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2275971 Commit-Queue: Keith Short Reviewed-by: Keith Short --- board/delbin/board.c | 35 +++++++++++++++++++++++++++++++++++ board/delbin/board.h | 4 ++++ 2 files changed, 39 insertions(+) (limited to 'board/delbin') diff --git a/board/delbin/board.c b/board/delbin/board.c index d7e7ad7f56..04dfa635c7 100644 --- a/board/delbin/board.c +++ b/board/delbin/board.c @@ -11,6 +11,8 @@ #include "cbi_ec_fw_config.h" #include "driver/accel_bma2x2.h" #include "driver/accelgyro_bmi260.h" +#include "driver/ppc/sn5s330.h" +#include "driver/ppc/syv682x.h" #include "driver/retimer/bb_retimer.h" #include "extpower.h" #include "fan.h" @@ -29,6 +31,7 @@ #include "throttle_ap.h" #include "uart.h" #include "usb_pd_tbt.h" +#include "usbc_ppc.h" #include "util.h" #include "gpio_list.h" /* Must come after other header files. */ @@ -243,3 +246,35 @@ __override void board_cbi_init(void) /* TODO(b/159336576): Delbin: check FW_CONFIG fields for USB DB type */ } +/******************************************************************************/ +/* USBC PPC configuration */ +struct ppc_config_t ppc_chips[] = { + [USBC_PORT_C0] = { + .i2c_port = I2C_PORT_USB_C0, + .i2c_addr_flags = SN5S330_ADDR0_FLAGS, + .drv = &sn5s330_drv, + }, + [USBC_PORT_C1] = { + .i2c_port = I2C_PORT_USB_C1, + .i2c_addr_flags = SYV682X_ADDR0_FLAGS, + .drv = &syv682x_drv, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT); +unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); + +/******************************************************************************/ +/* PPC support routines */ +void ppc_interrupt(enum gpio_signal signal) +{ + switch (signal) { + case GPIO_USB_C0_PPC_INT_ODL: + sn5s330_interrupt(USBC_PORT_C0); + break; + case GPIO_USB_C1_PPC_INT_ODL: + syv682x_interrupt(USBC_PORT_C1); + default: + break; + } +} + diff --git a/board/delbin/board.h b/board/delbin/board.h index 03c495d8d6..40625e92ea 100644 --- a/board/delbin/board.h +++ b/board/delbin/board.h @@ -70,6 +70,10 @@ #define USB_PORT_COUNT 1 #define CONFIG_USB_PORT_POWER_DUMB +/* USBC PPC*/ +#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */ +#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */ + /* BC 1.2 */ -- cgit v1.2.1