[PATCH] usb: typec: tcpm: Prevent Hard_Reset if Vbus was never low

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before this patch, tcpm went into SOFT_RESET state, if Vbus was never low
resulting in Hard_Reset, if power supply does not support USB_PD Soft_Reset.

In order to prevent this, I remove the Vbus check completely, so that 
we go as well into the SNK_WAIT_CAPABILITIES_TIMEOUT state. There, we send 
PD_CTRL_GET_SOURCE_CAP which many power supply do support.
(122968f8dda8 usb: typec: tcpm: avoid resets for missing source capability messages)

Additionally, I added SOFT_RESET (instead of Hard_Reset) as Fallback solution
if we still not have gotten any capabilities. Hard_Reset is now only done, 
if PD_CTRL_GET_SOURCE_CAP and SOFT_RESET fail to get capabilities.
---
 drivers/usb/typec/tcpm/tcpm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index fc619478200f..c7a59c9f78ee 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5038,14 +5038,8 @@ static void run_state_machine(struct tcpm_port *port)
 		 * were already in a stable contract before this boot.
 		 * Do this only once.
 		 */
-		if (port->vbus_never_low) {
-			port->vbus_never_low = false;
-			tcpm_set_state(port, SNK_SOFT_RESET,
+		tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT,
 				       PD_T_SINK_WAIT_CAP);
-		} else {
-			tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT,
-				       PD_T_SINK_WAIT_CAP);
-		}
 		break;
 	case SNK_WAIT_CAPABILITIES_TIMEOUT:
 		/*
@@ -5064,7 +5058,7 @@ static void run_state_machine(struct tcpm_port *port)
 		 * according to the specification.
 		 */
 		if (tcpm_pd_send_control(port, PD_CTRL_GET_SOURCE_CAP, TCPC_TX_SOP))
-			tcpm_set_state_cond(port, hard_reset_state(port), 0);
+			tcpm_set_state_cond(port, SNK_SOFT_RESET, 0);
 		else
 			tcpm_set_state(port, hard_reset_state(port), PD_T_SINK_WAIT_CAP);
 		break;
-- 
2.34.1






[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux