{
const struct typec_altmode *altmode = NULL;
u64 command;
+ u16 svid = 0;
int ret;
u8 cur;
int i;
for (i = 0; con->partner_altmode[i]; i++)
typec_altmode_update_active(con->partner_altmode[i],
con->partner_altmode[i] == altmode);
+
+ if (altmode)
+ svid = altmode->svid;
+ typec_altmode_state_update(con->partner, svid, 0);
}
static int ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
desc.vdo = alt[j].mid;
desc.svid = alt[j].svid;
desc.roles = TYPEC_PORT_DRD;
+ desc.mode_selection = con->ucsi->ops->add_partner_altmodes &&
+ !con->typec_cap.no_mode_control;
ret = ucsi_register_altmode(con, &desc, recipient);
if (ret)
if (con->partner_altmode[0]) {
num_partner_am = ucsi_get_num_altmode(con->partner_altmode);
typec_partner_set_num_altmodes(con->partner, num_partner_am);
+ if (con->ucsi->ops->add_partner_altmodes)
+ con->ucsi->ops->add_partner_altmodes(con);
ucsi_altmode_update_active(con);
return 0;
} else {
return;
typec_set_mode(con->port, TYPEC_STATE_SAFE);
+ if (con->ucsi->ops->remove_partner_altmodes)
+ con->ucsi->ops->remove_partner_altmodes(con);
typec_partner_set_usb_power_delivery(con->partner, NULL);
ucsi_unregister_partner_pdos(con);
cap->driver_data = con;
cap->ops = &ucsi_ops;
+ cap->no_mode_control = !(con->ucsi->cap.features & UCSI_CAP_ALT_MODE_OVERRIDE);
if (ucsi->version >= UCSI_VERSION_2_0)
con->typec_cap.orientation_aware = true;
* @update_altmodes: Squashes duplicate DP altmodes
* @update_connector: Update connector capabilities before registering
* @connector_status: Updates connector status, called holding connector lock
+ * @add_partner_altmodes: Start mode selection
+ * @remove_partner_altmodes: Clean mode selection
*
* Read and write routines for UCSI interface. @sync_write must wait for the
* Command Completion Event from the PPM before returning, and @async_write must
struct ucsi_altmode *updated);
void (*update_connector)(struct ucsi_connector *con);
void (*connector_status)(struct ucsi_connector *con);
+ void (*add_partner_altmodes)(struct ucsi_connector *con);
+ void (*remove_partner_altmodes)(struct ucsi_connector *con);
};
struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops);