usb: typec: tcpm: AMS and Collision Avoidance
authorKyle Tso <kyletso@google.com>
Thu, 14 Jan 2021 14:50:51 +0000 (22:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jan 2021 11:23:32 +0000 (12:23 +0100)
commit0908c5aca31eb5e0c72d7a5dba422629b88e877d
treec51b47c927a08bd141b3bab5b8819665e2f30972
parent7a79f1f7f7e75e532c5a803ab3ebf42a3e79497c
usb: typec: tcpm: AMS and Collision Avoidance

This patch provides the implementation of Collision Avoidance introduced
in PD3.0. The start of each Atomic Message Sequence (AMS) initiated by
the port will be denied if the current AMS is not interruptible. The
Source port will set the CC to SinkTxNG if it is going to initiate an
AMS, and SinkTxOk otherwise. Meanwhile, any AMS initiated by a Sink port
will be denied in TCPM if the port partner (Source) sets SinkTxNG except
for HARD_RESET and SOFT_RESET.

Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210114145053.1952756-2-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c
include/linux/usb/pd.h
include/linux/usb/tcpm.h