linux/drivers/usb/typec
ChiYuan Huang 36f78477ac usb: typec: tcpm: Fix altmode re-registration causes sysfs create fail
There's the altmode re-registeration issue after data role
swap (DR_SWAP).

Comparing to USBPD 2.0, in USBPD 3.0, it loose the limit that only DFP
can initiate the VDM command to get partner identity information.

For a USBPD 3.0 UFP device, it may already get the identity information
from its port partner before DR_SWAP. If DR_SWAP send or receive at the
mean time, 'send_discover' flag will be raised again. It causes discover
identify action restart while entering ready state. And after all
discover actions are done, the 'tcpm_register_altmodes' will be called.
If old altmode is not unregistered, this sysfs create fail can be found.

In 'DR_SWAP_CHANGE_DR' state case, only DFP will unregister altmodes.
For UFP, the original altmodes keep registered.

This patch fix the logic that after DR_SWAP, 'tcpm_unregister_altmodes'
must be called whatever the current data role is.

Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>
Fixes: ae8a2ca8a2 ("usb: typec: Group all TCPCI/TCPM code together")
Reported-by: TommyYl Chen <tommyyl.chen@mediatek.com>
Cc: stable@vger.kernel.org
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/1673248790-15794-1-git-send-email-cy_huang@richtek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-17 17:09:27 +01:00
..
altmodes usb: typec: altmodes/displayport: Use proper macro for pin assignment check 2023-01-17 17:07:25 +01:00
mux usb: typec: mux: Enter safe mode only when pins need to be reconfigured 2022-11-08 16:51:06 +01:00
tcpm usb: typec: tcpm: Fix altmode re-registration causes sysfs create fail 2023-01-17 17:09:27 +01:00
tipd usb: typec: tipd: Set mode of operation for USB Type-C connector 2022-12-08 16:45:10 +01:00
ucsi usb: ucsi: Ensure connector delayed work items are flushed 2023-01-17 17:06:18 +01:00
anx7411.c usb: typec: anx7411: Convert to i2c's .probe_new() 2022-11-22 17:33:27 +01:00
bus.c usb: typec: Check for ops->exit instead of ops->enter in altmode_exit 2022-11-22 17:27:27 +01:00
bus.h usb: typec: Organize the private headers properly 2021-04-05 09:07:41 +02:00
class.c usb: typec: Add partner PD object wrapper 2022-11-29 08:56:09 +01:00
class.h usb: typec: Add retimer handle to port 2022-07-14 16:24:05 +02:00
hd3ss3220.c usb: typec: hd3ss3220: Convert to i2c's .probe_new() 2022-11-22 17:33:27 +01:00
Kconfig usb: typec: anx7411: Fix build error without CONFIG_POWER_SUPPLY 2022-09-22 15:21:03 +02:00
Makefile usb: typec: Add support for retimers 2022-07-14 16:24:05 +02:00
mux.c device property: Constify fwnode connection match APIs 2022-10-22 13:49:55 +02:00
mux.h usb: typec: mux: Introduce indirection 2022-04-26 13:47:13 +02:00
pd.c usb: typec: Separate USB Power Delivery from USB Type-C 2022-06-12 06:49:47 +02:00
pd.h usb: typec: Separate USB Power Delivery from USB Type-C 2022-06-12 06:49:47 +02:00
port-mapper.c ACPI: bus: Introduce acpi_bus_for_each_dev() 2022-03-02 20:55:47 +01:00
qcom-pmic-typec.c usb: typec: qcom-pmic-typec: Switch to use dev_err_probe() helper 2022-09-27 10:35:46 +02:00
retimer.c Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
retimer.h usb: typec: retimer: Use device type for matching 2022-10-22 13:22:51 +02:00
rt1719.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
stusb160x.c USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
wusb3801.c usb: typec: wusb3801: fix fwnode refcount leak in wusb3801_probe() 2022-12-08 16:43:22 +01:00