[PATCH 3/3] usb: typec: tcpm: Clear the fault status register

From: Angus Ainslie (Purism)
Date: Mon May 06 2019 - 10:09:34 EST


If the fault status register doesn't get cleared then
the ptn5110 interrupt gets stuck on. As the fault register gets
set everytime the ptn5110 powers on the interrupt is always stuck.

Signed-off-by: Angus Ainslie (Purism) <angus@xxxxxxxx>
---
drivers/usb/typec/tcpm/tcpci.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index c6e0e48b9a2a..17a0ffe818c0 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -507,6 +507,18 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci)
tcpm_log(tcpci->port, "Invalid VBUS voltage %d", ret);
}

+ if (status & TCPC_ALERT_FAULT) {
+ u16 fault_status;
+
+ tcpci_read16(tcpci, TCPC_FAULT_STATUS, &fault_status);
+
+ tcpm_log(tcpci->port, "FAULT ALERT status 0x%x",
+ fault_status);
+
+ /* clear the fault status */
+ tcpci_write16(tcpci, TCPC_FAULT_STATUS, fault_status);
+ }
+
return IRQ_HANDLED;
}
EXPORT_SYMBOL_GPL(tcpci_irq);
--
2.17.1