Linux USB
 help / color / mirror / Atom feed
From: Kyle Tso <kyletso@google.com>
To: Badhri Jagan Sridharan <badhri@google.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Amit Sunil Dhamne <amitsd@google.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-usb@vger.kernel.org,  Kyle Tso <kyletso@google.com>
Subject: [PATCH v1] usb: typec: tcpm: Clear pps_data in tcpm_reset_port()
Date: Thu,  3 Dec 2026 14:00:23 +0000	[thread overview]
Message-ID: <20261203140023.2275666-1-kyletso@google.com> (raw)

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


                 reply	other threads:[~2026-12-03 14:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203140023.2275666-1-kyletso@google.com \
    --to=kyletso@google.com \
    --cc=amitsd@google.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox