Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1720755 > unrolled thread
| Started by | Badhri Jagan Sridharan <badhri@google.com> |
|---|---|
| First post | 2017-08-27 08:40 +0200 |
| Last post | 2017-08-27 19:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 07/11] staging: typec: tcpm: Consider port_type while determining unattached_state Badhri Jagan Sridharan <badhri@google.com> - 2017-08-27 08:40 +0200
Re: [PATCH 07/11] staging: typec: tcpm: Consider port_type while determining unattached_state Guenter Roeck <linux@roeck-us.net> - 2017-08-27 19:30 +0200
| From | Badhri Jagan Sridharan <badhri@google.com> |
|---|---|
| Date | 2017-08-27 08:40 +0200 |
| Subject | [PATCH 07/11] staging: typec: tcpm: Consider port_type while determining unattached_state |
| Message-ID | <uiZoJ-3VU-5@gated-at.bofh.it> |
While performing PORT_RESET, upon receiving the cc disconnect
signal from the underlaying tcpc device, TCPM transitions into
unattached state. Consider, the current type of port while determining
the unattached state.
In the below logs, although the port_type was set to sink, TCPM
transitioned into SRC_UNATTACHED.
[ 762.290654] state change SRC_READY -> PORT_RESET
[ 762.324531] Setting voltage/current limit 0 mV 0 mA
[ 762.327912] polarity 0
[ 762.334864] cc:=0
[ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
[ 762.347200] VBUS off
[ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
[ 762.347206] state change PORT_RESET -> SRC_UNATTACHED
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
drivers/staging/typec/tcpm.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 0ae33330a5c7..645f43ee83df 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port)
static inline enum tcpm_state unattached_state(struct tcpm_port *port)
{
- if (port->pwr_role == TYPEC_SOURCE)
+ if (port->port_type == TYPEC_PORT_DRP) {
+ if (port->pwr_role == TYPEC_SOURCE)
+ return SRC_UNATTACHED;
+ else
+ return SNK_UNATTACHED;
+ } else if (port->port_type == TYPEC_PORT_DFP) {
return SRC_UNATTACHED;
- else
- return SNK_UNATTACHED;
+ }
+
+ return SNK_UNATTACHED;
}
static void tcpm_check_send_discover(struct tcpm_port *port)
--
2.14.1.342.g6490525c54-goog
[toc] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2017-08-27 19:30 +0200 |
| Subject | Re: [PATCH 07/11] staging: typec: tcpm: Consider port_type while determining unattached_state |
| Message-ID | <uj9xM-2j1-29@gated-at.bofh.it> |
| In reply to | #1720755 |
On Sat, Aug 26, 2017 at 11:32:54PM -0700, Badhri Jagan Sridharan wrote:
> While performing PORT_RESET, upon receiving the cc disconnect
> signal from the underlaying tcpc device, TCPM transitions into
> unattached state. Consider, the current type of port while determining
stray ,; not really worth a resend.
> the unattached state.
>
> In the below logs, although the port_type was set to sink, TCPM
> transitioned into SRC_UNATTACHED.
>
> [ 762.290654] state change SRC_READY -> PORT_RESET
> [ 762.324531] Setting voltage/current limit 0 mV 0 mA
> [ 762.327912] polarity 0
> [ 762.334864] cc:=0
> [ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
> [ 762.347200] VBUS off
> [ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
> [ 762.347206] state change PORT_RESET -> SRC_UNATTACHED
>
> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/staging/typec/tcpm.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
> index 0ae33330a5c7..645f43ee83df 100644
> --- a/drivers/staging/typec/tcpm.c
> +++ b/drivers/staging/typec/tcpm.c
> @@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port)
>
> static inline enum tcpm_state unattached_state(struct tcpm_port *port)
> {
> - if (port->pwr_role == TYPEC_SOURCE)
> + if (port->port_type == TYPEC_PORT_DRP) {
> + if (port->pwr_role == TYPEC_SOURCE)
> + return SRC_UNATTACHED;
> + else
> + return SNK_UNATTACHED;
> + } else if (port->port_type == TYPEC_PORT_DFP) {
> return SRC_UNATTACHED;
> - else
> - return SNK_UNATTACHED;
> + }
> +
> + return SNK_UNATTACHED;
> }
>
> static void tcpm_check_send_discover(struct tcpm_port *port)
> --
> 2.14.1.342.g6490525c54-goog
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web