Add support for Type-C mux events without port partners
cover Add support for Type-C mux events without port partners
There are cases, where support for Type-C mux events is needed, that does not have port partners.
Enabling communication to a retimer connected to an USB4 port, when no devices are attached, is a case that requires support for handling Type-C mux events without port partners.
The following patches[1] are needed on top of the mainline kernel to be able to verify these patches.
commit 8553a979fcd0 ("platform/chrome: cros_ec_typec: Send mux
configuration acknowledgment to EC")
commit ba8ce515454e ("platform/chrome: cros_ec_typec: Parameterize
cros_typec_cmds_supported()")
commit 156309096542 ("platform/chrome: cros_ec_typec: Register plug
altmodes")
commit f4edab68e101 ("platform/chrome: cros_ec_typec: Register SOP'
cable plug")
commit 599229763911 ("platform/chrome: cros_ec_typec: Set partner
num_altmodes")
commit 72d6e32bd85b ("platform/chrome: cros_ec_typec: Store cable plug
type")
commit 8b46a212ad11 ("platform/chrome: cros_ec_typec: Register cable") commit c097f229b71e ("platform/chrome: cros_ec_typec: Rename discovery
struct")
commit 8fab2755191f ("platform/chrome: cros_ec_typec: Factor out PD
identity parsing")
commit a906f45d1480 ("platform/chrome: cros_ec_typec: Make disc_done
flag partner-only")
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/
linux.git/log/?h=cros-ec-typec-for-5.12
Rajmohan Mani (2):
platform/chrome: cros_ec_typec: Skip port partner check in
configure_mux()
platform/chrome: cros_ec_types: Support disconnect events without
partners
drivers/platform/chrome/cros_ec_typec.c | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
Signature · 1 line
2.30.0
PATCH 1/2 platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
For certain needs like updating the USB4 retimer firmware when no device are connected, the Type-C ports require mux configuration, to be able to communicate with the retimer. So removed the above check to allow for mux configuration of Type-C ports, to enable retimer communication.
--- drivers/platform/chrome/cros_ec_typec.c | 3 --- 1 file changed, 3 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +0 -3
@@ -536,9 +536,6 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,enum typec_orientation orientation;int ret; -if (!port->partner) -return 0 ; -if (mux_flags &USB_PD_MUX_POLARITY_INVERTED ) orientation =TYPEC_ORIENTATION_REVERSE ;else
Signature · 1 line
2.30.0
Re: [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
Hi Raj,
Quoted 8 lines · Rajmohan Mani
For certain needs like updating the USB4 retimer firmware when no device are connected, the Type-C ports require mux configuration, to be able to communicate with the retimer. So removed the above check to allow for mux configuration of Type-C ports, to enable retimer communication.
Signed-off-by Rajmohan Mani <[email protected]>
Quoted 21 lines
--- drivers/platform/chrome/cros_ec_typec.c | 3 --- 1 file changed, 3 deletions(-)drivers/platform/chrome/cros_ec_typec.c +0
-4@@ -536,9 +536,6 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,enum typec_orientation orientation;int ret; -if (!port->partner) -return 0 ; -if (mux_flags &USB_PD_MUX_POLARITY_INVERTED ) orientation =TYPEC_ORIENTATION_REVERSE ;else --2.30.0
RE: [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
Hi Prashant,
Quoted 16 lines
-----Original Message-----
From: Prashant Malani <[email protected]>
Sent: Friday, February 05, 2021 12:07 PM
To: Mani, Rajmohan <[email protected]>
Cc: Benson Leung <[email protected]>; Enric Balletbo i Serra <[email protected]>; Guenter Roeck <[email protected]>; Linux Kernel Mailing List <[email protected]>; Heikki Krogerus <[email protected]>
Subject: Re: [PATCH 1/2] platform/chrome:cros_ec_typec: Skip port partner check inconfigure_mux()Hi Raj,
Quoted 1 line · Rajmohan Mani
Quoted 9 lines
Quoted 7 lines
For certain needs like updating the USB4 retimer firmware when no device are connected, the Type-C ports require mux configuration, to be able to communicate with the retimer. So removed the above check to allow for mux configuration of Type-C ports, to enable retimer communication.
Signed-off-by Rajmohan Mani <[email protected]>Reviewed-by Prashant Malani <[email protected]>
Thanks for the review of the patch series.
Quoted 23 lines
drivers/platform/chrome/cros_ec_typec.c static int cros_typec_configure_mux(struct
Quoted 10 lines
--- drivers/platform/chrome/cros_ec_typec.c | 3 --- 1 file changed, 3 deletions(-)drivers/platform/chrome/cros_ec_typec.c +0
-0@@ -536,9 +536,6 @@ static int cros_typec_configure_mux(struct
cros_typec_data*typec, intport_num,Quoted 12 lines
drivers/platform/chrome/cros_ec_typec.c +0
-4enum typec_orientation orientation;int ret; -if (!port->partner) -return 0 ; -if (mux_flags &USB_PD_MUX_POLARITY_INVERTED ) orientation =TYPEC_ORIENTATION_REVERSE ;else --2.30.0
PATCH 2/2 platform/chrome: cros_ec_types: Support disconnect events without partners
In reply to Rajmohan ManiThere are certain scenarios, where a disconnect event might occur on a Type-C port with no port partners. This is required to enable communication to Burnside Bridge USB4 retimers.
--- drivers/platform/chrome/cros_ec_typec.c | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +19 -7
@@ -203,20 +203,26 @@ static void cros_typec_unregister_altmodes(struct cros_typec_data *typec, int po } } -static void cros_typec_remove_partner (struct cros_typec_data *typec, -int port_num) +static int cros_typec_usb_disconnect_state (struct cros_typec_port *port) { -struct cros_typec_port *port = typec->ports[port_num]; - -cros_typec_unregister_altmodes (typec, port_num, true); - port->state.alt =NULL ; port->state.mode =TYPEC_STATE_USB ; port->state.data =NULL ;usb_role_switch_set_role (port->role_sw,USB_ROLE_NONE );typec_switch_set (port->ori_sw,TYPEC_ORIENTATION_NONE ); -typec_mux_set (port->mux, &port->state); + +return typec_mux_set (port->mux, &port->state); +} + +static void cros_typec_remove_partner (struct cros_typec_data *typec, +int port_num) +{ +struct cros_typec_port *port = typec->ports[port_num]; + +cros_typec_unregister_altmodes (typec, port_num, true); + +cros_typec_usb_disconnect_state (port);typec_unregister_partner (port->partner); port->partner =NULL ;
@@ -536,6 +542,11 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,enum typec_orientation orientation;int ret; +if (mux_flags ==USB_PD_MUX_NONE ) { + ret =cros_typec_usb_disconnect_state (port); + goto mux_ack; + } +if (mux_flags &USB_PD_MUX_POLARITY_INVERTED ) orientation =TYPEC_ORIENTATION_REVERSE ;else
@@ -569,6 +580,7 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num, mux_flags); } +mux_ack:if (!typec->needs_mux_ack)return ret;
Signature · 1 line
2.30.0
Re: [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
Hi Raj,
Quoted 6 lines · Rajmohan Mani
There are certain scenarios, where a disconnect event might occur on a Type-C port with no port partners. This is required to enable communication to Burnside Bridge USB4 retimers.
Signed-off-by Rajmohan Mani <[email protected]>
minor commit message nit (apologies for not spotting this earlier):
This patch alone doesn't add support for the "without partners" part (that comes in the next patch).
This one purely adds support for disconnect events. So might be good to update the commit message if possible.
But otherwise LGTM, so:
Re: [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
Quoted 9 lines · Prashant Malani
Hi Raj,
Quoted 5 lines · Rajmohan Mani
There are certain scenarios, where a disconnect event might occur on a Type-C port with no port partners. This is required to enable communication to Burnside Bridge USB4 retimers.
Quoted 7 lines
Quoted 1 line
Signed-off-by Rajmohan Mani <[email protected]>minor commit message nit (apologies for not spotting this earlier):
This patch alone doesn't add support for the "without partners" part (that comes in the next patch).
This one purely adds support for disconnect events. So might be good to update the commit message if possible.
Sorry, I just noticed that I interpreted the ordering of the patches incorrectly, so this commit message is fine as is and I retract my nit.
Quoted 3 lines
But otherwise LGTM, so:
Reviewed-by Prashant Malani <[email protected]>
Benson Leung
AppliedHi Rajmohan,
Quoted 10 lines · Rajmohan Mani
There are cases, where support for Type-C mux events is needed, that does not have port partners.
Enabling communication to a retimer connected to an USB4 port, when no devices are attached, is a case that requires support for handling Type-C mux events without port partners.The following patches[1] are needed on top of the mainline kernel to be able to verify these patches.
[...]
Applied, thanks!
[1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
commit: 38f56061c892c237ad4ee733cf3981a84f6b6aea
[2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
commit: b4b06c97729547d03a8f49c6774c8bd69150ea4dBest regards,
Signature · 7 lines
Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. [email protected] Chromium OS Project [email protected]
Hi Benson,
Quoted 12 lines
Subject: Re: [PATCH 0/2] Add support for Type-C mux events without port partners
Hi Rajmohan,
Quoted 6 lines · Rajmohan Mani
There are cases, where support for Type-C mux events is needed, that does not have port partners.
Enabling communication to a retimer connected to an USB4 port, when no devices are attached, is a case that requires support for handling Type-C mux events without port partners.
Quoted 7 lines
Quoted 4 lines
The following patches[1] are needed on top of the mainline kernel to be able to verify these patches.
[...]
Applied, thanks!
Thanks for the quick review / follow up.
...