Linux USB
 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: Re: [RESEND] USB PD broken on Lenovo P15gen2
Date: Wed, 30 Aug 2023 16:07:55 +0300	[thread overview]
Message-ID: <9841c4f5-614e-bfff-e725-2398fad4e927@suse.com> (raw)
In-Reply-To: <04e8de7a-55e3-4d12-921d-537750fe6217@suse.com>



On 28.08.23 г. 17:52 ч., Nikolay Borisov wrote:
> 
> [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:

<snip>
So I've been debugging this and what the PPM reports is the following:

modprobe-529501  [004] ..... 33507.058332: ucsi_register: Supported UCSI spec: 100
      kworker/4:0-524223  [004] ..... 33507.486591: ucsi_init_work: Connectors supported: 3
      kworker/4:0-524223  [004] ..... 33507.486592: ucsi_init_work: GET_CAP: USB_PD: 0 TYPEC_CURRENT: 1 POWER_VBUS: 0, POWER_OTHER: 0, POWER_AC_SUPPLY: 1, BATTERY_CHARGING: 0 bcVersion: 0x102 typec_version: 0x100 pd_version: 0x200 PDO_DETAILS: 0
      kworker/4:0-524223  [004] ..... 33507.682726: ucsi_init_work: [Register port 1]: OPMODE: E4 flag:1
      kworker/4:0-524223  [004] ..... 33508.850438: ucsi_init_work: [Register port 2]: OPMODE: E4 flag:1
      kworker/4:0-524223  [004] ..... 33509.986672: ucsi_init_work: [Register port 3]: OPMODE: E4 flag:1


So all three ports support DRP/USB2/USB3/ALT_MODE and they can be a provider.


I find it strange that USB_PD is reported as 0 yet pd_version is reported as 2. I contacted Lenovo's support and they confirmed that this particular model indeed supports PD 3.0 on all USBC ports.

I see a couple of problems with the current upstream code:

1. It assumes that USB_PD is valid because the PD version from pd_version is being propagated to several places (like in ucsi_register_port() cap->pd_revision = ucsi->cap.pd_version;)
2. When typec_register_port() is called from ucsi_register_port() cap->pd is 0 hence the port->pd = cap->pd; assignment in typec_register_port is a noop. In fact I don't see where cap->pd is being initialized since we initialize con->pd when we call usb_power_delivery_register in ucsi_register_port().


Is it mandatory that GET_PDOS is supported if PD is supported, the UCSI spec doesn't say anything other than GET_PDOS is optional and signaled by bit in the GET_CAP call ?

  reply	other threads:[~2023-08-30 18:31 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 ` [RESEND] USB PD broken on Lenovo P15gen2 Nikolay Borisov
2023-08-30 13:07   ` Nikolay Borisov [this message]
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=9841c4f5-614e-bfff-e725-2398fad4e927@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