mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
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>
This commit is contained in:
parent
fb2abc7546
commit
be727d4000
5 changed files with 8 additions and 3 deletions
|
|
@ -804,8 +804,10 @@ int dp_altmode_probe(struct typec_altmode *alt)
|
|||
if (plug)
|
||||
typec_altmode_set_drvdata(plug, dp);
|
||||
|
||||
dp->state = plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER;
|
||||
schedule_work(&dp->work);
|
||||
if (!alt->mode_selection) {
|
||||
dp->state = plug ? DP_STATE_ENTER_PRIME : DP_STATE_ENTER;
|
||||
schedule_work(&dp->work);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ static int tbt_altmode_probe(struct typec_altmode *alt)
|
|||
typec_altmode_set_drvdata(alt, tbt);
|
||||
typec_altmode_set_ops(alt, &tbt_altmode_ops);
|
||||
|
||||
if (tbt_ready(alt)) {
|
||||
if (!alt->mode_selection && tbt_ready(alt)) {
|
||||
if (tbt->plug[TYPEC_PLUG_SOP_P])
|
||||
tbt->state = TBT_STATE_SOP_P_ENTER;
|
||||
else if (tbt->plug[TYPEC_PLUG_SOP_PP])
|
||||
|
|
|
|||
|
|
@ -655,6 +655,7 @@ typec_register_altmode(struct device *parent,
|
|||
alt->adev.svid = desc->svid;
|
||||
alt->adev.mode = desc->mode;
|
||||
alt->adev.vdo = desc->vdo;
|
||||
alt->adev.mode_selection = desc->mode_selection;
|
||||
alt->roles = desc->roles;
|
||||
alt->id = id;
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ struct typec_altmode_desc {
|
|||
/* Only used with ports */
|
||||
enum typec_port_data roles;
|
||||
bool inactive;
|
||||
bool mode_selection;
|
||||
};
|
||||
|
||||
void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_revision);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ struct typec_altmode {
|
|||
u32 vdo;
|
||||
unsigned int active:1;
|
||||
u8 priority;
|
||||
bool mode_selection;
|
||||
|
||||
char *desc;
|
||||
const struct typec_altmode_ops *ops;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue