linux/drivers/usb/typec/tcpm
Hans de Goede 48242e3053 usb: typec: fusb302: Revert "Resolve fixed power role contract setup"
Some tcpc device-drivers need to explicitly be told to watch for connection
events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices
being plugged into the Type-C port will not be noticed.

For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to
watch for connection events. But for single-role ports we've so far been
falling back to just calling tcpm_set_cc(). For some tcpc-s such as the
fusb302 this is not enough and no TCPM_CC_EVENT will be generated.

Commit ea3b4d5523 ("usb: typec: fusb302: Resolve fixed power role
contract setup") fixed SRPs not working because of this by making the
fusb302 driver start connection detection on every tcpm_set_cc() call.
It turns out this breaks src->snk power-role swapping because during the
swap we first set the Cc pins to Rp, calling set_cc, and then send a PS_RDY
message. But the fusb302 cannot send PD messages while its toggling engine
is active, so sending the PS_RDY message fails.

Struct tcpc_dev now has a new start_srp_connection_detect callback and
fusb302.c now implements this. This callback gets called when we the
fusb302 needs to start connection detection, fixing fusb302 SRPs not
seeing connected devices.

This allows us to revert the changes to fusb302's set_cc implementation,
making it once again purely setup the Cc-s and matching disconnect
detection, fixing src->snk power-role swapping no longer working.

Note that since the code was refactored in between, codewise this is not a
straight forward revert. Functionality wise this is a straight revert and
the original functionality is fully restored.

Fixes: ea3b4d5523 ("usb: typec: fusb302: Resolve fixed power role ...")
Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19 14:23:34 +02:00
..
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
fusb302.c usb: typec: fusb302: Revert "Resolve fixed power role contract setup" 2019-04-19 14:23:34 +02:00
fusb302_reg.h usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
tcpci.c usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs 2019-04-19 14:23:34 +02:00
tcpci.h usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
tcpci_rt1711h.c usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
tcpm.c usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs 2019-04-19 14:23:34 +02:00
wcove.c usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs 2019-04-19 14:23:34 +02:00