Commit 9119500
usb: typec: tcpm: fix debug accessory mode detection for sink ports
commit f6ec9bb upstream.
The port in debug accessory mode can be either a source or sink. The
previous tcpm_port_is_debug() function only checked for source port.
Commit 8db73e6 ("usb: typec: tcpm: allow sink (ufp) to toggle into
accessory mode debug") changed the detection logic to support both roles,
but left some logic in _tcpm_cc_change() unchanged, This causes the state
machine to transition to an incorrect state when operating as a sink in
debug accessory mode. Log as below:
[ 978.637541] CC1: 0 -> 5, CC2: 0 -> 5 [state TOGGLING, polarity 0, connected]
[ 978.637567] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS]
[ 978.637596] pending state change SRC_ATTACH_WAIT -> DEBUG_ACC_ATTACHED @ 180 ms [rev1 NONE_AMS]
[ 978.647098] CC1: 5 -> 0, CC2: 5 -> 5 [state SRC_ATTACH_WAIT, polarity 0, connected]
[ 978.647115] state change SRC_ATTACH_WAIT -> SRC_ATTACH_WAIT [rev1 NONE_AMS]
It should go to SNK_ATTACH_WAIT instead of SRC_ATTACH_WAIT state.
To fix this, add tcpm_port_is_debug_source() and tcpm_port_is_debug_sink()
helper to explicitly identify the power mode in debug accessory mode.
Update the state transition logic in _tcpm_cc_change() to ensure the state
machine transitions comply with Type-C specification. Also update the logic
in run_state_machine() to keep consistency.
Fixes: 8db73e6 ("usb: typec: tcpm: allow sink (ufp) to toggle into accessory mode debug")
Cc: stable <stable@kernel.org>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Amit Sunil Dhamne <amitsd@google.com>
Link: https://patch.msgid.link/20260424074009.2979266-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent f30ccfc commit 9119500
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
637 | 643 | | |
638 | | - | |
639 | | - | |
| 644 | + | |
640 | 645 | | |
641 | 646 | | |
642 | 647 | | |
| |||
4812 | 4817 | | |
4813 | 4818 | | |
4814 | 4819 | | |
4815 | | - | |
| 4820 | + | |
4816 | 4821 | | |
4817 | 4822 | | |
4818 | 4823 | | |
| |||
5070 | 5075 | | |
5071 | 5076 | | |
5072 | 5077 | | |
5073 | | - | |
| 5078 | + | |
5074 | 5079 | | |
5075 | 5080 | | |
5076 | 5081 | | |
| |||
5090 | 5095 | | |
5091 | 5096 | | |
5092 | 5097 | | |
5093 | | - | |
| 5098 | + | |
5094 | 5099 | | |
5095 | 5100 | | |
5096 | 5101 | | |
| |||
5961 | 5966 | | |
5962 | 5967 | | |
5963 | 5968 | | |
5964 | | - | |
| 5969 | + | |
5965 | 5970 | | |
5966 | 5971 | | |
5967 | | - | |
| 5972 | + | |
5968 | 5973 | | |
5969 | 5974 | | |
5970 | 5975 | | |
5971 | 5976 | | |
5972 | 5977 | | |
5973 | 5978 | | |
5974 | 5979 | | |
5975 | | - | |
| 5980 | + | |
5976 | 5981 | | |
5977 | 5982 | | |
| 5983 | + | |
| 5984 | + | |
5978 | 5985 | | |
5979 | 5986 | | |
5980 | 5987 | | |
| |||
5996 | 6003 | | |
5997 | 6004 | | |
5998 | 6005 | | |
5999 | | - | |
| 6006 | + | |
6000 | 6007 | | |
6001 | 6008 | | |
6002 | 6009 | | |
| |||
0 commit comments