Commit 01fbfa6
usb: typec: tipd: Clear interrupts first
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: stable <stable@kernel.org>
Signed-off-by: Sven Peter <sven@svenpeter.dev>1 parent 4f5b8aa commit 01fbfa6
1 file changed
Lines changed: 11 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
553 | 555 | | |
554 | | - | |
| 556 | + | |
555 | 557 | | |
556 | 558 | | |
557 | 559 | | |
558 | | - | |
| 560 | + | |
559 | 561 | | |
560 | 562 | | |
561 | 563 | | |
562 | | - | |
| 564 | + | |
563 | 565 | | |
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
567 | 569 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | 570 | | |
572 | 571 | | |
573 | 572 | | |
| |||
673 | 672 | | |
674 | 673 | | |
675 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
676 | 678 | | |
677 | | - | |
| 679 | + | |
678 | 680 | | |
679 | 681 | | |
680 | 682 | | |
681 | | - | |
| 683 | + | |
682 | 684 | | |
683 | 685 | | |
684 | 686 | | |
685 | | - | |
| 687 | + | |
686 | 688 | | |
687 | 689 | | |
688 | 690 | | |
689 | 691 | | |
690 | 692 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | 693 | | |
696 | 694 | | |
697 | 695 | | |
| |||
0 commit comments