usb: typec: ucsi: call typec_set_mode on non-altmode partner change
Add support for calling typec_set_mode() for the DEBUG, AUDIO accessory modes. Let's also call typec_set_mode() for USB as default and SAFE when partner is disconnected. The USB state is only called when ALT mode is specifically not specified by the partner status flags in order to leave the altmode handlers setup the proper mode to switches, muxes and retimers. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230614-topic-sm8550-upstream-type-c-audio-v1-1-15a92565146b@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
aed1a2a5a6
commit
25a2bc21c8
@ -809,6 +809,23 @@ static void ucsi_partner_change(struct ucsi_connector *con)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (con->status.flags & UCSI_CONSTAT_CONNECTED) {
|
||||||
|
switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
|
||||||
|
case UCSI_CONSTAT_PARTNER_TYPE_DEBUG:
|
||||||
|
typec_set_mode(con->port, TYPEC_MODE_DEBUG);
|
||||||
|
break;
|
||||||
|
case UCSI_CONSTAT_PARTNER_TYPE_AUDIO:
|
||||||
|
typec_set_mode(con->port, TYPEC_MODE_AUDIO);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) ==
|
||||||
|
UCSI_CONSTAT_PARTNER_FLAG_USB)
|
||||||
|
typec_set_mode(con->port, TYPEC_STATE_USB);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
typec_set_mode(con->port, TYPEC_STATE_SAFE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Only notify USB controller if partner supports USB data */
|
/* Only notify USB controller if partner supports USB data */
|
||||||
if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) & UCSI_CONSTAT_PARTNER_FLAG_USB))
|
if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) & UCSI_CONSTAT_PARTNER_FLAG_USB))
|
||||||
u_role = USB_ROLE_NONE;
|
u_role = USB_ROLE_NONE;
|
||||||
|
Loading…
Reference in New Issue
Block a user