Re: [PATCH v2 2/3] usb: typec: ucsi: Update connector cap and status

From: Abhishek Pandit-Subedi
Date: Thu Feb 08 2024 - 23:35:39 EST


On Thu, Feb 8, 2024 at 11:48 AM Jameson Thies <jthies@xxxxxxxxxx> wrote:
>
> Hi Abhishek,
>
> > +#define UCSI_CONCAP_FLAG_PARTNER_PD_MAJOR_REV_AS_BCD(_f_) \
> > + (UCSI_CONCAP_FLAG_PARTNER_PD_MAJOR_REV(_f_) << 8)
>
> Can you replace this with a common HEADER_REV_AS_BCD macro that can be
> used for both GET_CONNECTOR_CAPABILTY and GET_CABLE_PROPERTY?
> Also, the USB PD major revision value in the message header is one less than the
> revision (PD Spec section 6.2.1.1.5). So, we need to add 1 before shifting.

Jameson and I talked briefly and I discovered that PD assigns the
following values for the major rev:
* 00 = 1
* 01 = 2
* 10 = 3
* 11 = Reserved/Invalid

>From PD 3 onwards, there's a new Get_Revision message that can be
queried from UCSI using GET_PD_MESSAGE. In future patches adding
support for Discover Identity (also using GET_PD_MESSAGE), we will
need to check this major revision to see whether we should also query
Get Revision.

Since this code is incorrect, I will send up a PATCH v4 with the
correct BCD version as Jameson suggested. I'll also fix up some of the
minor nits in that patch series.

>
> Thanks,
> Jameson