* [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
@ 2020-04-02 21:59 Badhri Jagan Sridharan
2020-04-14 12:04 ` Heikki Krogerus
2020-04-16 12:54 ` Heikki Krogerus
0 siblings, 2 replies; 4+ messages in thread
From: Badhri Jagan Sridharan @ 2020-04-02 21:59 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan
After PORT_RESET, the port is set to the appropriate
default_state. Ignore processing CC changes here as this
could cause the port to be switched into sink states
by default.
echo source > /sys/class/typec/port0/port_type
Before:
[ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
[ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected]
[ 154.528564] state change PORT_RESET -> SNK_UNATTACHED
After:
[ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS]
[ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
[ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
[ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS]
[ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms]
[ 152.060118] Start toggling
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index de3576e6530ab2..82b19ebd7838e0 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
*/
break;
+ case PORT_RESET:
+ case PORT_RESET_WAIT_OFF:
+ /*
+ * State set back to default mode once the timer completes.
+ * Ignore CC changes here.
+ */
+ break;
+
default:
if (tcpm_port_is_disconnected(port))
tcpm_set_state(port, unattached_state(port), 0);
@@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
case SRC_TRY_DEBOUNCE:
/* Do nothing, waiting for sink detection */
break;
+
+ case PORT_RESET:
+ case PORT_RESET_WAIT_OFF:
+ /*
+ * State set back to default mode once the timer completes.
+ * Ignore vbus changes here.
+ */
+ break;
+
default:
break;
}
@@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
case PORT_RESET_WAIT_OFF:
tcpm_set_state(port, tcpm_default_state(port), 0);
break;
+
case SRC_TRY_WAIT:
case SRC_TRY_DEBOUNCE:
/* Do nothing, waiting for sink detection */
break;
+
+ case PORT_RESET:
+ /*
+ * State set back to default mode once the timer completes.
+ * Ignore vbus changes here.
+ */
+ break;
+
default:
if (port->pwr_role == TYPEC_SINK &&
port->attached)
--
2.26.0.292.g33ef6b2f38-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
2020-04-02 21:59 [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change Badhri Jagan Sridharan
@ 2020-04-14 12:04 ` Heikki Krogerus
2020-04-14 20:05 ` Guenter Roeck
2020-04-16 12:54 ` Heikki Krogerus
1 sibling, 1 reply; 4+ messages in thread
From: Heikki Krogerus @ 2020-04-14 12:04 UTC (permalink / raw)
To: Badhri Jagan Sridharan, Guenter Roeck
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Thu, Apr 02, 2020 at 02:59:47PM -0700, Badhri Jagan Sridharan wrote:
> After PORT_RESET, the port is set to the appropriate
> default_state. Ignore processing CC changes here as this
> could cause the port to be switched into sink states
> by default.
>
> echo source > /sys/class/typec/port0/port_type
>
> Before:
> [ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
> [ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 154.528564] state change PORT_RESET -> SNK_UNATTACHED
>
> After:
> [ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS]
> [ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
> [ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS]
> [ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms]
> [ 152.060118] Start toggling
Guenter, can you take a look at this?
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index de3576e6530ab2..82b19ebd7838e0 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
> */
> break;
>
> + case PORT_RESET:
> + case PORT_RESET_WAIT_OFF:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore CC changes here.
> + */
> + break;
> +
> default:
> if (tcpm_port_is_disconnected(port))
> tcpm_set_state(port, unattached_state(port), 0);
> @@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
> case SRC_TRY_DEBOUNCE:
> /* Do nothing, waiting for sink detection */
> break;
> +
> + case PORT_RESET:
> + case PORT_RESET_WAIT_OFF:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore vbus changes here.
> + */
> + break;
> +
> default:
> break;
> }
> @@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
> case PORT_RESET_WAIT_OFF:
> tcpm_set_state(port, tcpm_default_state(port), 0);
> break;
> +
> case SRC_TRY_WAIT:
> case SRC_TRY_DEBOUNCE:
> /* Do nothing, waiting for sink detection */
> break;
> +
> + case PORT_RESET:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore vbus changes here.
> + */
> + break;
> +
> default:
> if (port->pwr_role == TYPEC_SINK &&
> port->attached)
> --
> 2.26.0.292.g33ef6b2f38-goog
thanks,
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
2020-04-14 12:04 ` Heikki Krogerus
@ 2020-04-14 20:05 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-04-14 20:05 UTC (permalink / raw)
To: Heikki Krogerus, Badhri Jagan Sridharan
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On 4/14/20 5:04 AM, Heikki Krogerus wrote:
> On Thu, Apr 02, 2020 at 02:59:47PM -0700, Badhri Jagan Sridharan wrote:
>> After PORT_RESET, the port is set to the appropriate
>> default_state. Ignore processing CC changes here as this
>> could cause the port to be switched into sink states
>> by default.
>>
>> echo source > /sys/class/typec/port0/port_type
>>
>> Before:
>> [ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
>> [ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected]
>> [ 154.528564] state change PORT_RESET -> SNK_UNATTACHED
>>
>> After:
>> [ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS]
>> [ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
>> [ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
>> [ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS]
>> [ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms]
>> [ 152.060118] Start toggling
>
> Guenter, can you take a look at this?
>
Sorry, looks like I missed the original patch. Makes sense to me.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
>> ---
>> drivers/usb/typec/tcpm/tcpm.c | 26 ++++++++++++++++++++++++++
>> 1 file changed, 26 insertions(+)
>>
>> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
>> index de3576e6530ab2..82b19ebd7838e0 100644
>> --- a/drivers/usb/typec/tcpm/tcpm.c
>> +++ b/drivers/usb/typec/tcpm/tcpm.c
>> @@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
>> */
>> break;
>>
>> + case PORT_RESET:
>> + case PORT_RESET_WAIT_OFF:
>> + /*
>> + * State set back to default mode once the timer completes.
>> + * Ignore CC changes here.
>> + */
>> + break;
>> +
>> default:
>> if (tcpm_port_is_disconnected(port))
>> tcpm_set_state(port, unattached_state(port), 0);
>> @@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
>> case SRC_TRY_DEBOUNCE:
>> /* Do nothing, waiting for sink detection */
>> break;
>> +
>> + case PORT_RESET:
>> + case PORT_RESET_WAIT_OFF:
>> + /*
>> + * State set back to default mode once the timer completes.
>> + * Ignore vbus changes here.
>> + */
>> + break;
>> +
>> default:
>> break;
>> }
>> @@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
>> case PORT_RESET_WAIT_OFF:
>> tcpm_set_state(port, tcpm_default_state(port), 0);
>> break;
>> +
>> case SRC_TRY_WAIT:
>> case SRC_TRY_DEBOUNCE:
>> /* Do nothing, waiting for sink detection */
>> break;
>> +
>> + case PORT_RESET:
>> + /*
>> + * State set back to default mode once the timer completes.
>> + * Ignore vbus changes here.
>> + */
>> + break;
>> +
>> default:
>> if (port->pwr_role == TYPEC_SINK &&
>> port->attached)
>> --
>> 2.26.0.292.g33ef6b2f38-goog
>
> thanks,
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
2020-04-02 21:59 [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change Badhri Jagan Sridharan
2020-04-14 12:04 ` Heikki Krogerus
@ 2020-04-16 12:54 ` Heikki Krogerus
1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2020-04-16 12:54 UTC (permalink / raw)
To: Badhri Jagan Sridharan; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Thu, Apr 02, 2020 at 02:59:47PM -0700, Badhri Jagan Sridharan wrote:
> After PORT_RESET, the port is set to the appropriate
> default_state. Ignore processing CC changes here as this
> could cause the port to be switched into sink states
> by default.
>
> echo source > /sys/class/typec/port0/port_type
>
> Before:
> [ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
> [ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 154.528564] state change PORT_RESET -> SNK_UNATTACHED
>
> After:
> [ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS]
> [ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
> [ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS]
> [ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms]
> [ 152.060118] Start toggling
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index de3576e6530ab2..82b19ebd7838e0 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
> */
> break;
>
> + case PORT_RESET:
> + case PORT_RESET_WAIT_OFF:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore CC changes here.
> + */
> + break;
> +
> default:
> if (tcpm_port_is_disconnected(port))
> tcpm_set_state(port, unattached_state(port), 0);
> @@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
> case SRC_TRY_DEBOUNCE:
> /* Do nothing, waiting for sink detection */
> break;
> +
> + case PORT_RESET:
> + case PORT_RESET_WAIT_OFF:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore vbus changes here.
> + */
> + break;
> +
> default:
> break;
> }
> @@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
> case PORT_RESET_WAIT_OFF:
> tcpm_set_state(port, tcpm_default_state(port), 0);
> break;
> +
> case SRC_TRY_WAIT:
> case SRC_TRY_DEBOUNCE:
> /* Do nothing, waiting for sink detection */
> break;
> +
> + case PORT_RESET:
> + /*
> + * State set back to default mode once the timer completes.
> + * Ignore vbus changes here.
> + */
> + break;
> +
> default:
> if (port->pwr_role == TYPEC_SINK &&
> port->attached)
> --
> 2.26.0.292.g33ef6b2f38-goog
thanks,
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-16 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-02 21:59 [PATCH v1] usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change Badhri Jagan Sridharan
2020-04-14 12:04 ` Heikki Krogerus
2020-04-14 20:05 ` Guenter Roeck
2020-04-16 12:54 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox