Re: [PATCH] usb: typec: fusb302: Keep interrupt flags across a failed register read

From: Alexey Charkov

Date: Fri Nov 20 2026 - 08:53:14 EST


Hi Heikki,

On Fri, Nov 20, 2026 at 5:04 PM Heikki Krogerus
<heikki.krogerus@xxxxxxxxxxxxxxx> wrote:
>
> Hi Alexey,
>
> On Tue, Nov 17, 2026 at 12:25:31PM +0400, Alexey Charkov wrote:
> > Reading INTERRUPT, INTERRUPTA or INTERRUPTB clears its flags in the chip,
> > so bailing out on an I2C error in a later read loses the flags already
> > read. On Flipper One, a NACK on INTERRUPTB just as a source raised VBUS
> > lost VBUSOK. The driver kept treating VBUS as off, so TCPM never attached
> > as a sink and left every Source_Capabilities unanswered.
> >
> > Keep the flags pending until they are handled, and retry the reads a few
> > times, as such errors pass. Otherwise a flag left pending waits for the
> > next interrupt.
>
> I did not quite understand this. What's the i2c error? Shouldn't the
> i2c adapter driver take care of the retries?

Any I2C transactions can fail - that's why the accessors return status
codes. And they do, e.g. if another device on a shared bus misbehaves
and hogs the bus down, or if there's any intermittent interference,
etc. The I2C controller won't rerun the failed transaction and will
propagate the error code to the caller instead. In my case it was
-ENXIO when another device on the bus interfered with reading the
interrupt status registers midway, causing the irq_work function to
exit early and drop the flags it has already read without acting on
them. The result was a permanently desynchronized TCPM state machine
vs. what the partner saw on the wire.

> > Fixes: c034a43e72dd ("staging: typec: Fairchild FUSB302 Type-c chip driver")
> > Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>
>
> No stable?

Cc: stable would make sense; my oversight. Thanks for spotting that.
Shall I resend with it added?

Best regards,
Alexey