diff mbox series

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

Message ID 20190506140830.25376-4-angus@akkea.ca (mailing list archive)
State Superseded
Headers show
Series usb: typec: tcpm: Add some FAULT_STATUS processing | expand

Commit Message

Angus Ainslie May 6, 2019, 2:08 p.m. UTC
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@akkea.ca>
---
 drivers/usb/typec/tcpm/tcpci.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Fabio Estevam May 6, 2019, 3:11 p.m. UTC | #1
Hi Angus,

On Mon, May 6, 2019 at 11:10 AM Angus Ainslie (Purism) <angus@akkea.ca> wrote:
>
> 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@akkea.ca>

Since this is a bug fix, I would suggest adding a Fixes tag and Cc
stable if appropriate.

I would also put this patch as the first one in the series, so that it
can be easily applied to older stable trees.
Guenter Roeck May 6, 2019, 3:27 p.m. UTC | #2
On Mon, May 06, 2019 at 12:11:41PM -0300, Fabio Estevam wrote:
> Hi Angus,
> 
> On Mon, May 6, 2019 at 11:10 AM Angus Ainslie (Purism) <angus@akkea.ca> wrote:
> >
> > 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@akkea.ca>
> 
> Since this is a bug fix, I would suggest adding a Fixes tag and Cc
> stable if appropriate.
> 
> I would also put this patch as the first one in the series, so that it
> can be easily applied to older stable trees.

Unfortunately there is an added tcpm_log() ... and I am opposed to exporting
that.

Guenter
Angus Ainslie May 7, 2019, 11:42 a.m. UTC | #3
On 2019-05-06 09:27, Guenter Roeck wrote:
> On Mon, May 06, 2019 at 12:11:41PM -0300, Fabio Estevam wrote:
>> Hi Angus,
>> 
>> On Mon, May 6, 2019 at 11:10 AM Angus Ainslie (Purism) 
>> <angus@akkea.ca> wrote:
>> >
>> > 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@akkea.ca>
>> 
>> Since this is a bug fix, I would suggest adding a Fixes tag and Cc
>> stable if appropriate.
>> 
>> I would also put this patch as the first one in the series, so that it
>> can be easily applied to older stable trees.
> 
> Unfortunately there is an added tcpm_log() ... and I am opposed to 
> exporting
> that.
> 

Ok I'll fix them both up for v2.

> Guenter
diff mbox series

Patch

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);