mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: heikki.krogerus@linux.intel.com,
	Greg KH <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Cc: Anthony Iliopoulos <ailiopoulos@suse.com>
Subject: [RESEND] USB PD broken on Lenovo P15gen2
Date: Mon, 28 Aug 2023 17:52:02 +0300	[thread overview]
Message-ID: <04e8de7a-55e3-4d12-921d-537750fe6217@suse.com> (raw)
In-Reply-To: <0da9d8a4-1761-20a3-ebd6-a47fe48b94f8@suse.com>


[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 ?

       reply	other threads:[~2023-08-28 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0da9d8a4-1761-20a3-ebd6-a47fe48b94f8@suse.com>
2023-08-28 14:52 ` Nikolay Borisov [this message]
2023-08-30 13:07   ` Nikolay Borisov
2023-08-31 13:41     ` Heikki Krogerus
2023-08-31 14:08       ` Nikolay Borisov

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=04e8de7a-55e3-4d12-921d-537750fe6217@suse.com \
    --to=nik.borisov@suse.com \
    --cc=ailiopoulos@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®