tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart
Subsystems (3)
Badhri Jagan Sridharan
maintainerPATCH v2 1/1 tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart
From the spec:
"6.6.8.1 SwapSourceStartTimer
The SwapSourceStartTimer Shall be used by the new Source, after a Power Role Swap or Fast Role Swap, to ensure that it does not send Source_Capabilities Message before the new Sink is ready to receive the Source_Capabilities Message. The new Source Shall Not send the Source_Capabilities Message earlier than tSwapSourceStart after the last bit of the EOP of GoodCRC Message sent in response to the PS_RDY Message sent by the new Source indicating that its power supply is ready."
This fixes TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 failures
---
Changes since V1:
- Comment on the permissible values of tSwapSourceStart
--- drivers/usb/typec/tcpm/tcpm.c | 2 +- include/linux/usb/pd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +1 -1
@@ -3555,7 +3555,7 @@ static void run_state_machine(struct tcpm_port *port)*/ tcpm_set_pwr_role (port,TYPEC_SOURCE );tcpm_pd_send_control (port,PD_CTRL_PS_RDY ); -tcpm_set_state (port,SRC_STARTUP ,0 ); +tcpm_set_state (port,SRC_STARTUP ,PD_T_SWAP_SRC_START );break ;case VCONN_SWAP_ACCEPT :
include/linux/usb/pd.h +1 -0
@@ -473,6 +473,7 @@ static inline unsigned int rdo_max_power(u32 rdo)#define PD_T_ERROR_RECOVERY 100/* minimum 25 is insufficient */ #define PD_T_SRCSWAPSTDBY 625/* Maximum of 650ms */ #define PD_T_NEWSRC 250/* Maximum of 275ms */ +#define PD_T_SWAP_SRC_START 20/* Minimum of 20ms */ #define PD_T_DRP_TRY 100/* 75 - 150 ms */ #define PD_T_DRP_TRYWAIT 600/* 400 - 800 ms */
Signature · 1 line
2.28.0.236.gb10cc79966-goog
Quoted 11 lines · Badhri Jagan Sridharan
From the spec:
"6.6.8.1 SwapSourceStartTimer
The SwapSourceStartTimer Shall be used by the new Source, after a Power Role Swap or Fast Role Swap, to ensure that it does not sendSource_CapabilitiesMessage before the new Sink is ready to receive theSource_CapabilitiesMessage. The new Source Shall Not send theSource_CapabilitiesMessage earlier than tSwapSourceStart after the last bit of the EOP of GoodCRC Message sent in response to thePS_RDYMessage sent by the new Source indicating that its power supply is ready."
Quoted 3 lines
This fixes TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 failures
Signed-off-by Badhri Jagan Sridharan <[email protected]>
Nit below, otherwise
Note that I wasn't copied on this patch and only noticed it accidentally.
Guenter
Quoted 26 lines
---
Changes since V1:
- Comment on the permissible values of tSwapSourceStart--- drivers/usb/typec/tcpm/tcpm.c | 2 +- include/linux/usb/pd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/usb/typec/tcpm/tcpm.c +1
-1@@ -3555,7 +3555,7 @@ static void run_state_machine(struct tcpm_port *port)*/ tcpm_set_pwr_role (port,TYPEC_SOURCE );tcpm_pd_send_control (port,PD_CTRL_PS_RDY ); -tcpm_set_state (port,SRC_STARTUP ,0 ); +tcpm_set_state (port,SRC_STARTUP ,PD_T_SWAP_SRC_START );break ;case VCONN_SWAP_ACCEPT :include/linux/usb/pd.h +0
-0
include/linux/usb/pd.h static inline unsigned int rdo_max_power(u32 rdo) · line 476
Quoted 4 lines
include/linux/usb/pd.h +1
-0@@ -473,6 +473,7 @@ static inline unsigned int rdo_max_power(u32 rdo)#define PD_T_ERROR_RECOVERY 100/* minimum 25 is insufficient */ #define PD_T_SRCSWAPSTDBY 625/* Maximum of 650ms */ #define PD_T_NEWSRC 250/* Maximum of 275ms */ +#define PD_T_SWAP_SRC_START 20/* Minimum of 20ms */
Odd alignment. Same as with the previous two lines which don't use tabs either.
Quoted 3 lines
include/linux/usb/pd.h +0
-0#define PD_T_DRP_TRY 100/* 75 - 150 ms */ #define PD_T_DRP_TRYWAIT 600/* 400 - 800 ms */
Badhri Jagan Sridharan
maintainerQuoted 15 lines · Guenter Roeck
Quoted 13 lines · Badhri Jagan Sridharan
From the spec:
"6.6.8.1 SwapSourceStartTimer
The SwapSourceStartTimer Shall be used by the new Source, after a Power Role Swap or Fast Role Swap, to ensure that it does not sendSource_CapabilitiesMessage before the new Sink is ready to receive theSource_CapabilitiesMessage. The new Source Shall Not send theSource_CapabilitiesMessage earlier than tSwapSourceStart after the last bit of the EOP of GoodCRC Message sent in response to thePS_RDYMessage sent by the new Source indicating that its power supply is ready."This fixes TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 failures
Quoted 7 lines
Quoted 1 line
Signed-off-by Badhri Jagan Sridharan <[email protected]>Nit below, otherwise
Reviewed-by Guenter Roeck <[email protected]>Note that I wasn't copied on this patch and only noticed it accidentally.
Apologies Guenter ! Error on my side while performing the git send-email command.
Will make sure that I double check next time.
Quoted 40 lines
Guenter
Quoted 26 lines
---
Changes since V1:
- Comment on the permissible values of tSwapSourceStart--- drivers/usb/typec/tcpm/tcpm.c | 2 +- include/linux/usb/pd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/usb/typec/tcpm/tcpm.c +1
-1@@ -3555,7 +3555,7 @@ static void run_state_machine(struct tcpm_port *port)*/ tcpm_set_pwr_role (port,TYPEC_SOURCE );tcpm_pd_send_control (port,PD_CTRL_PS_RDY ); -tcpm_set_state (port,SRC_STARTUP ,0 ); +tcpm_set_state (port,SRC_STARTUP ,PD_T_SWAP_SRC_START );break ;case VCONN_SWAP_ACCEPT :include/linux/usb/pd.h +0
-0include/linux/usb/pd.h static inline unsigned int rdo_max_power(u32 rdo) · line 476
Quoted 4 lines
include/linux/usb/pd.h +1
-0@@ -473,6 +473,7 @@ static inline unsigned int rdo_max_power(u32 rdo)#define PD_T_ERROR_RECOVERY 100/* minimum 25 is insufficient */ #define PD_T_SRCSWAPSTDBY 625/* Maximum of 650ms */ #define PD_T_NEWSRC 250/* Maximum of 275ms */ +#define PD_T_SWAP_SRC_START 20/* Minimum of 20ms */ Odd alignment. Same as with the previous two lines which don't use tabs either.
Quoted 3 lines
include/linux/usb/pd.h +0
-0#define PD_T_DRP_TRY 100/* 75 - 150 ms */ #define PD_T_DRP_TRYWAIT 600/* 400 - 800 ms */