Linux USB
 help / color / mirror / Atom feed
* [PATCH v1] usb: typec: tcpm: Clear pps_data in tcpm_reset_port()
@ 2026-12-03 14:00 Kyle Tso
  2026-12-03 14:25 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Tso @ 2026-12-03 14:00 UTC (permalink / raw)
  To: Badhri Jagan Sridharan, Heikki Krogerus, Greg Kroah-Hartman
  Cc: Amit Sunil Dhamne, Guenter Roeck, linux-usb, Kyle Tso

tcpm_reset_port() currently clears only port->pps_data.supported on
port detach or reset, leaving port->pps_data.active and the remaining
fields (min_volt, max_volt, max_curr, and req_*) stale from a prior
PPS session.

Because the TCPM power_supply getters check port->pps_data.active, the
voltage and current limit properties continue reporting the previous
PPS adapter's bounds even after detach. When a new source is attached
and charging is enabled in SNK_DISCOVERY, POWER_SUPPLY_PROP_ONLINE
also falsely reports TCPM_PSY_PPS_ONLINE instead of
TCPM_PSY_FIXED_ONLINE (along with the stale PPS limits instead of the
5V Type-C limits) until a new PD contract is accepted or
SNK_HARD_RESET_SINK_OFF runs (if reached).

Clear the entire port->pps_data structure in tcpm_reset_port(),
matching SNK_HARD_RESET_SINK_OFF, before notifying port->psy.

Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
Cc: stable@vger.kernel.org
Reviewed-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index ca38e05f831a..72b08d69ff80 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5178,7 +5178,7 @@ static void tcpm_reset_port(struct tcpm_port *port)
 	tcpm_typec_disconnect(port);
 	port->attached = false;
 	port->pd_capable = false;
-	port->pps_data.supported = false;
+	memset(&port->pps_data, 0, sizeof(port->pps_data));
 	tcpm_set_partner_usb_comm_capable(port, false);
 
 	/*

base-commit: 9357829ac604c28510b71b154cb6630af81226ff
-- 
2.56.1.911.g883d8bcb20-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:00 [PATCH v1] usb: typec: tcpm: Clear pps_data in tcpm_reset_port() Kyle Tso
2026-12-03 14:25 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox