Commit 9548742
usb: typec: tipd: Clear interrupts first
commit be5ae73 upstream.
Right now the interrupt handler first reads all updated status registers
and only then clears the interrupts. It's possible that a duplicate
interrupt for a changed register or plug state comes in after the
interrupts have been processed but before they have been cleared:
* plug is inserted, TPS_REG_INT_PLUG_EVENT is set
* TPS_REG_INT_EVENT1 is read
* tps6598x_handle_plug_event() has run and registered the plug
* plug is removed again, TPS_REG_INT_PLUG_EVENT is set (again)
* TPS_REG_INT_CLEAR1 is written, TPS_REG_INT_PLUG_EVENT is cleared
We then have no plug connected and no pending interrupt but the tipd
core still thinks there is a plug. It's possible to trigger this with
e.g. a slightly broken Type-C to USB A converter.
Fix this by first clearing the interrupts and only then reading the
updated registers.
Fixes: 45188f2 ("usb: typec: tipd: Add support for Apple CD321X")
Fixes: 0a4c005 ("usb: typec: driver for TI TPS6598x USB Power Delivery controllers")
Cc: [email protected]
Reviewed-by: Heikki Krogerus <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Signed-off-by: Sven Peter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 3e96cd2 commit 9548742
1 file changed
+11
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| 494 | + | |
| 495 | + | |
494 | 496 | | |
495 | | - | |
| 497 | + | |
496 | 498 | | |
497 | 499 | | |
498 | 500 | | |
499 | | - | |
| 501 | + | |
500 | 502 | | |
501 | 503 | | |
502 | 504 | | |
503 | | - | |
| 505 | + | |
504 | 506 | | |
505 | 507 | | |
506 | 508 | | |
507 | 509 | | |
508 | 510 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
| |||
555 | 554 | | |
556 | 555 | | |
557 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
558 | 560 | | |
559 | | - | |
| 561 | + | |
560 | 562 | | |
561 | 563 | | |
562 | 564 | | |
563 | | - | |
| 565 | + | |
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
567 | | - | |
| 569 | + | |
568 | 570 | | |
569 | 571 | | |
570 | 572 | | |
571 | 573 | | |
572 | 574 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | 575 | | |
578 | 576 | | |
579 | 577 | | |
| |||
0 commit comments