FROMGIT: usb: typec: tcpm: Fix up PR_SWAP when vsafe0v is signalled

During PR_SWAP, When TCPM is in PR_SWAP_SNK_SRC_SINK_OFF, vbus is
expected to reach VSAFE0V when source turns off vbus. Do not move
to SNK_UNATTACHED state when this happens.

Bug: 185300749
Fixes: 28b43d3d74 ("usb: typec: tcpm: Introduce vsafe0v for vbus")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210517192112.40934-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
((cherry picked from commit d112efbe6d
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: I94ca93ad5467d6da003a4f504637b4f99a0cf6be
This commit is contained in:
Badhri Jagan Sridharan 2021-05-17 12:21:09 -07:00 committed by Greg Kroah-Hartman
commit ee87839030

View file

@ -5304,6 +5304,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port)
tcpm_set_state(port, SNK_UNATTACHED, 0);
}
break;
case PR_SWAP_SNK_SRC_SINK_OFF:
/* Do nothing, vsafe0v is expected during transition */
break;
default:
if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled)
tcpm_set_state(port, SNK_UNATTACHED, 0);