linux-stable/include/linux/usb
Badhri Jagan Sridharan 28b43d3d74 usb: typec: tcpm: Introduce vsafe0v for vbus
TCPM at present lacks the notion of VSAFE0V. There
are three vbus threshold levels that are critical to track:
a. vSafe5V         - VBUS “5 volts” as defined by the USB
                     PD specification.
b. vSinkDisconnect - Threshold used for transition from
                     Attached.SNK to Unattached.SNK.
c. vSafe0V         - VBUS “0 volts” as defined by the USB
                     PD specification.

Tracking vSafe0V is crucial for entry into Try.SNK and
Attached.SRC and turning vbus back on by the source in
response to hard reset.

>From "4.5.2.2.8.2 Exiting from AttachWait.SRC State" section
in the Type-C spec:

"The port shall transition to Attached.SRC when VBUS is at
vSafe0V and the SRC.Rd state is detected on exactly one of
the CC1 or CC2 pins for at least tCCDebounce."

"A DRP that strongly prefers the Sink role may optionally
transition to Try.SNK instead of Attached.SRC when VBUS
is at vSafe0V and the SRC.Rd state is detected on exactly
one of the CC1 or CC2 pins for at least tCCDebounce."

>From "7.1.5 Response to Hard Resets" section in the PD spec:

"After establishing the vSafe0V voltage condition on VBUS,
the Source Shall wait tSrcRecover before re-applying VCONN
and restoring VBUS to vSafe5V."

vbus_present in the TCPM code tracks vSafe5V(vbus_present is true)
and vSinkDisconnect(vbus_present is false).

This change adds is_vbus_vsafe0v callback which when set makes
TCPM query for vSafe0V voltage level when needed.

Since not all TCPC controllers might have the capability
to report vSafe0V, TCPM assumes that vSafe0V is same as
vSinkDisconnect when is_vbus_vsafe0v callback is not set.
This allows TCPM to continue to support controllers which don't
have the support for reporting vSafe0V.

Introducing vSafe0V helps fix the failure reported at
"Step 15. CVS verifies PUT remains in AttachWait.SRC for 500ms"
of "TD 4.7.2 Try. SNK DRP Connect DRP Test" of
"Universal Serial Bus Type-C (USB Type-C) Functional Test
Specification Chapters 4 and 5". Here the compliance tester
intentionally maintains vbus at greater than vSafe0V and expects
the Product under test to stay in AttachWait.SRC till vbus drops
to vSafe0V.

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/20201202040840.663578-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-09 14:49:54 +01:00
..
audio-v2.h
audio-v3.h
audio.h
c67x00.h
ccid.h
cdc-wdm.h
cdc.h
cdc_ncm.h
ch9.h
chipidea.h
composite.h usb: fix kernel-doc markups 2020-10-28 13:18:56 +01:00
ehci-dbgp.h
ehci_def.h
ehci_pdriver.h
ezusb.h
functionfs.h
g_hid.h
gadget.h
gadget_configfs.h
hcd.h usb: hcd.h: Remove RUN_CONTEXT 2020-11-14 11:24:49 +01:00
input.h
iowarrior.h
irda.h
isp116x.h
isp1301.h
isp1362.h
isp1760.h
m66592.h
musb-ux500.h
musb.h
net2280.h
of.h
ohci_pdriver.h
otg-fsm.h
otg.h
pd.h usb: typec: tcpm: Stay in SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS till Rp is seen 2020-11-26 13:40:38 +01:00
pd_ado.h
pd_bdo.h
pd_ext_sdb.h
pd_vdo.h usb: pd: DFP product types 2020-11-26 09:18:56 +01:00
phy.h
phy_companion.h
quirks.h
r8a66597.h
renesas_usbhs.h
rndis_host.h
role.h
serial.h
sl811.h
storage.h
tcpm.h usb: typec: tcpm: Introduce vsafe0v for vbus 2020-12-09 14:49:54 +01:00
tegra_usb_phy.h
typec.h usb: typec: Add plug num_altmodes sysfs attr 2020-11-18 13:15:58 +01:00
typec_altmode.h
typec_dp.h
typec_mux.h
typec_tbt.h usb: typec: Remove one bit support for the Thunderbolt rounded/non-rounded cable 2020-11-18 12:53:45 +01:00
uas.h
ulpi.h
usb338x.h
usb_phy_generic.h
usbnet.h
xhci-dbgp.h