summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-03-01 13:13:14 +0100
committerCommit Bot <commit-bot@chromium.org>2021-03-11 21:43:51 +0000
commitdd6abb2055e4ba979a02e52459aeb9b10167f8f3 (patch)
treebfca71564716724a5b70dce94597ec15aadfe4df
parent7ad578bfb93e995b59841417f98dc693fa81e9a3 (diff)
downloadchrome-ec-dd6abb2055e4ba979a02e52459aeb9b10167f8f3.tar.gz
servo_v4p1: Improve handling of DACs' faults
Fix handling CC2 line fault. CC2 line was not checked, instead, CC1 was used in both checks. Change message that appear on servo's console after detecting DACs' faults. Now, after detecting fault on CC lines, corresponding DAC will be disabled and fault will be cleared. BUG=b:168730704 BRANCH=main TEST=On servo's console execute commands as follows. For CC1: > i2cxfer w16 1 0x48 0x8 0x0080 > i2cxfer w 1 0x23 4 0x12 Short DUT_CC1 pin to ground. Message about CC1 DAC fault should appear on console. For CC2: > i2cxfer w16 1 0x49 0x8 0x0080 > i2cxfer w 1 0x23 4 0x22 Short DUT_CC2 pin to ground. Message about CC2 DAC fault should appear on console. Signed-off-by: Michał Barnaś <mb@semihalf.com> Change-Id: I32b727790dcc54355a5211a667c091287aa04b3e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2732017 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/servo_v4p1/ioexpanders.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/board/servo_v4p1/ioexpanders.c b/board/servo_v4p1/ioexpanders.c
index 7a8c409fea..7482038879 100644
--- a/board/servo_v4p1/ioexpanders.c
+++ b/board/servo_v4p1/ioexpanders.c
@@ -8,6 +8,9 @@
#include "ioexpander.h"
#include "ioexpanders.h"
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+
/******************************************************************************
* Initialize IOExpanders.
*/
@@ -45,46 +48,63 @@ static void ioexpanders_irq(void)
if (!(fault & USERVO_FAULT_L)) {
ec_uservo_power_en(0);
- ccprintf("FAULT: Microservo USB A port load switch\n");
+ CPRINTF("FAULT: Microservo USB A port load switch\n");
}
if (!(fault & USB3_A0_FAULT_L)) {
ec_usb3_a0_pwr_en(0);
- ccprintf("FAULT: USB3 A0 port load switch\n");
+ CPRINTF("FAULT: USB3 A0 port load switch\n");
}
if (!(fault & USB3_A1_FAULT_L)) {
ec_usb3_a1_pwr_en(0);
- ccprintf("FAULT: USB3 A1 port load switch\n");
+ CPRINTF("FAULT: USB3 A1 port load switch\n");
}
- if (!(fault & USB_DUTCHG_FLT_ODL))
- ccprintf("FAULT: Overcurrent on Charger or DUT CC/SBU lines\n");
+ if (!(fault & USB_DUTCHG_FLT_ODL)) {
+ CPRINTF("FAULT: Overcurrent on Charger or DUT CC/SBU lines\n");
+ }
- if (!(fault & PP3300_DP_FAULT_L))
- ccprintf("FAULT: Overcurrent on DisplayPort\n");
+ if (!(fault & PP3300_DP_FAULT_L)) {
+ CPRINTF("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");
+ CPRINTF("FAULT: CC1 drive circuitry has exceeded thermal "
+ "or current limits. The CC1 DAC has been disabled "
+ "and disconnected.\n");
+
+ en_vout_buf_cc1(0);
}
- 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");
+ if (!(fault & DAC_BUF2_LATCH_FAULT_L)) {
+ CPRINTF("FAULT: CC2 drive circuitry has exceeded thermal "
+ "or current limits. The CC2 DAC has been disabled "
+ "and disconnected.\n");
+
+ en_vout_buf_cc2(0);
+ }
+
+ /*
+ * In case of both DACs' faults, we should clear them only after
+ * disabling both DACs.
+ */
+ if ((fault & (DAC_BUF1_LATCH_FAULT_L | DAC_BUF2_LATCH_FAULT_L)) !=
+ (DAC_BUF1_LATCH_FAULT_L | DAC_BUF2_LATCH_FAULT_L)) {
+ fault_clear_cc(1);
+ fault_clear_cc(0);
}
if ((!!(irqs & HOST_CHRG_DET) != bc12_charger) &&
(board_id_det() <= BOARD_ID_REV1)) {
- ccprintf("BC1.2 charger %s\n", (irqs & HOST_CHRG_DET) ?
- "plugged" : "unplugged");
+ CPRINTF("BC1.2 charger %s\n",
+ (irqs & HOST_CHRG_DET) ? "plugged" : "unplugged");
bc12_charger = !!(irqs & HOST_CHRG_DET);
}
- if (!(irqs & SYS_PWR_IRQ_ODL))
- ccprintf("System full power threshold exceeded\n");
+ if (!(irqs & SYS_PWR_IRQ_ODL)) {
+ CPRINTF("System full power threshold exceeded\n");
+ }
}
DECLARE_DEFERRED(ioexpanders_irq);