Re: [PATCH] usb: typec: tcpm: Record the partner's Product Type VDOs

From: Heikki Krogerus

Date: Fri Nov 06 2026 - 07:52:13 EST


On Mon, Nov 02, 2026 at 06:21:24PM +0400, Alexey Charkov wrote:
> A Discover Identity response can carry up to three Product Type VDOs
> after the Product VDO, describing what the partner is as a UFP, DFP or
> alternate mode adapter. The Type-C class keeps them in the identity and
> shows them as product_type_vdo1-3, but TCPM stores only the ID header,
> Cert Stat and Product VDOs of a partner, so those always read 0. Cable
> identities already get their VDOs.
>
> Store the Product Type VDOs as received and zero the ones the partner
> does not send, leaving their PD revision specific layout to the reader.
>
> Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>

Acked-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
> drivers/usb/typec/tcpm/tcpm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index d721baef5210..8fd6b1f842b3 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -2064,6 +2064,7 @@ static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
> {
> u32 vdo = p[VDO_INDEX_IDH];
> u32 product = p[VDO_INDEX_PRODUCT];
> + int i;
>
> if (cnt <= VDO_INDEX_PRODUCT)
> return;
> @@ -2073,6 +2074,10 @@ static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
> port->partner_ident.id_header = vdo;
> port->partner_ident.cert_stat = p[VDO_INDEX_CSTAT];
> port->partner_ident.product = product;
> + /* Product Type VDOs, if any, follow the Product VDO */
> + for (i = 0; i < ARRAY_SIZE(port->partner_ident.vdo); i++)
> + port->partner_ident.vdo[i] = VDO_INDEX_PRODUCT + 1 + i < cnt ?
> + p[VDO_INDEX_PRODUCT + 1 + i] : 0;
>
> if (port->partner)
> typec_partner_set_identity(port->partner);
>
> ---
> base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c
> change-id: 20261102-tcpm-product-type-vdo-af873ef1fdf4
>
> Best regards,
> --
> Alexey Charkov <alchark@xxxxxxxxxxx>

--
heikki