The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y git checkout FETCH_HEAD git cherry-pick -x bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2024051338-manager-debatable-2c57@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^.. Possible dependencies: bf20c69cf3cf ("usb: typec: tcpm: clear pd_event queue in PORT_RESET") 197331b27ac8 ("usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices") 1e35f074399d ("usb: typec: tcpm: fix cc role at port reset") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") 42b8ff477202 ("Input: amimouse - convert to platform remove callback returning void") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf Mon Sep 17 00:00:00 2001 From: RD Babiera <rdbabiera@xxxxxxxxxx> Date: Tue, 23 Apr 2024 20:27:16 +0000 Subject: [PATCH] usb: typec: tcpm: clear pd_event queue in PORT_RESET When a Fast Role Swap control message attempt results in a transition to ERROR_RECOVERY, the TCPC can still queue a TCPM_SOURCING_VBUS event. If the event is queued but processed after the tcpm_reset_port() call in the PORT_RESET state, then the following occurs: 1. tcpm_reset_port() calls tcpm_init_vbus() to reset the vbus sourcing and sinking state 2. tcpm_pd_event_handler() turns VBUS on before the port is in the default state. 3. The port resolves as a sink. In the SNK_DISCOVERY state, tcpm_set_charge() cannot set vbus to charge. Clear pd events within PORT_RESET to get rid of non-applicable events. Fixes: b17dd57118fe ("staging: typec: tcpm: Improve role swap with non PD capable partners") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: RD Babiera <rdbabiera@xxxxxxxxxx> Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20240423202715.3375827-2-rdbabiera@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 99a039374f9c..a0e0ffd5a64b 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5605,6 +5605,7 @@ static void run_state_machine(struct tcpm_port *port) break; case PORT_RESET: tcpm_reset_port(port); + port->pd_events = 0; if (port->self_powered) tcpm_set_cc(port, TYPEC_CC_OPEN); else