diff --git a/board/amenia/board.c b/board/amenia/board.c index 56d02895b5..a019ba0a5e 100644 --- a/board/amenia/board.c +++ b/board/amenia/board.c @@ -139,8 +139,10 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {I2C_PORT_TCPC0, TCPC0_I2C_ADDR, &anx74xx_tcpm_drv}, - {I2C_PORT_TCPC1, TCPC1_I2C_ADDR, &tcpci_tcpm_drv}, + {I2C_PORT_TCPC0, TCPC0_I2C_ADDR, &anx74xx_tcpm_drv, + TCPC_ALERT_ACTIVE_HIGH}, + {I2C_PORT_TCPC1, TCPC1_I2C_ADDR, &tcpci_tcpm_drv, + TCPC_ALERT_ACTIVE_LOW}, }; const enum gpio_signal hibernate_wake_pins[] = { diff --git a/board/amenia/board.h b/board/amenia/board.h index 5833543fb1..c1d0e16c43 100644 --- a/board/amenia/board.h +++ b/board/amenia/board.h @@ -88,7 +88,6 @@ #define CONFIG_USB_PD_PORT_COUNT 2 #define CONFIG_USB_PD_TCPM_ANX74XX #define TCPC0_I2C_ADDR 0x50 -#define ANX74XX_INT_ACTIVE_POLARITY ANX74XX_REG_IRQ_POL_HIGH #define CONFIG_USB_PD_TCPM_PS8751 #define CONFIG_USB_PD_TCPM_TCPCI #define TCPC1_I2C_ADDR 0x16 diff --git a/board/reef/board.c b/board/reef/board.c index 87bcc263fa..032fc79cce 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -126,8 +126,8 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv}, - {NPCX_I2C_PORT0_1, 0x16, &tcpci_tcpm_drv}, + {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_HIGH}, + {NPCX_I2C_PORT0_1, 0x16, &tcpci_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, }; uint16_t tcpc_get_alert_status(void) diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index ed38fccb23..bd5032376c 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -762,7 +762,9 @@ int anx74xx_tcpm_init(int port) /* Initialize interrupt polarity */ rv |= tcpc_write(port, ANX74XX_REG_IRQ_STATUS, - ANX74XX_INT_ACTIVE_POLARITY); + tcpc_config[port].pol == TCPC_ALERT_ACTIVE_LOW ? + ANX74XX_REG_IRQ_POL_LOW : + ANX74XX_REG_IRQ_POL_HIGH); /* unmask interrupts */ rv |= tcpc_read(port, ANX74XX_REG_IRQ_EXT_MASK_1, ®); diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h index 972be9648a..e395083d33 100644 --- a/driver/tcpm/anx74xx.h +++ b/driver/tcpm/anx74xx.h @@ -12,7 +12,6 @@ #define ANX74XX_REG_IRQ_POL_LOW 0x00 #define ANX74XX_REG_IRQ_POL_HIGH 0x02 -#define ANX74XX_INT_ACTIVE_POLARITY ANX74XX_REG_IRQ_POL_HIGH #define ANX74XX_REG_IRQ_STATUS 0x53 diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 90dae03fd2..ab7123676b 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -161,10 +161,16 @@ struct tcpm_drv { void (*tcpc_alert)(int port); }; +enum tcpc_alert_polarity { + TCPC_ALERT_ACTIVE_LOW, + TCPC_ALERT_ACTIVE_HIGH, +}; + struct tcpc_config_t { int i2c_host_port; int i2c_slave_addr; const struct tcpm_drv *drv; + enum tcpc_alert_polarity pol; }; /**