* [PATCH 0/5] USB: typec: various patches
@ 2020-12-10 16:05 Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
` (5 more replies)
0 siblings, 6 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, Greg Kroah-Hartman, Kyle Tso,
Badhri Jagan Sridharan, Will McVicker
In digging through a large set of proposed typec patches for the Android
common kernel, I've picked out 5 "easy" patches that should all go
upstream (they all should go upstream, just will take a while to clean
them up it seems...)
Badhri Jagan Sridharan (2):
USB: typec: tcpm: Prevent log overflow by removing old entries
USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
Kyle Tso (2):
USB: typec: tcpm: Fix PR_SWAP error handling
USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
pumahsu (1):
USB: typec: tcpm: Hard Reset after not receiving a Request
drivers/usb/typec/tcpm/tcpci.h | 1 +
drivers/usb/typec/tcpm/tcpm.c | 30 +++++++++++++++---------------
include/linux/usb/pd.h | 1 +
3 files changed, 17 insertions(+), 15 deletions(-)
--
2.29.2
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
@ 2020-12-10 16:05 ` Greg Kroah-Hartman
2020-12-10 17:42 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Greg Kroah-Hartman
` (4 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan, Kyle Tso,
Will McVicker, Greg Kroah-Hartman
From: Badhri Jagan Sridharan <badhri@google.com>
TCPM logs overflow once the logbuffer is full. Clear old entries and
allow logging the newer ones as the newer would be more relevant to the
issue being debugged.
Also, do not reset the logbuffer tail as end users might take back to
back bugreports which would result in an empty buffer.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Kyle Tso <kyletso@google.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/tcpm/tcpm.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index cedc6cf82d61..0ceeab50ed64 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -470,12 +470,6 @@ static bool tcpm_port_is_disconnected(struct tcpm_port *port)
#ifdef CONFIG_DEBUG_FS
-static bool tcpm_log_full(struct tcpm_port *port)
-{
- return port->logbuffer_tail ==
- (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
-}
-
__printf(2, 0)
static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
{
@@ -495,11 +489,6 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args);
- if (tcpm_log_full(port)) {
- port->logbuffer_head = max(port->logbuffer_head - 1, 0);
- strcpy(tmpbuffer, "overflow");
- }
-
if (port->logbuffer_head < 0 ||
port->logbuffer_head >= LOG_BUFFER_ENTRIES) {
dev_warn(port->dev,
@@ -519,6 +508,9 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
(unsigned long)ts_nsec, rem_nsec / 1000,
tmpbuffer);
port->logbuffer_head = (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
+ if (port->logbuffer_head == port->logbuffer_tail)
+ port->logbuffer_tail =
+ (port->logbuffer_tail + 1) % LOG_BUFFER_ENTRIES;
abort:
mutex_unlock(&port->logbuffer_lock);
@@ -622,8 +614,6 @@ static int tcpm_debug_show(struct seq_file *s, void *v)
seq_printf(s, "%s\n", port->logbuffer[tail]);
tail = (tail + 1) % LOG_BUFFER_ENTRIES;
}
- if (!seq_has_overflowed(s))
- port->logbuffer_tail = tail;
mutex_unlock(&port->logbuffer_lock);
return 0;
--
2.29.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
@ 2020-12-10 16:05 ` Greg Kroah-Hartman
2020-12-10 17:43 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling Greg Kroah-Hartman
` (3 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, pumahsu, Badhri Jagan Sridharan,
Kyle Tso, Will McVicker, Greg Kroah-Hartman
From: pumahsu <pumahsu@google.com>
PD 3.0 spec 8.3.3.2.3, A Get_Source_Cap message is sent
to a UUT that is in the PE_SRC_Ready state. After sending
a Source_Capabilities message, the UUT should then expect
a Request message in response. When one is not received,
the UUT should timeout to PE_SRC_Hard_Reset.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: pumahsu <pumahsu@google.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/tcpm/tcpm.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0ceeab50ed64..0efda59bb104 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -2218,6 +2218,7 @@ static int tcpm_pd_send_control(struct tcpm_port *port,
static bool tcpm_send_queued_message(struct tcpm_port *port)
{
enum pd_msg_request queued_message;
+ int ret;
do {
queued_message = port->queued_message;
@@ -2237,7 +2238,16 @@ static bool tcpm_send_queued_message(struct tcpm_port *port)
tcpm_pd_send_sink_caps(port);
break;
case PD_MSG_DATA_SOURCE_CAP:
- tcpm_pd_send_source_caps(port);
+ ret = tcpm_pd_send_source_caps(port);
+ if (ret < 0) {
+ tcpm_log(port,
+ "Unable to send src caps, ret=%d",
+ ret);
+ tcpm_set_state(port, SOFT_RESET_SEND, 0);
+ } else if (port->pwr_role == TYPEC_SOURCE) {
+ tcpm_set_state(port, HARD_RESET_SEND,
+ PD_T_SENDER_RESPONSE);
+ }
break;
default:
break;
--
2.29.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Greg Kroah-Hartman
@ 2020-12-10 16:05 ` Greg Kroah-Hartman
2020-12-10 17:43 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Greg Kroah-Hartman
` (2 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, Kyle Tso, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman
From: Kyle Tso <kyletso@google.com>
PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
The Policy Enging Shall transition to the ErrorRecovery state when the
PSSourceOnTimer times out ...
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/tcpm/tcpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0efda59bb104..d51c45961893 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
/* Set the vbus disconnect threshold for implicit contract */
--
2.29.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
` (2 preceding siblings ...)
2020-12-10 16:05 ` [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling Greg Kroah-Hartman
@ 2020-12-10 16:05 ` Greg Kroah-Hartman
2020-12-10 17:44 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition Greg Kroah-Hartman
2020-12-11 8:30 ` [PATCH 0/5] USB: typec: various patches Heikki Krogerus
5 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, Kyle Tso, Badhri Jagan Sridharan,
Will McVicker, Greg Kroah-Hartman
From: Kyle Tso <kyletso@google.com>
TCPM state machine needs 20-25ms to enter the ErrorRecovery state after
tPSSourceOn timer timeouts. Change the timer from max 480ms to 450ms to
ensure that the timer complies with the Spec. In order to keep the
flexibility for other usecases using tPSSourceOn, add another timer only
for PR_SWAP.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/tcpm/tcpm.c | 2 +-
include/linux/usb/pd.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index d51c45961893..5ed78194a1bd 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
}
- tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
+ tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON_PRS);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
/* Set the vbus disconnect threshold for implicit contract */
diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
index 63a66dd5d832..bb9a782e1411 100644
--- a/include/linux/usb/pd.h
+++ b/include/linux/usb/pd.h
@@ -466,6 +466,7 @@ static inline unsigned int rdo_max_power(u32 rdo)
#define PD_T_DRP_SRC 30
#define PD_T_PS_SOURCE_OFF 920
#define PD_T_PS_SOURCE_ON 480
+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */
#define PD_T_PS_HARD_RESET 30
#define PD_T_SRC_RECOVER 760
#define PD_T_SRC_RECOVER_MAX 1000
--
2.29.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
` (3 preceding siblings ...)
2020-12-10 16:05 ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Greg Kroah-Hartman
@ 2020-12-10 16:05 ` Greg Kroah-Hartman
2020-12-10 17:45 ` Guenter Roeck
2020-12-11 8:30 ` [PATCH 0/5] USB: typec: various patches Heikki Krogerus
5 siblings, 1 reply; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-10 16:05 UTC (permalink / raw)
To: heikki.krogerus, linux
Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan, Kyle Tso,
Will McVicker, Greg Kroah-Hartman
From: Badhri Jagan Sridharan <badhri@google.com>
"Table 4-19. POWER_CONTROL Register Definition" from tcpci spec
defines BIT(3) as the control bit for bleed discharge.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Kyle Tso <kyletso@google.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/typec/tcpm/tcpci.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
index 116a69c85e38..c3c7d07d9b4e 100644
--- a/drivers/usb/typec/tcpm/tcpci.h
+++ b/drivers/usb/typec/tcpm/tcpci.h
@@ -72,6 +72,7 @@
#define TCPC_POWER_CTRL 0x1c
#define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0)
+#define TCPC_POWER_CTRL_BLEED_DISCHARGE BIT(3)
#define TCPC_POWER_CTRL_AUTO_DISCHARGE BIT(4)
#define TCPC_FAST_ROLE_SWAP_EN BIT(7)
--
2.29.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
@ 2020-12-10 17:42 ` Guenter Roeck
2020-12-10 19:10 ` Badhri Jagan Sridharan
0 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2020-12-10 17:42 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: heikki.krogerus, linux-usb, linux-kernel, Badhri Jagan Sridharan,
Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 05:05:17PM +0100, Greg Kroah-Hartman wrote:
> From: Badhri Jagan Sridharan <badhri@google.com>
>
> TCPM logs overflow once the logbuffer is full. Clear old entries and
> allow logging the newer ones as the newer would be more relevant to the
> issue being debugged.
>
> Also, do not reset the logbuffer tail as end users might take back to
> back bugreports which would result in an empty buffer.
>
Historically, the reason for not doing this was that, once a problem occurs,
the log would fill up quickly (typically with reconnect attempts), and the
actual reason for the problem would be overwritten. Maybe that reasoning
no longer applies; I just wanted to point out that there _was_ a reason for
not clearing old log entries.
Guenter
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Kyle Tso <kyletso@google.com>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index cedc6cf82d61..0ceeab50ed64 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -470,12 +470,6 @@ static bool tcpm_port_is_disconnected(struct tcpm_port *port)
>
> #ifdef CONFIG_DEBUG_FS
>
> -static bool tcpm_log_full(struct tcpm_port *port)
> -{
> - return port->logbuffer_tail ==
> - (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> -}
> -
> __printf(2, 0)
> static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> {
> @@ -495,11 +489,6 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
>
> vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args);
>
> - if (tcpm_log_full(port)) {
> - port->logbuffer_head = max(port->logbuffer_head - 1, 0);
> - strcpy(tmpbuffer, "overflow");
> - }
> -
> if (port->logbuffer_head < 0 ||
> port->logbuffer_head >= LOG_BUFFER_ENTRIES) {
> dev_warn(port->dev,
> @@ -519,6 +508,9 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> (unsigned long)ts_nsec, rem_nsec / 1000,
> tmpbuffer);
> port->logbuffer_head = (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> + if (port->logbuffer_head == port->logbuffer_tail)
> + port->logbuffer_tail =
> + (port->logbuffer_tail + 1) % LOG_BUFFER_ENTRIES;
>
> abort:
> mutex_unlock(&port->logbuffer_lock);
> @@ -622,8 +614,6 @@ static int tcpm_debug_show(struct seq_file *s, void *v)
> seq_printf(s, "%s\n", port->logbuffer[tail]);
> tail = (tail + 1) % LOG_BUFFER_ENTRIES;
> }
> - if (!seq_has_overflowed(s))
> - port->logbuffer_tail = tail;
> mutex_unlock(&port->logbuffer_lock);
>
> return 0;
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request
2020-12-10 16:05 ` [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Greg Kroah-Hartman
@ 2020-12-10 17:43 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2020-12-10 17:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: heikki.krogerus, linux-usb, linux-kernel, pumahsu,
Badhri Jagan Sridharan, Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 05:05:18PM +0100, Greg Kroah-Hartman wrote:
> From: pumahsu <pumahsu@google.com>
>
> PD 3.0 spec 8.3.3.2.3, A Get_Source_Cap message is sent
> to a UUT that is in the PE_SRC_Ready state. After sending
> a Source_Capabilities message, the UUT should then expect
> a Request message in response. When one is not received,
> the UUT should timeout to PE_SRC_Hard_Reset.
>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: pumahsu <pumahsu@google.com>
> Signed-off-by: Kyle Tso <kyletso@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0ceeab50ed64..0efda59bb104 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -2218,6 +2218,7 @@ static int tcpm_pd_send_control(struct tcpm_port *port,
> static bool tcpm_send_queued_message(struct tcpm_port *port)
> {
> enum pd_msg_request queued_message;
> + int ret;
>
> do {
> queued_message = port->queued_message;
> @@ -2237,7 +2238,16 @@ static bool tcpm_send_queued_message(struct tcpm_port *port)
> tcpm_pd_send_sink_caps(port);
> break;
> case PD_MSG_DATA_SOURCE_CAP:
> - tcpm_pd_send_source_caps(port);
> + ret = tcpm_pd_send_source_caps(port);
> + if (ret < 0) {
> + tcpm_log(port,
> + "Unable to send src caps, ret=%d",
> + ret);
> + tcpm_set_state(port, SOFT_RESET_SEND, 0);
> + } else if (port->pwr_role == TYPEC_SOURCE) {
> + tcpm_set_state(port, HARD_RESET_SEND,
> + PD_T_SENDER_RESPONSE);
> + }
> break;
> default:
> break;
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling
2020-12-10 16:05 ` [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling Greg Kroah-Hartman
@ 2020-12-10 17:43 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2020-12-10 17:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: heikki.krogerus, linux-usb, linux-kernel, Kyle Tso,
Badhri Jagan Sridharan, Will McVicker
On Thu, Dec 10, 2020 at 05:05:19PM +0100, Greg Kroah-Hartman wrote:
> From: Kyle Tso <kyletso@google.com>
>
> PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
> The Policy Enging Shall transition to the ErrorRecovery state when the
> PSSourceOnTimer times out ...
>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: Kyle Tso <kyletso@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0efda59bb104..d51c45961893 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port)
> tcpm_set_state(port, ERROR_RECOVERY, 0);
> break;
> }
> - tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
> + tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
> break;
> case PR_SWAP_SRC_SNK_SINK_ON:
> /* Set the vbus disconnect threshold for implicit contract */
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
2020-12-10 16:05 ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Greg Kroah-Hartman
@ 2020-12-10 17:44 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2020-12-10 17:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: heikki.krogerus, linux-usb, linux-kernel, Kyle Tso,
Badhri Jagan Sridharan, Will McVicker
On Thu, Dec 10, 2020 at 05:05:20PM +0100, Greg Kroah-Hartman wrote:
> From: Kyle Tso <kyletso@google.com>
>
> TCPM state machine needs 20-25ms to enter the ErrorRecovery state after
> tPSSourceOn timer timeouts. Change the timer from max 480ms to 450ms to
> ensure that the timer complies with the Spec. In order to keep the
> flexibility for other usecases using tPSSourceOn, add another timer only
> for PR_SWAP.
>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: Kyle Tso <kyletso@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 2 +-
> include/linux/usb/pd.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index d51c45961893..5ed78194a1bd 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port)
> tcpm_set_state(port, ERROR_RECOVERY, 0);
> break;
> }
> - tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
> + tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON_PRS);
> break;
> case PR_SWAP_SRC_SNK_SINK_ON:
> /* Set the vbus disconnect threshold for implicit contract */
> diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
> index 63a66dd5d832..bb9a782e1411 100644
> --- a/include/linux/usb/pd.h
> +++ b/include/linux/usb/pd.h
> @@ -466,6 +466,7 @@ static inline unsigned int rdo_max_power(u32 rdo)
> #define PD_T_DRP_SRC 30
> #define PD_T_PS_SOURCE_OFF 920
> #define PD_T_PS_SOURCE_ON 480
> +#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */
> #define PD_T_PS_HARD_RESET 30
> #define PD_T_SRC_RECOVER 760
> #define PD_T_SRC_RECOVER_MAX 1000
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
2020-12-10 16:05 ` [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition Greg Kroah-Hartman
@ 2020-12-10 17:45 ` Guenter Roeck
2020-12-10 18:56 ` Badhri Jagan Sridharan
0 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2020-12-10 17:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: heikki.krogerus, linux-usb, linux-kernel, Badhri Jagan Sridharan,
Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 05:05:21PM +0100, Greg Kroah-Hartman wrote:
> From: Badhri Jagan Sridharan <badhri@google.com>
>
> "Table 4-19. POWER_CONTROL Register Definition" from tcpci spec
> defines BIT(3) as the control bit for bleed discharge.
>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Kyle Tso <kyletso@google.com>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just wondering - is that going to be used in a follow-up commit ?
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Guenter
> ---
> drivers/usb/typec/tcpm/tcpci.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
> index 116a69c85e38..c3c7d07d9b4e 100644
> --- a/drivers/usb/typec/tcpm/tcpci.h
> +++ b/drivers/usb/typec/tcpm/tcpci.h
> @@ -72,6 +72,7 @@
>
> #define TCPC_POWER_CTRL 0x1c
> #define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0)
> +#define TCPC_POWER_CTRL_BLEED_DISCHARGE BIT(3)
> #define TCPC_POWER_CTRL_AUTO_DISCHARGE BIT(4)
> #define TCPC_FAST_ROLE_SWAP_EN BIT(7)
>
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
2020-12-10 17:45 ` Guenter Roeck
@ 2020-12-10 18:56 ` Badhri Jagan Sridharan
2020-12-11 4:47 ` Badhri Jagan Sridharan
0 siblings, 1 reply; 18+ messages in thread
From: Badhri Jagan Sridharan @ 2020-12-10 18:56 UTC (permalink / raw)
To: Guenter Roeck
Cc: Greg Kroah-Hartman, Heikki Krogerus, USB, LKML, Kyle Tso, Will McVicker
Hi Guenter,
Yes I will send a follow up patch to update tcpci_maxim.c.
Thanks,
Badhri
On Thu, Dec 10, 2020 at 9:45 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Thu, Dec 10, 2020 at 05:05:21PM +0100, Greg Kroah-Hartman wrote:
> > From: Badhri Jagan Sridharan <badhri@google.com>
> >
> > "Table 4-19. POWER_CONTROL Register Definition" from tcpci spec
> > defines BIT(3) as the control bit for bleed discharge.
> >
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > Cc: Kyle Tso <kyletso@google.com>
> > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > Signed-off-by: Will McVicker <willmcvicker@google.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Just wondering - is that going to be used in a follow-up commit ?
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
> Guenter
>
> > ---
> > drivers/usb/typec/tcpm/tcpci.h | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
> > index 116a69c85e38..c3c7d07d9b4e 100644
> > --- a/drivers/usb/typec/tcpm/tcpci.h
> > +++ b/drivers/usb/typec/tcpm/tcpci.h
> > @@ -72,6 +72,7 @@
> >
> > #define TCPC_POWER_CTRL 0x1c
> > #define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0)
> > +#define TCPC_POWER_CTRL_BLEED_DISCHARGE BIT(3)
> > #define TCPC_POWER_CTRL_AUTO_DISCHARGE BIT(4)
> > #define TCPC_FAST_ROLE_SWAP_EN BIT(7)
> >
> > --
> > 2.29.2
> >
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries
2020-12-10 17:42 ` Guenter Roeck
@ 2020-12-10 19:10 ` Badhri Jagan Sridharan
2020-12-11 0:01 ` Guenter Roeck
0 siblings, 1 reply; 18+ messages in thread
From: Badhri Jagan Sridharan @ 2020-12-10 19:10 UTC (permalink / raw)
To: Guenter Roeck
Cc: Greg Kroah-Hartman, Heikki Krogerus, USB, LKML, Kyle Tso, Will McVicker
Hi Guenter,
While I agree with what you are saying, since the logbuffer does not
have the intelligence to drop older entries where no issues were seen,
logbuffer gets full pretty quickly with good instances and there is no
space left to log the bad instance. Should wrapping this in a config
option be a better way to go about this ? When the config optioin is
set, old entries will be dropped.
Please let me know, I can update the patch and resend.
Thanks,
Badhri
On Thu, Dec 10, 2020 at 9:53 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Thu, Dec 10, 2020 at 05:05:17PM +0100, Greg Kroah-Hartman wrote:
> > From: Badhri Jagan Sridharan <badhri@google.com>
> >
> > TCPM logs overflow once the logbuffer is full. Clear old entries and
> > allow logging the newer ones as the newer would be more relevant to the
> > issue being debugged.
> >
> > Also, do not reset the logbuffer tail as end users might take back to
> > back bugreports which would result in an empty buffer.
> >
>
> Historically, the reason for not doing this was that, once a problem occurs,
> the log would fill up quickly (typically with reconnect attempts), and the
> actual reason for the problem would be overwritten. Maybe that reasoning
> no longer applies; I just wanted to point out that there _was_ a reason for
> not clearing old log entries.
>
> Guenter
>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > Cc: Kyle Tso <kyletso@google.com>
> > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > Signed-off-by: Will McVicker <willmcvicker@google.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > drivers/usb/typec/tcpm/tcpm.c | 16 +++-------------
> > 1 file changed, 3 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> > index cedc6cf82d61..0ceeab50ed64 100644
> > --- a/drivers/usb/typec/tcpm/tcpm.c
> > +++ b/drivers/usb/typec/tcpm/tcpm.c
> > @@ -470,12 +470,6 @@ static bool tcpm_port_is_disconnected(struct tcpm_port *port)
> >
> > #ifdef CONFIG_DEBUG_FS
> >
> > -static bool tcpm_log_full(struct tcpm_port *port)
> > -{
> > - return port->logbuffer_tail ==
> > - (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> > -}
> > -
> > __printf(2, 0)
> > static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> > {
> > @@ -495,11 +489,6 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> >
> > vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args);
> >
> > - if (tcpm_log_full(port)) {
> > - port->logbuffer_head = max(port->logbuffer_head - 1, 0);
> > - strcpy(tmpbuffer, "overflow");
> > - }
> > -
> > if (port->logbuffer_head < 0 ||
> > port->logbuffer_head >= LOG_BUFFER_ENTRIES) {
> > dev_warn(port->dev,
> > @@ -519,6 +508,9 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> > (unsigned long)ts_nsec, rem_nsec / 1000,
> > tmpbuffer);
> > port->logbuffer_head = (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> > + if (port->logbuffer_head == port->logbuffer_tail)
> > + port->logbuffer_tail =
> > + (port->logbuffer_tail + 1) % LOG_BUFFER_ENTRIES;
> >
> > abort:
> > mutex_unlock(&port->logbuffer_lock);
> > @@ -622,8 +614,6 @@ static int tcpm_debug_show(struct seq_file *s, void *v)
> > seq_printf(s, "%s\n", port->logbuffer[tail]);
> > tail = (tail + 1) % LOG_BUFFER_ENTRIES;
> > }
> > - if (!seq_has_overflowed(s))
> > - port->logbuffer_tail = tail;
> > mutex_unlock(&port->logbuffer_lock);
> >
> > return 0;
> > --
> > 2.29.2
> >
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries
2020-12-10 19:10 ` Badhri Jagan Sridharan
@ 2020-12-11 0:01 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2020-12-11 0:01 UTC (permalink / raw)
To: Badhri Jagan Sridharan
Cc: Greg Kroah-Hartman, Heikki Krogerus, USB, LKML, Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 11:10:27AM -0800, Badhri Jagan Sridharan wrote:
> Hi Guenter,
>
> While I agree with what you are saying, since the logbuffer does not
> have the intelligence to drop older entries where no issues were seen,
> logbuffer gets full pretty quickly with good instances and there is no
> space left to log the bad instance. Should wrapping this in a config
For my use case, it was typically sufficient to clear the log buffer
by reading it if needed. However, as I said, my original reason may no
longer apply. After all, the code is much more stable than it used to be,
and maybe the endless conection attempts after an initial error are no
longer seen. At this point I don't really have a strong opinion either way.
> option be a better way to go about this ? When the config optioin is
> set, old entries will be dropped.
A config option (assuming you mean Kconfig) seems bad. Maybe we could
have a writeable debugfs file which defines the approach to use (not
sure if that would be acceptable, though).
Note that I also considered changing logging to tracing, but that has
the disadvantage that it needs to be explicitly activated and doesn't
provide any kind of history in the "normal" case. On a higher level,
it would be nice to have a logging option like the one implemented here
in the infrastucture. But that is really a completely different issue.
Thanks,
Guenter
> Please let me know, I can update the patch and resend.
>
> Thanks,
> Badhri
>
>
>
> On Thu, Dec 10, 2020 at 9:53 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Thu, Dec 10, 2020 at 05:05:17PM +0100, Greg Kroah-Hartman wrote:
> > > From: Badhri Jagan Sridharan <badhri@google.com>
> > >
> > > TCPM logs overflow once the logbuffer is full. Clear old entries and
> > > allow logging the newer ones as the newer would be more relevant to the
> > > issue being debugged.
> > >
> > > Also, do not reset the logbuffer tail as end users might take back to
> > > back bugreports which would result in an empty buffer.
> > >
> >
> > Historically, the reason for not doing this was that, once a problem occurs,
> > the log would fill up quickly (typically with reconnect attempts), and the
> > actual reason for the problem would be overwritten. Maybe that reasoning
> > no longer applies; I just wanted to point out that there _was_ a reason for
> > not clearing old log entries.
> >
> > Guenter
> >
> > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > Cc: Kyle Tso <kyletso@google.com>
> > > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > > Signed-off-by: Will McVicker <willmcvicker@google.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > > drivers/usb/typec/tcpm/tcpm.c | 16 +++-------------
> > > 1 file changed, 3 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> > > index cedc6cf82d61..0ceeab50ed64 100644
> > > --- a/drivers/usb/typec/tcpm/tcpm.c
> > > +++ b/drivers/usb/typec/tcpm/tcpm.c
> > > @@ -470,12 +470,6 @@ static bool tcpm_port_is_disconnected(struct tcpm_port *port)
> > >
> > > #ifdef CONFIG_DEBUG_FS
> > >
> > > -static bool tcpm_log_full(struct tcpm_port *port)
> > > -{
> > > - return port->logbuffer_tail ==
> > > - (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> > > -}
> > > -
> > > __printf(2, 0)
> > > static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> > > {
> > > @@ -495,11 +489,6 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> > >
> > > vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args);
> > >
> > > - if (tcpm_log_full(port)) {
> > > - port->logbuffer_head = max(port->logbuffer_head - 1, 0);
> > > - strcpy(tmpbuffer, "overflow");
> > > - }
> > > -
> > > if (port->logbuffer_head < 0 ||
> > > port->logbuffer_head >= LOG_BUFFER_ENTRIES) {
> > > dev_warn(port->dev,
> > > @@ -519,6 +508,9 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
> > > (unsigned long)ts_nsec, rem_nsec / 1000,
> > > tmpbuffer);
> > > port->logbuffer_head = (port->logbuffer_head + 1) % LOG_BUFFER_ENTRIES;
> > > + if (port->logbuffer_head == port->logbuffer_tail)
> > > + port->logbuffer_tail =
> > > + (port->logbuffer_tail + 1) % LOG_BUFFER_ENTRIES;
> > >
> > > abort:
> > > mutex_unlock(&port->logbuffer_lock);
> > > @@ -622,8 +614,6 @@ static int tcpm_debug_show(struct seq_file *s, void *v)
> > > seq_printf(s, "%s\n", port->logbuffer[tail]);
> > > tail = (tail + 1) % LOG_BUFFER_ENTRIES;
> > > }
> > > - if (!seq_has_overflowed(s))
> > > - port->logbuffer_tail = tail;
> > > mutex_unlock(&port->logbuffer_lock);
> > >
> > > return 0;
> > > --
> > > 2.29.2
> > >
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
2020-12-10 18:56 ` Badhri Jagan Sridharan
@ 2020-12-11 4:47 ` Badhri Jagan Sridharan
2020-12-11 6:38 ` Greg Kroah-Hartman
0 siblings, 1 reply; 18+ messages in thread
From: Badhri Jagan Sridharan @ 2020-12-11 4:47 UTC (permalink / raw)
To: Guenter Roeck
Cc: Greg Kroah-Hartman, Heikki Krogerus, USB, LKML, Kyle Tso, Will McVicker
Hi Greg,
I have a patch ready to enable BLEED_DISCHARGE in tcpci code.
I will send that in once you merge this patch to usb-next.
Thanks,
Badhri
On Thu, Dec 10, 2020 at 10:56 AM Badhri Jagan Sridharan
<badhri@google.com> wrote:
>
> Hi Guenter,
>
> Yes I will send a follow up patch to update tcpci_maxim.c.
>
> Thanks,
> Badhri
>
>
> On Thu, Dec 10, 2020 at 9:45 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Thu, Dec 10, 2020 at 05:05:21PM +0100, Greg Kroah-Hartman wrote:
> > > From: Badhri Jagan Sridharan <badhri@google.com>
> > >
> > > "Table 4-19. POWER_CONTROL Register Definition" from tcpci spec
> > > defines BIT(3) as the control bit for bleed discharge.
> > >
> > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > Cc: Kyle Tso <kyletso@google.com>
> > > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > > Signed-off-by: Will McVicker <willmcvicker@google.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >
> > Just wondering - is that going to be used in a follow-up commit ?
> >
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> >
> > Guenter
> >
> > > ---
> > > drivers/usb/typec/tcpm/tcpci.h | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
> > > index 116a69c85e38..c3c7d07d9b4e 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci.h
> > > +++ b/drivers/usb/typec/tcpm/tcpci.h
> > > @@ -72,6 +72,7 @@
> > >
> > > #define TCPC_POWER_CTRL 0x1c
> > > #define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0)
> > > +#define TCPC_POWER_CTRL_BLEED_DISCHARGE BIT(3)
> > > #define TCPC_POWER_CTRL_AUTO_DISCHARGE BIT(4)
> > > #define TCPC_FAST_ROLE_SWAP_EN BIT(7)
> > >
> > > --
> > > 2.29.2
> > >
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
2020-12-11 4:47 ` Badhri Jagan Sridharan
@ 2020-12-11 6:38 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-11 6:38 UTC (permalink / raw)
To: Badhri Jagan Sridharan
Cc: Guenter Roeck, Heikki Krogerus, USB, LKML, Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 08:47:04PM -0800, Badhri Jagan Sridharan wrote:
> Hi Greg,
>
> I have a patch ready to enable BLEED_DISCHARGE in tcpci code.
> I will send that in once you merge this patch to usb-next.
Feel free to send that now, no need to wait :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/5] USB: typec: various patches
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
` (4 preceding siblings ...)
2020-12-10 16:05 ` [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition Greg Kroah-Hartman
@ 2020-12-11 8:30 ` Heikki Krogerus
2020-12-11 9:51 ` Greg Kroah-Hartman
5 siblings, 1 reply; 18+ messages in thread
From: Heikki Krogerus @ 2020-12-11 8:30 UTC (permalink / raw)
To: Greg Kroah-Hartman, Badhri Jagan Sridharan
Cc: linux, linux-usb, linux-kernel, Kyle Tso, Will McVicker
On Thu, Dec 10, 2020 at 05:05:16PM +0100, Greg Kroah-Hartman wrote:
> In digging through a large set of proposed typec patches for the Android
> common kernel, I've picked out 5 "easy" patches that should all go
> upstream (they all should go upstream, just will take a while to clean
> them up it seems...)
Cool. Is there already support for the new Enter_USB message? Badhri,
maybe you know more about this, if somebody is working on that or not?
FWIW, for all except the first patch 1/5:
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Badhri Jagan Sridharan (2):
> USB: typec: tcpm: Prevent log overflow by removing old entries
> USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
>
> Kyle Tso (2):
> USB: typec: tcpm: Fix PR_SWAP error handling
> USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
>
> pumahsu (1):
> USB: typec: tcpm: Hard Reset after not receiving a Request
>
> drivers/usb/typec/tcpm/tcpci.h | 1 +
> drivers/usb/typec/tcpm/tcpm.c | 30 +++++++++++++++---------------
> include/linux/usb/pd.h | 1 +
> 3 files changed, 17 insertions(+), 15 deletions(-)
>
> --
> 2.29.2
thanks,
--
heikki
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/5] USB: typec: various patches
2020-12-11 8:30 ` [PATCH 0/5] USB: typec: various patches Heikki Krogerus
@ 2020-12-11 9:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-11 9:51 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Badhri Jagan Sridharan, linux, linux-usb, linux-kernel, Kyle Tso,
Will McVicker
On Fri, Dec 11, 2020 at 10:30:10AM +0200, Heikki Krogerus wrote:
> On Thu, Dec 10, 2020 at 05:05:16PM +0100, Greg Kroah-Hartman wrote:
> > In digging through a large set of proposed typec patches for the Android
> > common kernel, I've picked out 5 "easy" patches that should all go
> > upstream (they all should go upstream, just will take a while to clean
> > them up it seems...)
>
> Cool. Is there already support for the new Enter_USB message? Badhri,
> maybe you know more about this, if somebody is working on that or not?
>
> FWIW, for all except the first patch 1/5:
>
> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Thanks, will drop patch 1 from the queue.
greg k-h
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-12-11 9:51 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
2020-12-10 17:42 ` Guenter Roeck
2020-12-10 19:10 ` Badhri Jagan Sridharan
2020-12-11 0:01 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Greg Kroah-Hartman
2020-12-10 17:43 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling Greg Kroah-Hartman
2020-12-10 17:43 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Greg Kroah-Hartman
2020-12-10 17:44 ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition Greg Kroah-Hartman
2020-12-10 17:45 ` Guenter Roeck
2020-12-10 18:56 ` Badhri Jagan Sridharan
2020-12-11 4:47 ` Badhri Jagan Sridharan
2020-12-11 6:38 ` Greg Kroah-Hartman
2020-12-11 8:30 ` [PATCH 0/5] USB: typec: various patches Heikki Krogerus
2020-12-11 9:51 ` 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).