Re: [PATCH v2 1/2] platform/chrome: cros_ec_typec: Enforce priority-based mode selection

From: Tzung-Bi Shih

Date: Thu Oct 22 2026 - 02:51:18 EST


On Tue, Oct 20, 2026 at 11:12:03AM +0200, Andrei Kuchynski wrote:
> On Thu, Oct 15, 2026 at 2:15 PM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> > On Thu, Oct 08, 2026 at 01:40:55PM +0000, Andrei Kuchynski wrote:
> > > @@ -421,7 +427,6 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
> > > memset(&desc, 0, sizeof(desc));
> > > desc.svid = USB_TYPEC_TBT_SID;
> > > desc.mode = TBT_MODE;
> > > - desc.inactive = true;
> >
> > Why this is removed? Per 1aede0698167 ("platform/chrome: cros_ec_typec:
> > Disable tbt on port"), it disables entering TBT mode automatically.
>
> If the ap_driven_altmode parameter is enabled, automatic activation of
> both TBT and DP will be disabled via the mode_selection field. Consequently,
> deactivating TBT via the inactive field is no longer necessary.
> Alternative mode drivers within cros_ec_typec are no longer needed to
> trigger activation.

Ack, I see.

> > > diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
> > > index 66c546bf89b53..116329dd113f8 100644
> > > --- a/drivers/platform/chrome/cros_typec_altmode.c
> > > +++ b/drivers/platform/chrome/cros_typec_altmode.c
> > > @@ -41,12 +41,16 @@ static void cros_typec_altmode_work(struct work_struct *work)
> > > {
> > > struct cros_typec_altmode_data *data =
> > > container_of(work, struct cros_typec_altmode_data, work);
> > > + int ret;
> > >
> > > mutex_lock(&data->lock);
> > >
> > > - if (typec_altmode_vdm(data->alt, data->header, data->vdo_data,
> > > - data->vdo_size))
> > > + ret = typec_altmode_vdm(data->alt, data->header, data->vdo_data,
> > > + data->vdo_size);
> > > + if (ret) {
> > > dev_err(&data->alt->dev, "VDM 0x%x failed\n", data->header);
> > > + typec_altmode_state_update(data->port->partner, data->sid, ret);
> > > + }
> >
> > Wouldn't it need to update the state even if !ret?
>
> No. The typec_altmode_state_update() reports whether the activation of
> altmode has been completed or has failed.
> If successful, typec_altmode_state_update() will be called from within
> cros_typec_configure_mux().

Ack, I see.