diff options
-rw-r--r-- | board/atlas/board.c | 21 | ||||
-rw-r--r-- | board/coral/board.c | 20 | ||||
-rw-r--r-- | board/elm/board.c | 5 | ||||
-rw-r--r-- | board/eve/board.c | 21 | ||||
-rw-r--r-- | board/fizz/board.c | 8 | ||||
-rw-r--r-- | board/glkrvp/chg_usb_pd.c | 18 | ||||
-rw-r--r-- | board/kukui/board.c | 5 | ||||
-rw-r--r-- | board/nami/board.c | 21 | ||||
-rw-r--r-- | board/nocturne/board.c | 18 | ||||
-rw-r--r-- | board/rainier/board.c | 5 | ||||
-rw-r--r-- | board/rammus/board.c | 21 | ||||
-rw-r--r-- | board/reef/board.c | 20 | ||||
-rw-r--r-- | board/reef_mchp/board.c | 20 | ||||
-rw-r--r-- | board/rowan/board.c | 5 | ||||
-rw-r--r-- | board/scarlet/board.c | 5 | ||||
-rw-r--r-- | board/zoombini/board.c | 23 |
16 files changed, 134 insertions, 102 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c index a3795eb98d..242003e8ea 100644 --- a/board/atlas/board.c +++ b/board/atlas/board.c @@ -51,17 +51,20 @@ 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)) + int port = -1; + + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } #include "gpio_list.h" diff --git a/board/coral/board.c b/board/coral/board.c index 2c56f36b0b..5955474620 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -68,18 +68,20 @@ static int sku_id; 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; + int port = -1; - if ((signal == GPIO_USB_C1_PD_INT_ODL) && - !gpio_get_level(GPIO_USB_C1_PD_RST_ODL)) + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } #ifdef CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/board/elm/board.c b/board/elm/board.c index 4fe7f780a0..f2d567ace7 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -57,10 +57,7 @@ void pd_mcu_interrupt(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with PD MCU to determine interrupt cause */ - host_command_pd_send_status(0); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } void deferred_reset_pd_mcu(void); diff --git a/board/eve/board.c b/board/eve/board.c index 46260c0672..a204851d96 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -62,17 +62,20 @@ 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)) + int port = -1; + + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } /* diff --git a/board/fizz/board.c b/board/fizz/board.c index a2b3aace39..46ff53069d 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -60,13 +60,7 @@ static uint8_t sku; static void tcpc_alert_event(enum gpio_signal signal) { - if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL)) - return; - -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } #define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */ diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c index e9108d641a..152e79142b 100644 --- a/board/glkrvp/chg_usb_pd.c +++ b/board/glkrvp/chg_usb_pd.c @@ -91,10 +91,20 @@ void board_vbus_enable(int port, int enable) void tcpc_alert_event(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + int port = -1; + + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: + return; + } + + schedule_deferred_pd_interrupt(port); } void board_tcpc_init(void) diff --git a/board/kukui/board.c b/board/kukui/board.c index a059b8ade6..1812de5ec3 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -49,10 +49,7 @@ static void tcpc_alert_event(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } #if BOARD_REV >= 1 diff --git a/board/nami/board.c b/board/nami/board.c index 6de438027b..6a2cca9ffb 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -75,17 +75,20 @@ uint32_t sku; 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)) + int port = -1; + + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } /* Set PD discharge whenever VBUS detection is high (i.e. below threshold). */ diff --git a/board/nocturne/board.c b/board/nocturne/board.c index 87b8f6c67f..ffa8c65920 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -50,10 +50,20 @@ static void tcpc_alert_event(enum gpio_signal s) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + int port = -1; + + switch (s) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: + return; + } + + schedule_deferred_pd_interrupt(port); } /* diff --git a/board/rainier/board.c b/board/rainier/board.c index 9e98136127..4be0e9e3f9 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -46,10 +46,7 @@ static void tcpc_alert_event(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } static void overtemp_interrupt(enum gpio_signal signal) diff --git a/board/rammus/board.c b/board/rammus/board.c index e240e52f08..340cca0028 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -61,17 +61,20 @@ static void tcpc_alert_event(enum gpio_signal signal) { - if ((signal == GPIO_USB_C0_PD_INT_ODL) && - gpio_get_level(GPIO_USB_PD_RST_C0)) - return; - else if ((signal == GPIO_USB_C1_PD_INT_ODL) && - !gpio_get_level(GPIO_USB_C1_PD_RST_ODL)) + int port = -1; + + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } /* Set PD discharge whenever VBUS detection is high (i.e. below threshold). */ diff --git a/board/reef/board.c b/board/reef/board.c index a0a9a0ee4c..beeb5d823f 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -66,18 +66,20 @@ 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; + int port = -1; - if ((signal == GPIO_USB_C1_PD_INT_ODL) && - !gpio_get_level(GPIO_USB_C1_PD_RST_ODL)) + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } #ifdef CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index 733c345359..c0fb36d5d8 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -100,18 +100,20 @@ void board_config_pre_init(void) */ 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; + int port = -1; - if ((signal == GPIO_USB_C1_PD_INT_ODL) && - !gpio_get_level(GPIO_USB_C1_PD_RST_ODL)) + switch (signal) { + case GPIO_USB_C0_PD_INT_ODL: + port = 0; + break; + case GPIO_USB_C1_PD_INT_ODL: + port = 1; + break; + default: return; + } -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(port); } #ifdef CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/board/rowan/board.c b/board/rowan/board.c index 64d2f39239..1a8ec50102 100644 --- a/board/rowan/board.c +++ b/board/rowan/board.c @@ -59,10 +59,7 @@ void pd_mcu_interrupt(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with PD MCU to determine interrupt cause */ - host_command_pd_send_status(0); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } void deferred_reset_pd_mcu(void); diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 6a21406697..9d8b1269ff 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -49,10 +49,7 @@ static void tcpc_alert_event(enum gpio_signal signal) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + schedule_deferred_pd_interrupt(0 /* port */); } static void overtemp_interrupt(enum gpio_signal signal) diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 66ea5b4156..e7c51dc2bb 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -51,10 +51,25 @@ static void tcpc_alert_event(enum gpio_signal s) { -#ifdef HAS_TASK_PDCMD - /* Exchange status with TCPCs */ - host_command_pd_send_status(PD_CHARGE_NO_CHANGE); -#endif + int port = -1; + + switch (s) { + case GPIO_USB_C0_PD_INT_L: + port = 0; + break; + case GPIO_USB_C1_PD_INT_L: + port = 1; + break; +#ifdef BOARD_ZOOMBINI + case GPIO_USB_C2_PD_INT_L: + port = 2; + break; +#endif /* defined(BOARD_ZOOMBINI) */ + default: + return; + } + + schedule_deferred_pd_interrupt(port); } #ifdef BOARD_MEOWTH |