Re: [PATCH v5 7/8] platform/chrome: cros_ec_typec: Thunderbolt support
From: Dzmitry Sankouski
Date: Tue Mar 03 2026 - 09:15:36 EST
пн, 2 мар. 2026 г. в 14:31, Andrei Kuchynski <akuchynski@xxxxxxxxxx>:
>
> Hi Dzmitry,
>
> On Mon, Mar 2, 2026 at 10:36 AM Dzmitry Sankouski <dsankouski@xxxxxxxxx> wrote:
> >
> >
> >
> > On 12/14/24 2:35 AM, Abhishek Pandit-Subedi wrote:
> > > Add support for entering and exiting Thunderbolt alt-mode using AP
> > > driven alt-mode.
> > >
> > > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
> > > ---
> > >
> > (...)
> >
> > > - amode = typec_port_register_altmode(port->port, &desc);
> > > - typec_altmode_set_drvdata(amode, port);
> > > - amode->ops = &port_amode_ops;
> >
> > The last usage of port_amode_ops is deleted here. Is this a mistake?
> > AFAIU from kernel docs, port_amode_ops needed for alternate mode driver
> > to send vdm messages to partner. Now, when it's unused, how does
> > alternate modes work in this driver?
> >
>
> The assignment of the typec_altmode_ops struct pointer is still here;
> see the cros_typec_register_thunderbolt / typec_altmode_set_ops
> implementation.
>
It's the .vdm callback implementation(cros_typec_thunderbolt_vdm) confused
me - as per docs, port driver's .vdm should be able to send and
receive vdm commands, but cros_typec_thunderbolt_vdm don't do it, whereas
port_amode_ops.vdm do.
So port .vdm callback just imitates vdm exchange to satisfy the altmode driver,
while the real work is performed by .enter and .exit callbacks.
Old port_amode_ops can be deleted because unused.
--
Best regards,
Dzmitry