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: 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>

authored by

Neil Armstrong and committed by
Greg Kroah-Hartman
25a2bc21 aed1a2a5

+17
+17
drivers/usb/typec/ucsi/ucsi.c
··· 809 809 break; 810 810 } 811 811 812 + if (con->status.flags & UCSI_CONSTAT_CONNECTED) { 813 + switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) { 814 + case UCSI_CONSTAT_PARTNER_TYPE_DEBUG: 815 + typec_set_mode(con->port, TYPEC_MODE_DEBUG); 816 + break; 817 + case UCSI_CONSTAT_PARTNER_TYPE_AUDIO: 818 + typec_set_mode(con->port, TYPEC_MODE_AUDIO); 819 + break; 820 + default: 821 + if (UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) == 822 + UCSI_CONSTAT_PARTNER_FLAG_USB) 823 + typec_set_mode(con->port, TYPEC_STATE_USB); 824 + } 825 + } else { 826 + typec_set_mode(con->port, TYPEC_STATE_SAFE); 827 + } 828 + 812 829 /* Only notify USB controller if partner supports USB data */ 813 830 if (!(UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) & UCSI_CONSTAT_PARTNER_FLAG_USB)) 814 831 u_role = USB_ROLE_NONE;