Re: [PATCH v2 2/2] platform/chrome: cros_ec_typec: Reorder altmode registration
From: Tzung-Bi Shih
Date: Thu Oct 15 2026 - 08:16:55 EST
On Thu, Oct 08, 2026 at 01:40:56PM +0000, Andrei Kuchynski wrote:
> @@ -406,17 +406,6 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
> struct typec_altmode_desc desc;
> struct typec_altmode *amode;
>
> - /* All PD capable CrOS devices are assumed to support DP altmode. */
> - memset(&desc, 0, sizeof(desc));
> - desc.svid = USB_TYPEC_DP_SID;
> - desc.mode = USB_TYPEC_DP_MODE;
> - desc.vdo = DP_PORT_VDO;
> - amode = cros_typec_register_displayport(port, &desc,
> - typec->ap_driven_altmode);
> - if (IS_ERR(amode))
> - return PTR_ERR(amode);
> - port->port_altmode[CROS_EC_ALTMODE_DP] = amode;
> -
> /*
> * Register TBT compatibility alt mode. The EC will not enter the mode
> * if it doesn't support it and it will not enter automatically by
> @@ -433,6 +422,17 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
> port->port_altmode[CROS_EC_ALTMODE_TBT] = amode;
> }
>
> + /* All PD capable CrOS devices are assumed to support DP altmode. */
> + memset(&desc, 0, sizeof(desc));
> + desc.svid = USB_TYPEC_DP_SID;
> + desc.mode = USB_TYPEC_DP_MODE;
> + desc.vdo = DP_PORT_VDO;
> + amode = cros_typec_register_displayport(port, &desc,
> + typec->ap_driven_altmode);
> + if (IS_ERR(amode))
> + return PTR_ERR(amode);
> + port->port_altmode[CROS_EC_ALTMODE_DP] = amode;
> +
It deserves a code comment to note that the registration order dictates
the priorities.