linux-stable/include/linux/usb
Badhri Jagan Sridharan 599f008c25 usb: typec: tcpm: Add callbacks to mitigate wakeups due to contaminant
On some of the TCPC implementations, when the Type-C port is exposed
to contaminants, such as water, TCPC stops toggling while reporting OPEN
either by the time TCPM reads CC pin status or during CC debounce
window. This causes TCPM to be stuck in TOGGLING state. If TCPM is made
to restart toggling, the behavior recurs causing redundant CPU wakeups
till the USB-C port is free of contaminant.

[206199.287817] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[206199.640337] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[206199.985789] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]

(or)

[ 7853.867577] Start toggling
[ 7853.889921] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[ 7855.698765] CC1: 0 -> 0, CC2: 0 -> 5 [state TOGGLING, polarity 0, connected]
[ 7855.698790] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
[ 7855.698826] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS]
[ 7855.703559] CC1: 0 -> 0, CC2: 5 -> 5 [state SNK_ATTACH_WAIT, polarity 0, connected]
[ 7855.856555] CC1: 0 -> 0, CC2: 5 -> 0 [state SNK_ATTACH_WAIT, polarity 0, disconnected]
[ 7855.856581] state change SNK_ATTACH_WAIT -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
[ 7855.856613] pending state change SNK_ATTACH_WAIT -> SNK_UNATTACHED @ 170 ms [rev3 NONE_AMS]
[ 7856.027744] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [delayed 170 ms]
[ 7856.181949] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[ 7856.187896] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[ 7857.645630] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]
[ 7857.647291] CC1: 0 -> 0, CC2: 0 -> 5 [state TOGGLING, polarity 0, connected]
[ 7857.647298] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
[ 7857.647310] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS]
[ 7857.808106] CC1: 0 -> 0, CC2: 5 -> 0 [state SNK_ATTACH_WAIT, polarity 0, disconnected]
[ 7857.808123] state change SNK_ATTACH_WAIT -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
[ 7857.808150] pending state change SNK_ATTACH_WAIT -> SNK_UNATTACHED @ 170 ms [rev3 NONE_AMS]
[ 7857.978727] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [delayed 170 ms]

To mitigate redundant TCPM wakeups, TCPCs which do have the needed hardware
can implement the check_contaminant callback which is invoked by TCPM
to evaluate for presence of contaminant. Lower level TCPC driver can
restart toggling through TCPM_PORT_CLEAN event when the driver detects
that USB-C port is free of contaminant. check_contaminant callback also
passes the disconnect_while_debounce flag which when true denotes that
the CC pins transitioned to OPEN state during the CC debounce window.

Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230114093246.1933321-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-17 17:29:23 +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 usb: chipidea: Add support for VBUS control with PHY 2022-08-31 09:07:52 +02:00
composite.h
ehci-dbgp.h
ehci_def.h
ehci_pdriver.h
ezusb.h
functionfs.h
g_hid.h
gadget.h
gadget_configfs.h
hcd.h xhci: disable U3 suspended ports in S4 hibernate poweroff_late stage 2022-11-30 12:10:48 +01:00
input.h
iowarrior.h
irda.h
isp116x.h
isp1301.h
isp1362.h
m66592.h
musb-ux500.h
musb.h
net2280.h
of.h
ohci_pdriver.h
onboard_hub.h
otg-fsm.h
otg.h
pd.h
pd_ado.h
pd_bdo.h
pd_ext_sdb.h
pd_vdo.h
phy.h
phy_companion.h
quirks.h
r8a66597.h
r8152.h
renesas_usbhs.h
rndis_host.h
role.h
serial.h usb: serial: Make ->set_termios() old ktermios const 2022-08-30 14:22:35 +02:00
sl811.h
storage.h
tcpci.h usb: typec: tcpci: Move function "tcpci_to_typec_cc" to common 2022-08-19 11:05:12 +02:00
tcpm.h usb: typec: tcpm: Add callbacks to mitigate wakeups due to contaminant 2023-01-17 17:29:23 +01:00
tegra_usb_phy.h
typec.h usb: typec: Add partner PD object wrapper 2022-11-29 08:56:09 +01:00
typec_altmode.h
typec_dp.h usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles 2022-08-18 21:20:07 +02:00
typec_mux.h
typec_retimer.h
typec_tbt.h
uas.h
ulpi.h
usb338x.h
usb_phy_generic.h
usbnet.h SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
xhci-dbgp.h