summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/servo_v4p1/board.c31
-rw-r--r--board/servo_v4p1/ioexpanders.c42
-rw-r--r--board/servo_v4p1/ioexpanders.h6
3 files changed, 49 insertions, 30 deletions
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index 8ee4e6f158..3572285dfb 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -58,36 +58,7 @@ static void vbus1_evt(enum gpio_signal signal)
static void tca_evt(enum gpio_signal signal)
{
- uint8_t fault;
-
- fault = read_faults();
-
- if (!(fault & USERVO_FAULT_L))
- ccprintf("FAULT: Microservo USB A port load switch\n");
-
- if (!(fault & USB3_A0_FAULT_L))
- ccprintf("FAULT: USB3 A0 port load switch\n");
-
- if (!(fault & USB3_A1_FAULT_L))
- ccprintf("FAULT: USB3 A1 port load switch\n");
-
- if (!(fault & USB_DUTCHG_FLT_ODL))
- ccprintf("FAULT: Overcurrent on Charger or DUB CC/SBU lines\n");
-
- if (!(fault & PP3300_DP_FAULT_L))
- ccprintf("FAULT: Overcurrent on DisplayPort\n");
-
- if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
- ccprintf("FAULT: CC1 drive circuitry has exceeded thermal ");
- ccprintf("limits or exceeded current limits. Power ");
- ccprintf("off DAC0 to clear the fault\n");
- }
-
- if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
- ccprintf("FAULT: CC2 drive circuitry has exceeded thermal ");
- ccprintf("limits or exceeded current limits. Power ");
- ccprintf("off DAC1 to clear the fault\n");
- }
+ irq_ioexpanders();
}
static volatile uint64_t hpd_prev_ts;
diff --git a/board/servo_v4p1/ioexpanders.c b/board/servo_v4p1/ioexpanders.c
index ac0f616b8a..6617a8d30e 100644
--- a/board/servo_v4p1/ioexpanders.c
+++ b/board/servo_v4p1/ioexpanders.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "hooks.h"
#include "i2c.h"
#include "ioexpanders.h"
#include "tca6416a.h"
@@ -126,6 +127,47 @@ int init_ioexpanders(void)
return EC_SUCCESS;
}
+static void ioexpanders_irq(void)
+{
+ int fault;
+
+ fault = read_faults();
+
+ if (!(fault & USERVO_FAULT_L))
+ ccprintf("FAULT: Microservo USB A port load switch\n");
+
+ if (!(fault & USB3_A0_FAULT_L))
+ ccprintf("FAULT: USB3 A0 port load switch\n");
+
+ if (!(fault & USB3_A1_FAULT_L))
+ ccprintf("FAULT: USB3 A1 port load switch\n");
+
+ if (!(fault & USB_DUTCHG_FLT_ODL))
+ ccprintf("FAULT: Overcurrent on Charger or DUB CC/SBU lines\n");
+
+ if (!(fault & PP3300_DP_FAULT_L))
+ ccprintf("FAULT: Overcurrent on DisplayPort\n");
+
+ if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
+ ccprintf("FAULT: CC1 drive circuitry has exceeded thermal ");
+ ccprintf("limits or exceeded current limits. Power ");
+ ccprintf("off DAC0 to clear the fault\n");
+ }
+
+ if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
+ ccprintf("FAULT: CC2 drive circuitry has exceeded thermal ");
+ ccprintf("limits or exceeded current limits. Power ");
+ ccprintf("off DAC1 to clear the fault\n");
+ }
+}
+DECLARE_DEFERRED(ioexpanders_irq);
+
+int irq_ioexpanders(void)
+{
+ hook_call_deferred(&ioexpanders_irq_data, 0);
+ return 0;
+}
+
inline int sbu_uart_sel(int en)
{
return tca6416a_write_bit(1, TCA6416A_OUT_PORT_0, 0, en);
diff --git a/board/servo_v4p1/ioexpanders.h b/board/servo_v4p1/ioexpanders.h
index 7d96448e2f..d444a6fca3 100644
--- a/board/servo_v4p1/ioexpanders.h
+++ b/board/servo_v4p1/ioexpanders.h
@@ -16,6 +16,12 @@ enum uservo_fastboot_mux_sel_t {
*/
int init_ioexpanders(void);
+/*
+ * Calls the Ioexpanders Deferred handler for interrupts
+ * Should be called from the ioexpanders IRQ handler
+ */
+int irq_ioexpanders(void);
+
/**
* SBU Crosspoint select
*