[PATCH v3 00/12] usb: typec: add SOP' support to the tcpm and alt mode drivers

RD Babiera
2024-01-08T19:16:30Z

Extend the TCPM's functionality to include support for SOP' messages.
This feature is opt-in: TCPCI chip drivers opt into sending and receiving
SOP' messages. TCPCI drivers will also be expected to take the SOP frame
type in order to process SOP' messages within the TCPM. Specifically,
the exisiting API tcpm_pd_receive now takes tcpm_transmit_type as input.
The Maxim TCPCI implements this in Patch 4.

Discover Identity, Discover SVIDs, Discover Modes, and Alt Mode SVDM
support are included within the patchset. Because the port is expected to
be the Vconn source in order to communicate with the cable, TCPCI chip
drivers opt into performing a Vconn swap after Discover Identity on SOP
before performing Discover Identity on SOP'.

typec_cable_ops are defined to facilitate communication between the alt
mode drivers and the cable plugs. 2 new apis allow the alt mode drivers
to enter and exit mode on active cable plugs. A third is used by alt mode
drivers to send VDMs to the cable plugs or by the TCPM to return the
resulting VDM from the cable plug to the alt mode drivers.
---
Changes since v1:
* Add typec_cable_ops as replacement for changing typec_altmode_ops
interface. Displayport driver patch now reflects this
* Separate patch for cable SVDM versioning.
* Separate patch for tcpm_pd_receive() api changes and cable_comm_capable
addition to tcpci.
* Separate patches for Discover SVIDs/Discover Modes and Alt Mode
operations on SOP'.

Changes since v2:
* Style changes, bugfix for lock in displayport.c, bugfix in tcpm.c that
restores code deleted by patch.

RD Babiera (12):
usb: typec: altmodes: add typec_cable_ops to typec_altmode
usb: typec: altmodes: add svdm version info for typec cables
usb: typec: tcpci: add cable_comm_capable attribute
usb: typec: tcpci: add tcpm_transmit_type to tcpm_pd_receive
usb: typec: tcpm: process receive and transmission of sop' messages
usb: typec: tcpm: add control message support to sop'
usb: typec: tcpci: add attempt_vconn_swap_discovery callback
usb: typec: tcpm: add discover identity support for SOP'
usb: typec: tcpm: add state machine support for
SRC_VDM_IDENTITY_REQUEST
usb: typec: tcpm: add discover svids and discover modes support for
sop'
usb: typec: tcpm: add alt mode enter/exit/vdm support for sop'
usb: typec: altmodes/displayport: add SOP' support

drivers/usb/typec/altmodes/displayport.c | 162 ++-
drivers/usb/typec/bus.c | 102 ++
drivers/usb/typec/class.c | 59 +
drivers/usb/typec/class.h | 1 +
drivers/usb/typec/tcpm/fusb302.c | 2 +-
.../typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 2 +-
drivers/usb/typec/tcpm/tcpci.c | 26 +-
drivers/usb/typec/tcpm/tcpci_maxim.h | 1 +
drivers/usb/typec/tcpm/tcpci_maxim_core.c | 38 +-
drivers/usb/typec/tcpm/tcpm.c | 1030 ++++++++++++++---
drivers/usb/typec/tcpm/wcove.c | 2 +-
include/linux/usb/pd.h | 1 +
include/linux/usb/pd_vdo.h | 8 +-
include/linux/usb/tcpci.h | 13 +
include/linux/usb/tcpm.h | 16 +-
include/linux/usb/typec.h | 7 +
include/linux/usb/typec_altmode.h | 30 +
17 files changed, 1337 insertions(+), 163 deletions(-)

base-commit: 933bb7b878ddd0f8c094db45551a7daddf806e00
--
2.43.0.472.g3155946c3a-goog