Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: typec: tcpm: Check cc status before entering SRC_TRY_DEBOUCE

[ 130.893355] state change SNK_DEBOUNCED -> SRC_TRY
[ 130.893363] cc:=3
[ 130.893490] pending state change SRC_TRY -> SNK_TRYWAIT @ 100 ms
[ 130.895602] CC1: 3 -> 0, CC2: 0 -> 0 [state SRC_TRY, polarity 0, disconnected]
[ 130.895613] state change SRC_TRY -> SRC_TRY_DEBOUNCE
[ 130.895621] pending state change SRC_TRY_DEBOUNCE -> SRC_ATTACHED @ 20 ms
[ 130.916843] state change SRC_TRY_DEBOUNCE -> SRC_ATTACHED [delayed 20 ms]

Although the CC state was changing to TYPEC_CC_OPEN, the port entered
SRC_TRY_DEBOUNCE from SRC_TRY. The port must enter SRC_TRY_DEBOUNCE only
if the CC state is TYPEC_CC_RD.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
[groeck: Wording]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Badhri Jagan Sridharan and committed by
Greg Kroah-Hartman
c79d92bd b17dd571

+2 -1
+2 -1
drivers/staging/typec/tcpm.c
··· 2897 2897 break; 2898 2898 2899 2899 case SRC_TRY: 2900 - tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0); 2900 + if (tcpm_port_is_source(port)) 2901 + tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0); 2901 2902 break; 2902 2903 case SRC_TRY_DEBOUNCE: 2903 2904 tcpm_set_state(port, SRC_TRY, 0);