[RESEND] USB PD broken on Lenovo P15gen2
From: Nikolay Borisov
Date: Mon Aug 28 2023 - 10:52:46 EST
[Resending as I had initially attached a full acpi dump and it got
bounced from the usb mailing list]
Hello,
I'm not able to use usb PD on a Lenovo Thinkpad P15gen2 laptop. It's
equipped with 2 thunderbolt ports and a usb 3.2 gen2 usb port, all of
which are supposed to support PD 2.0:
cat /sys/class/typec/port*/usb_power_delivery_revision
2.0
2.0
2.0
Whenever I connect a pd-capable device (i.e a mobile phone or a tablet)
with a known good cable i.e i'm able to achieve fast charging (~30w) on
the device when using the same cable but connected to an external
monitor and not the laptop, I'm not able to get fast charge to work. In
dmesg I get the following:
[ 1262.933106] usb 3-12: new high-speed USB device number 8 using xhci_hcd
[ 1263.083343] usb 3-12: New USB device found, idVendor=22d9,
idProduct=2046, bcdDevice= 2.23
[ 1263.083350] usb 3-12: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[ 1263.083353] usb 3-12: Product: IV2201
[ 1263.083355] usb 3-12: Manufacturer: OnePlus
[ 1263.083356] usb 3-12: SerialNumber: xxxxxxx
[ 1263.116184] ucsi_acpi USBC000:00: UCSI_GET_PDOS failed (-95)
[ 1268.676590] ucsi_acpi USBC000:00: UCSI_GET_PDOS failed (-95)
[ 1273.816117] ucsi_acpi USBC000:00: UCSI_GET_PDOS failed (-95)
[ 1273.904187] ucsi_acpi USBC000:00: UCSI_GET_PDOS failed (-95)
When looking at the state of the partner device:
$ cat /sys/class/typec/port2-partner/supports_usb_power_delivery
yes
$ cat /sys/class/typec/port2-partner/usb_power_delivery_revision
0.0
After some debugging it seems this is because the lenovo is not
supporting CCI which seems to be some sort of a communication mechanism.
This was asserted with the following bpftrace script:
bpftrace -e 'kretprobe:ucsi_acpi_read { printf("ucsi_acpi_read returned:
%d\n", retval); } kretprobe:ucsi_exec_command {
printf("ucsi_exec_command returned: %d\n", retval); }'
Attaching 2 probes...
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: 9
ucsi_acpi_read returned: 0
ucsi_exec_command returned: 9
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: 9
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: -95
ucsi_exec_command returned: -110
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: -95
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: -95
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: -95
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
ucsi_exec_command returned: 0
ucsi_acpi_read returned: 0
ucsi_acpi_read returned: 0
This would correspond to the following snippet in ucsi_exec_command:
if (cci & UCSI_CCI_NOT_SUPPORTED)
return -EOPNOTSUPP;
I can provide a full acpidump if need be. And I'm also using the latest
available firmware from Lenovo, installed via lvfs. This issue happens
on kernel 6.2 based ubuntu kernel as well as on upstream 6.4.3 but it
seems it's not dependent on the kernel version as it's somehow related
to lenovo's firmware.
I'm wondering whether a similar quirk like the one for the zenbook is
also required for lenovo ?