* [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
@ 2020-11-25 2:07 Badhri Jagan Sridharan
2020-11-25 14:16 ` Guenter Roeck
2020-11-26 12:01 ` Heikki Krogerus
0 siblings, 2 replies; 4+ messages in thread
From: Badhri Jagan Sridharan @ 2020-11-25 2:07 UTC (permalink / raw)
To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan
During PR_SWAP sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON
for the vbus source to ramp up, TCPM would prematurely exit
PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a
vbus off notification is received. This should not be the case as vbus
can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source
has PD_T_NEWSRC to ramp up.
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 4aac0efdb720..277b9d4d9c84 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
/* Do nothing, expected */
break;
+ case PR_SWAP_SNK_SRC_SOURCE_ON:
+ /*
+ * Do nothing when vbus off notification is received.
+ * TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON
+ * for the vbus source to ramp up.
+ */
+ break;
+
case PORT_RESET_WAIT_OFF:
tcpm_set_state(port, tcpm_default_state(port), 0);
break;
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
2020-11-25 2:07 [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON Badhri Jagan Sridharan
@ 2020-11-25 14:16 ` Guenter Roeck
2020-11-26 12:01 ` Heikki Krogerus
1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-11-25 14:16 UTC (permalink / raw)
To: Badhri Jagan Sridharan
Cc: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel
On Tue, Nov 24, 2020 at 06:07:03PM -0800, Badhri Jagan Sridharan wrote:
> During PR_SWAP sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON
> for the vbus source to ramp up, TCPM would prematurely exit
> PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a
> vbus off notification is received. This should not be the case as vbus
> can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source
> has PD_T_NEWSRC to ramp up.
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4aac0efdb720..277b9d4d9c84 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
> /* Do nothing, expected */
> break;
>
> + case PR_SWAP_SNK_SRC_SOURCE_ON:
> + /*
> + * Do nothing when vbus off notification is received.
> + * TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON
> + * for the vbus source to ramp up.
> + */
> + break;
> +
> case PORT_RESET_WAIT_OFF:
> tcpm_set_state(port, tcpm_default_state(port), 0);
> break;
> --
> 2.29.2.454.gaff20da3a2-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
2020-11-25 2:07 [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON Badhri Jagan Sridharan
2020-11-25 14:16 ` Guenter Roeck
@ 2020-11-26 12:01 ` Heikki Krogerus
2020-11-26 12:41 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Heikki Krogerus @ 2020-11-26 12:01 UTC (permalink / raw)
To: Badhri Jagan Sridharan
Cc: Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel
On Tue, Nov 24, 2020 at 06:07:03PM -0800, Badhri Jagan Sridharan wrote:
> During PR_SWAP sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON
> for the vbus source to ramp up, TCPM would prematurely exit
> PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a
> vbus off notification is received. This should not be the case as vbus
> can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source
> has PD_T_NEWSRC to ramp up.
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
FWIW:
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4aac0efdb720..277b9d4d9c84 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
> /* Do nothing, expected */
> break;
>
> + case PR_SWAP_SNK_SRC_SOURCE_ON:
> + /*
> + * Do nothing when vbus off notification is received.
> + * TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON
> + * for the vbus source to ramp up.
> + */
> + break;
> +
> case PORT_RESET_WAIT_OFF:
> tcpm_set_state(port, tcpm_default_state(port), 0);
> break;
> --
> 2.29.2.454.gaff20da3a2-goog
thanks,
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
2020-11-26 12:01 ` Heikki Krogerus
@ 2020-11-26 12:41 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2020-11-26 12:41 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Badhri Jagan Sridharan, Guenter Roeck, linux-usb, linux-kernel
On Thu, Nov 26, 2020 at 02:01:20PM +0200, Heikki Krogerus wrote:
> On Tue, Nov 24, 2020 at 06:07:03PM -0800, Badhri Jagan Sridharan wrote:
> > During PR_SWAP sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON
> > for the vbus source to ramp up, TCPM would prematurely exit
> > PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a
> > vbus off notification is received. This should not be the case as vbus
> > can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source
> > has PD_T_NEWSRC to ramp up.
> >
> > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
>
> FWIW:
>
> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Thanks, i've added this, and your other ack, to the commits in my tree.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-26 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 2:07 [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON Badhri Jagan Sridharan
2020-11-25 14:16 ` Guenter Roeck
2020-11-26 12:01 ` Heikki Krogerus
2020-11-26 12:41 ` Greg Kroah-Hartman
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).