Skip to content

Commit 197331b

Browse files
Badhri Jagan Sridharangregkh
authored andcommitted
usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices
While commit 69f8916 ("usb: typec: tpcm: Fix issues with power being removed during reset") fixes the boot issues for bus powered devices such as LibreTech Renegade Elite/Firefly, it trades off the CC pins NOT being Hi-Zed during errory recovery (i.e PORT_RESET) for devices which are NOT bus powered(a.k.a self powered). This change Hi-Zs the CC pins only for self powered devices, thus preventing brown out for bus powered devices Adhering to spec is gaining more importance due to the Common charger initiative enforced by the European Union. Quoting from the spec: 4.5.2.2.2.1 ErrorRecovery State Requirements The port shall not drive VBUS or VCONN, and shall present a high-impedance to ground (above zOPEN) on its CC1 and CC2 pins. Hi-Zing the CC pins is the inteded behavior for PORT_RESET. CC pins are set to default state after tErrorRecovery in PORT_RESET_WAIT_OFF. 4.5.2.2.2.2 Exiting From ErrorRecovery State A Sink shall transition to Unattached.SNK after tErrorRecovery. A Source shall transition to Unattached.SRC after tErrorRecovery. Fixes: 69f8916 ("usb: typec: tpcm: Fix issues with power being removed during reset") Cc: [email protected] Cc: Mark Brown <[email protected]> Signed-off-by: Badhri Jagan Sridharan <[email protected]> Tested-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a30dca commit 197331b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4873,8 +4873,11 @@ static void run_state_machine(struct tcpm_port *port)
48734873
break;
48744874
case PORT_RESET:
48754875
tcpm_reset_port(port);
4876-
tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
4877-
TYPEC_CC_RD : tcpm_rp_cc(port));
4876+
if (port->self_powered)
4877+
tcpm_set_cc(port, TYPEC_CC_OPEN);
4878+
else
4879+
tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
4880+
TYPEC_CC_RD : tcpm_rp_cc(port));
48784881
tcpm_set_state(port, PORT_RESET_WAIT_OFF,
48794882
PD_T_ERROR_RECOVERY);
48804883
break;

0 commit comments

Comments
 (0)