usb: typec: ucsi: Add support for USB role switch
authorMayank Rana <mrana@codeaurora.org>
Mon, 11 Jan 2021 21:55:20 +0000 (13:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 11:56:27 +0000 (12:56 +0100)
commit89795852c9c46b9b0701f7376d30a1c5ab4d146c
tree75a24e4c4236d374c7e429538ea7f13935bab7dc
parent53febc9569008859c8bcdfead2c7ce46451466b0
usb: typec: ucsi: Add support for USB role switch

UCSI already conveys the information about a port's connection
status, whether it is operating in UFP or DFP mode, and whether the
partner supports USB data or not. This information can be used to
notify a dual-role controller to start up its host or peripheral
mode accordingly. Add optional support for this by querying each
port's fwnode to look for an associated USB role switch device.
If present, call usb_role_switch_set() with the determined data
role upon Connect Change or Connector Partner Change updates.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Link: https://lore.kernel.org/r/20210111215520.18476-1-jackp@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/typec/ucsi/ucsi.h