Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: Introduce mode_selection bit

The port driver sets this bit for an alternate mode description to indicate
support for the mode selection feature. Once set, individual Alt Mode
drivers will no longer attempt to activate their respective modes within
their probe functions. This prevents race conditions and non-prioritized
activation.
The bit is not set by default. If left unset, the system retains the
current behavior where Alt Mode drivers manage their own activation logic.

Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://patch.msgid.link/20260119131824.2529334-6-akuchynski@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andrei Kuchynski and committed by
Greg Kroah-Hartman
be727d40 fb2abc75

+8 -3
+4 -2
drivers/usb/typec/altmodes/displayport.c
··· 804 804 if (plug) 805 805 typec_altmode_set_drvdata(plug, dp); 806 806 807 - dp->state = plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER; 808 - schedule_work(&dp->work); 807 + if (!alt->mode_selection) { 808 + dp->state = plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER; 809 + schedule_work(&dp->work); 810 + } 809 811 810 812 return 0; 811 813 }
+1 -1
drivers/usb/typec/altmodes/thunderbolt.c
··· 307 307 typec_altmode_set_drvdata(alt, tbt); 308 308 typec_altmode_set_ops(alt, &tbt_altmode_ops); 309 309 310 - if (tbt_ready(alt)) { 310 + if (!alt->mode_selection && tbt_ready(alt)) { 311 311 if (tbt->plug[TYPEC_PLUG_SOP_P]) 312 312 tbt->state = TBT_STATE_SOP_P_ENTER; 313 313 else if (tbt->plug[TYPEC_PLUG_SOP_PP])
+1
drivers/usb/typec/class.c
··· 655 655 alt->adev.svid = desc->svid; 656 656 alt->adev.mode = desc->mode; 657 657 alt->adev.vdo = desc->vdo; 658 + alt->adev.mode_selection = desc->mode_selection; 658 659 alt->roles = desc->roles; 659 660 alt->id = id; 660 661
+1
include/linux/usb/typec.h
··· 155 155 /* Only used with ports */ 156 156 enum typec_port_data roles; 157 157 bool inactive; 158 + bool mode_selection; 158 159 }; 159 160 160 161 void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_revision);
+1
include/linux/usb/typec_altmode.h
··· 37 37 u32 vdo; 38 38 unsigned int active:1; 39 39 u8 priority; 40 + bool mode_selection; 40 41 41 42 char *desc; 42 43 const struct typec_altmode_ops *ops;