linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: heikki.krogerus@linux.intel.com, linux@roeck-us.net
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kyle Tso <kyletso@google.com>,
	Badhri Jagan Sridharan <badhri@google.com>,
	Will McVicker <willmcvicker@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
Date: Thu, 10 Dec 2020 17:05:20 +0100	[thread overview]
Message-ID: <20201210160521.3417426-5-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20201210160521.3417426-1-gregkh@linuxfoundation.org>

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


  parent reply	other threads:[~2020-12-10 16:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Greg Kroah-Hartman [this message]
2020-12-10 17:44   ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210160521.3417426-5-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=badhri@google.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=willmcvicker@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).