Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: ucsi: Ignore PD capabilities not starting with vSafe5V
@ 2026-12-01 21:04 Paul Menzel
  2026-12-01 21:10 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Menzel @ 2026-12-01 21:04 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Saranya Gopal,
	Rajaram Regupathy
  Cc: Dell.Client.Kernel, Paul Menzel, linux-usb, linux-kernel

On the Dell XPS 13 9310 (system firmware/BIOS 3.17.0, 3.37.0) and the Dell
XPS 9315 (BIOS 1.26.0), the PPM answers GET_PDOS for the connectors’ own
Source Capabilities on both ports with a single, invalid PDO 0x912c2aa8,
independent of whether a partner is attached. It decodes as a Variable
Supply with a minimum voltage above its maximum, which is exported
unchanged:

    $ grep -r . /sys/class/usb_power_delivery/pd0/source-capabilities/1:variable_supply/
    …/maximum_current:6800mA
    …/maximum_voltage:13700mV
    …/minimum_voltage:38900mV

The ports actually offer 5 V at 3 A. A Samsung Galaxy Tab A requested
3 A from PDO 1 (RDO 0x1304b12c in GET_CONNECTOR_STATUS), and the PDO’s
upper half 0x912c equals the lower half of a 5 V/3 A Fixed Supply PDO.
The ACPI _DSM only copies the EC’s message bytes 0x90–0x9f, so the
value comes from the embedded controller firmware.

The USB PD specification requires the first PDO of Source and Sink
Capabilities to be a vSafe5V Fixed Supply PDO, which tcpm also checks
in tcpm_caps_err(). Apply that check in ucsi_get_pd_caps(), and report
the firmware bug instead of registering such capabilities. All-zero
responses are left alone, as before.

With the change, on the Dell XPS 13 9310:

    ucsi_acpi USBC000:00: [Firmware Bug]: con1: port source PDO 1 is not vSafe5V (0x912c2aa8), ignoring
    ucsi_acpi USBC000:00: [Firmware Bug]: con2: port source PDO 1 is not vSafe5V (0x912c2aa8), ignoring

The port’s sink capabilities and the partner capabilities of the
attached 45 W Dell adapter are registered as before.

Fixes: b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities")
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---

Notes:

    Detected by and analyzed with claude-opus-5.5.

 drivers/usb/typec/ucsi/ucsi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 9e453d216c169..def62cd981624 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -937,6 +937,20 @@ static struct usb_power_delivery_capabilities *ucsi_get_pd_caps(struct ucsi_conn
 	if (ret <= 0)
 		return ERR_PTR(ret);
 
+	/*
+	 * USB PD requires Source and Sink Capabilities to start with a vSafe5V
+	 * Fixed Supply PDO. Do not expose a list that does not.
+	 */
+	if (pd_caps.pdo[0] &&
+	    (pdo_type(pd_caps.pdo[0]) != PDO_TYPE_FIXED ||
+	     pdo_fixed_voltage(pd_caps.pdo[0]) != VSAFE5V)) {
+		dev_warn(con->ucsi->dev,
+			 FW_BUG "con%d: %s %s PDO 1 is not vSafe5V (0x%08x), ignoring\n",
+			 con->num, is_partner ? "partner" : "port",
+			 is_source(role) ? "source" : "sink", pd_caps.pdo[0]);
+		return NULL;
+	}
+
 	if (ret < PDO_MAX_OBJECTS)
 		pd_caps.pdo[ret] = 0;
 
-- 
2.54.0


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

end of thread, other threads:[~2026-12-01 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 21:04 [PATCH] usb: typec: ucsi: Ignore PD capabilities not starting with vSafe5V Paul Menzel
2026-12-01 21:10 ` sashiko-bot

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