]> git.ipfire.org Git - thirdparty/linux.git/commit
usb: typec: tcpm/tcpci_maxim: fix non-contaminant CC handling
authorAndré Draszik <andre.draszik@linaro.org>
Tue, 6 Aug 2024 16:25:24 +0000 (17:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Aug 2024 08:31:12 +0000 (10:31 +0200)
commitc6a6c7d0c07a84cea80310fde8030e30fa8bb754
treed45f6e7a6d848c762b0bb7f2bae3fe97228a8b7f
parent38343be0bf9a7d7ef0d160da5f2db887a0e29b62
usb: typec: tcpm/tcpci_maxim: fix non-contaminant CC handling

tcpci_maxim currently never triggers the TCPM state machine when CC
status has not changed due to a contaminant but due to a real
connection event, i.e. a genuine plug event, meaning the system will
stay idle and not notify any subscribers.

The reason is that the initial state of the port is 'toggling', which
causes _max_tcpci_irq() to only drive the contamination part of the
TCPM state machine (via tcpm_port_clean()).

What should happen instead is that if no contamination was detected,
the TCPM should be notified of the CC change in this case.

To fix this, we update ...is_contaminant() to also allow its caller to
determine if more CC processing is required and then call into the TCPM
as required.

While at it, add a kernel-doc for max_contaminant_is_contaminant().

Note: the code has an issue where I2C errors during contaminant
detection also cause the TCPM state machine to not be updated. This
commit doesn't change this behaviour and should be addressed by
follow-up commit(s).

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240806-max33359-toggling-v2-1-a66ab37baafb@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/maxim_contaminant.c
drivers/usb/typec/tcpm/tcpci_maxim.h
drivers/usb/typec/tcpm/tcpci_maxim_core.c