linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add support for Type-C mux events without port partners
@ 2021-02-05 19:51 Rajmohan Mani
  2021-02-05 19:51 ` [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux() Rajmohan Mani
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rajmohan Mani @ 2021-02-05 19:51 UTC (permalink / raw)
  To: Benson Leung, Enric Balletbo i Serra, Guenter Roeck, linux-kernel
  Cc: heikki.krogerus, pmalani, 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.

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(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
  2021-02-05 19:51 [PATCH 0/2] Add support for Type-C mux events without port partners Rajmohan Mani
@ 2021-02-05 19:51 ` Rajmohan Mani
  2021-02-05 20:07   ` Prashant Malani
  2021-02-05 19:51 ` [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners Rajmohan Mani
  2021-02-06  0:59 ` [PATCH 0/2] Add support for Type-C mux events without port partners Benson Leung
  2 siblings, 1 reply; 9+ messages in thread
From: Rajmohan Mani @ 2021-02-05 19:51 UTC (permalink / raw)
  To: Benson Leung, Enric Balletbo i Serra, Guenter Roeck, linux-kernel
  Cc: heikki.krogerus, pmalani, 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 <rajmohan.mani@intel.com>
---
 drivers/platform/chrome/cros_ec_typec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index e724a5eaef1c..3d8ff3f8a514 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
  2021-02-05 19:51 [PATCH 0/2] Add support for Type-C mux events without port partners Rajmohan Mani
  2021-02-05 19:51 ` [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux() Rajmohan Mani
@ 2021-02-05 19:51 ` Rajmohan Mani
  2021-02-05 20:05   ` Prashant Malani
  2021-02-06  0:59 ` [PATCH 0/2] Add support for Type-C mux events without port partners Benson Leung
  2 siblings, 1 reply; 9+ messages in thread
From: Rajmohan Mani @ 2021-02-05 19:51 UTC (permalink / raw)
  To: Benson Leung, Enric Balletbo i Serra, Guenter Roeck, linux-kernel
  Cc: heikki.krogerus, pmalani, 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 <rajmohan.mani@intel.com>
---
 drivers/platform/chrome/cros_ec_typec.c | 26 ++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 3d8ff3f8a514..d89fe51b74b1 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -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;
 
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
  2021-02-05 19:51 ` [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners Rajmohan Mani
@ 2021-02-05 20:05   ` Prashant Malani
  2021-02-05 20:06     ` Prashant Malani
  0 siblings, 1 reply; 9+ messages in thread
From: Prashant Malani @ 2021-02-05 20:05 UTC (permalink / raw)
  To: Rajmohan Mani
  Cc: Benson Leung, Enric Balletbo i Serra, Guenter Roeck,
	Linux Kernel Mailing List, Heikki Krogerus

Hi Raj,

On Fri, Feb 5, 2021 at 11:52 AM Rajmohan Mani <rajmohan.mani@intel.com> wrote:
>
> 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 <rajmohan.mani@intel.com>
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:

Reviewed-by: Prashant Malani <pmalani@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners
  2021-02-05 20:05   ` Prashant Malani
@ 2021-02-05 20:06     ` Prashant Malani
  0 siblings, 0 replies; 9+ messages in thread
From: Prashant Malani @ 2021-02-05 20:06 UTC (permalink / raw)
  To: Rajmohan Mani
  Cc: Benson Leung, Enric Balletbo i Serra, Guenter Roeck,
	Linux Kernel Mailing List, Heikki Krogerus

On Fri, Feb 5, 2021 at 12:05 PM Prashant Malani <pmalani@chromium.org> wrote:
>
> Hi Raj,
>
> On Fri, Feb 5, 2021 at 11:52 AM Rajmohan Mani <rajmohan.mani@intel.com> wrote:
> >
> > 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 <rajmohan.mani@intel.com>
> 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.

> But otherwise LGTM, so:
>
> Reviewed-by: Prashant Malani <pmalani@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
  2021-02-05 19:51 ` [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux() Rajmohan Mani
@ 2021-02-05 20:07   ` Prashant Malani
  2021-02-05 22:56     ` Mani, Rajmohan
  0 siblings, 1 reply; 9+ messages in thread
From: Prashant Malani @ 2021-02-05 20:07 UTC (permalink / raw)
  To: Rajmohan Mani
  Cc: Benson Leung, Enric Balletbo i Serra, Guenter Roeck,
	Linux Kernel Mailing List, Heikki Krogerus

Hi Raj,

On Fri, Feb 5, 2021 at 11:52 AM Rajmohan Mani <rajmohan.mani@intel.com> wrote:
>
> 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 <rajmohan.mani@intel.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>

> ---
>  drivers/platform/chrome/cros_ec_typec.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index e724a5eaef1c..3d8ff3f8a514 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
  2021-02-05 20:07   ` Prashant Malani
@ 2021-02-05 22:56     ` Mani, Rajmohan
  0 siblings, 0 replies; 9+ messages in thread
From: Mani, Rajmohan @ 2021-02-05 22:56 UTC (permalink / raw)
  To: Prashant Malani
  Cc: Benson Leung, Enric Balletbo i Serra, Guenter Roeck,
	Linux Kernel Mailing List, Heikki Krogerus

Hi Prashant,

> -----Original Message-----
> From: Prashant Malani <pmalani@chromium.org>
> Sent: Friday, February 05, 2021 12:07 PM
> To: Mani, Rajmohan <rajmohan.mani@intel.com>
> Cc: Benson Leung <bleung@chromium.org>; Enric Balletbo i Serra
> <enric.balletbo@collabora.com>; Guenter Roeck <groeck@chromium.org>;
> Linux Kernel Mailing List <linux-kernel@vger.kernel.org>; Heikki Krogerus
> <heikki.krogerus@linux.intel.com>
> Subject: Re: [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner
> check in configure_mux()
> 
> Hi Raj,
> 
> On Fri, Feb 5, 2021 at 11:52 AM Rajmohan Mani
> <rajmohan.mani@intel.com> wrote:
> >
> > 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 <rajmohan.mani@intel.com>
> Reviewed-by: Prashant Malani <pmalani@chromium.org>
> 

Thanks for the review of the patch series.

> > ---
> >  drivers/platform/chrome/cros_ec_typec.c | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/drivers/platform/chrome/cros_ec_typec.c
> > b/drivers/platform/chrome/cros_ec_typec.c
> > index e724a5eaef1c..3d8ff3f8a514 100644
> > --- a/drivers/platform/chrome/cros_ec_typec.c
> > +++ b/drivers/platform/chrome/cros_ec_typec.c
> > @@ -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
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Add support for Type-C mux events without port partners
  2021-02-05 19:51 [PATCH 0/2] Add support for Type-C mux events without port partners Rajmohan Mani
  2021-02-05 19:51 ` [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux() Rajmohan Mani
  2021-02-05 19:51 ` [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners Rajmohan Mani
@ 2021-02-06  0:59 ` Benson Leung
  2021-02-06  1:26   ` Mani, Rajmohan
  2 siblings, 1 reply; 9+ messages in thread
From: Benson Leung @ 2021-02-06  0:59 UTC (permalink / raw)
  To: Guenter Roeck, Enric Balletbo i Serra, linux-kernel, Rajmohan Mani
  Cc: heikki.krogerus, pmalani

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

Hi Rajmohan,

On Fri, 5 Feb 2021 11:51:11 -0800, Rajmohan Mani wrote:
> 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: b4b06c97729547d03a8f49c6774c8bd69150ea4d

Best regards,
-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/2] Add support for Type-C mux events without port partners
  2021-02-06  0:59 ` [PATCH 0/2] Add support for Type-C mux events without port partners Benson Leung
@ 2021-02-06  1:26   ` Mani, Rajmohan
  0 siblings, 0 replies; 9+ messages in thread
From: Mani, Rajmohan @ 2021-02-06  1:26 UTC (permalink / raw)
  To: Benson Leung, Guenter Roeck, Enric Balletbo i Serra, linux-kernel
  Cc: heikki.krogerus, pmalani

Hi Benson,

> Subject: Re: [PATCH 0/2] Add support for Type-C mux events without port
> partners
> 
> Hi Rajmohan,
> 
> On Fri, 5 Feb 2021 11:51:11 -0800, Rajmohan Mani wrote:
> > 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!
> 

Thanks for the quick review / follow up.

...

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-06  4:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 19:51 [PATCH 0/2] Add support for Type-C mux events without port partners Rajmohan Mani
2021-02-05 19:51 ` [PATCH 1/2] platform/chrome: cros_ec_typec: Skip port partner check in configure_mux() Rajmohan Mani
2021-02-05 20:07   ` Prashant Malani
2021-02-05 22:56     ` Mani, Rajmohan
2021-02-05 19:51 ` [PATCH 2/2] platform/chrome: cros_ec_types: Support disconnect events without partners Rajmohan Mani
2021-02-05 20:05   ` Prashant Malani
2021-02-05 20:06     ` Prashant Malani
2021-02-06  0:59 ` [PATCH 0/2] Add support for Type-C mux events without port partners Benson Leung
2021-02-06  1:26   ` Mani, Rajmohan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).