2024-01-26 18:46:10

by Abhishek Pandit-Subedi

[permalink] [raw]
Subject: [PATCH v3 0/3] usb: typec: ucsi: Adding support for UCSI 3.0


Hi Heikki,

This series starts the work adding UCSI 3.0 support to the UCSI driver.

There's a couple of pieces to start here:
* Add version checks and limit read size on 1.2.
* Update Connector Status and Connector Capability structures.
* Expose Partner PD revision from Capability data.

These were tested against on a 6.6 kernel running a usermode PPM against
a Realtek Evaluation board.

One additional note: there are a lot more unaligned fields in UCSI now
and the struct definitions are getting a bit out of hand. We can discuss
alternate mechanisms for defining these structs in the patch that
changes these structures.

Thanks,
Abhishek

Changes in v3:
- Change include to asm/unaligned.h and reorder include.

Changes in v2:
- Changed log message to DEBUG
- Formatting changes and update macro to use brackets.
- Fix incorrect guard condition when checking connector capability.

Abhishek Pandit-Subedi (3):
usb: typec: ucsi: Limit read size on v1.2
usb: typec: ucsi: Update connector cap and status
usb: typec: ucsi: Get PD revision for partner

drivers/usb/typec/ucsi/ucsi.c | 49 +++++++++++++++++++++++++--
drivers/usb/typec/ucsi/ucsi.h | 64 ++++++++++++++++++++++++++++++++---
2 files changed, 107 insertions(+), 6 deletions(-)

--
2.43.0.429.g432eaa2c6b-goog



2024-01-28 16:08:22

by Mario Limonciello

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] usb: typec: ucsi: Adding support for UCSI 3.0

On 1/26/2024 12:39, Abhishek Pandit-Subedi wrote:
>
> Hi Heikki,
>
> This series starts the work adding UCSI 3.0 support to the UCSI driver.
>
> There's a couple of pieces to start here:
> * Add version checks and limit read size on 1.2.
> * Update Connector Status and Connector Capability structures.
> * Expose Partner PD revision from Capability data.
>
> These were tested against on a 6.6 kernel running a usermode PPM against
> a Realtek Evaluation board.
>
> One additional note: there are a lot more unaligned fields in UCSI now
> and the struct definitions are getting a bit out of hand. We can discuss
> alternate mechanisms for defining these structs in the patch that
> changes these structures.

On the Windows side I notice that Microsoft explicitly checks the UCSI
version to decide what data structures to use.

https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/ucsi#ucm-ucsi-acpi-device-for-ucsi-20-and-greater

Perhaps doing something similar makes sense in Linux?

>
> Thanks,
> Abhishek
>
> Changes in v3:
> - Change include to asm/unaligned.h and reorder include.
>
> Changes in v2:
> - Changed log message to DEBUG
> - Formatting changes and update macro to use brackets.
> - Fix incorrect guard condition when checking connector capability.
>
> Abhishek Pandit-Subedi (3):
> usb: typec: ucsi: Limit read size on v1.2
> usb: typec: ucsi: Update connector cap and status
> usb: typec: ucsi: Get PD revision for partner
>
> drivers/usb/typec/ucsi/ucsi.c | 49 +++++++++++++++++++++++++--
> drivers/usb/typec/ucsi/ucsi.h | 64 ++++++++++++++++++++++++++++++++---
> 2 files changed, 107 insertions(+), 6 deletions(-)
>


2024-01-30 22:31:09

by Abhishek Pandit-Subedi

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] usb: typec: ucsi: Adding support for UCSI 3.0

On Sun, Jan 28, 2024 at 8:06 AM Mario Limonciello
<[email protected]> wrote:
>
> On 1/26/2024 12:39, Abhishek Pandit-Subedi wrote:
> >
> > Hi Heikki,
> >
> > This series starts the work adding UCSI 3.0 support to the UCSI driver.
> >
> > There's a couple of pieces to start here:
> > * Add version checks and limit read size on 1.2.
> > * Update Connector Status and Connector Capability structures.
> > * Expose Partner PD revision from Capability data.
> >
> > These were tested against on a 6.6 kernel running a usermode PPM against
> > a Realtek Evaluation board.
> >
> > One additional note: there are a lot more unaligned fields in UCSI now
> > and the struct definitions are getting a bit out of hand. We can discuss
> > alternate mechanisms for defining these structs in the patch that
> > changes these structures.
>
> On the Windows side I notice that Microsoft explicitly checks the UCSI
> version to decide what data structures to use.
>
> https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/ucsi#ucm-ucsi-acpi-device-for-ucsi-20-and-greater
>
> Perhaps doing something similar makes sense in Linux?

That probably belongs in `ucsi_acpi` and would be good to add there. I
don't have a Windows device reporting a UCSI version 2.0 but wanting
1.2 so I can't add or test this patch.

>
> >
> > Thanks,
> > Abhishek
> >
> > Changes in v3:
> > - Change include to asm/unaligned.h and reorder include.
> >
> > Changes in v2:
> > - Changed log message to DEBUG
> > - Formatting changes and update macro to use brackets.
> > - Fix incorrect guard condition when checking connector capability.
> >
> > Abhishek Pandit-Subedi (3):
> > usb: typec: ucsi: Limit read size on v1.2
> > usb: typec: ucsi: Update connector cap and status
> > usb: typec: ucsi: Get PD revision for partner
> >
> > drivers/usb/typec/ucsi/ucsi.c | 49 +++++++++++++++++++++++++--
> > drivers/usb/typec/ucsi/ucsi.h | 64 ++++++++++++++++++++++++++++++++---
> > 2 files changed, 107 insertions(+), 6 deletions(-)
> >
>