Re: [PATCH] usb: typec: tcpci: allow drp toggling for non-drp port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/8/23 04:28, Xu Yang wrote:
Some single power role Type-C port with dual data role, this kind of
port connects non Type-C port for usb data will need tcpm to work to
get polarity for orientation change and let Type-C port keep at fake
power role to provide another non-default data role, so remove the drp
port condition for now.

Has anyone encountered this use case? How do you handle this limitation
in current tcpm with a better way? Please kindly share your thoughts.


Have you ? This is an odd comment to make in the patch description.

Either case, I don't understand why one would need to enable toggling
under any circumstances if the port is not DRP. The description does
not explain how "need tcpm to work" correlates to enabling toggling on
non-DRP ports.

Guenter

Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx>
Signed-off-by: Li Jun <jun.li@xxxxxxx>
---
  drivers/usb/typec/tcpm/tcpci.c | 3 ---
  drivers/usb/typec/tcpm/tcpm.c  | 6 +++++-
  2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index fc708c289a73..88559e749120 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -175,9 +175,6 @@ static int tcpci_start_toggling(struct tcpc_dev *tcpc,
  	struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
  	unsigned int reg = TCPC_ROLE_CTRL_DRP;
- if (port_type != TYPEC_PORT_DRP)
-		return -EOPNOTSUPP;
-
  	/* Handle vendor drp toggling */
  	if (tcpci->data->start_drp_toggling) {
  		ret = tcpci->data->start_drp_toggling(tcpci, tcpci->data, cc);
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 3c6b0c8e2d3a..6aa62132e69a 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4274,7 +4274,11 @@ static void run_state_machine(struct tcpm_port *port)
  		ret = tcpm_snk_attach(port);
  		if (ret < 0)
  			tcpm_set_state(port, SNK_UNATTACHED, 0);
-		else
+		else if (port->port_type == TYPEC_PORT_SRC &&
+			 port->typec_caps.data == TYPEC_PORT_DRD) {
+			tcpm_typec_connect(port);
+			tcpm_log(port, "Keep at SNK_ATTACHED for USB data.");
+		} else
  			tcpm_set_state(port, SNK_STARTUP, 0);
  		break;
  	case SNK_STARTUP:




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux