lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250909-tcpci-non-drp-connection-v1-1-e09c7d877d44@oss.qualcomm.com>
Date: Tue, 09 Sep 2025 02:36:51 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
To: Badhri Jagan Sridharan <badhri@...gle.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] usb: typec: tcpci: report connection status for non-DRP
 devices

TCPM core calls start_toggling() unconditionally, but TCPCI simply
returns -EOPNOTSUPP in such a case, ignoring the current 'connected'
status. Make TCPCI driver check CC lines status and report current
connected status.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
---
 drivers/usb/typec/tcpm/tcpci.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index a56e31b20c214fc509423d2f8602d3599c1dd2c1..9d57c73b49674858d799790c5c8cb0d929841def 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -178,6 +178,8 @@ static int tcpci_apply_rc(struct tcpc_dev *tcpc, enum typec_cc_status cc,
 				  TCPC_ROLE_CTRL_CC_OPEN);
 }
 
+static int tcpci_get_cc(struct tcpc_dev *tcpc,
+			enum typec_cc_status *cc1, enum typec_cc_status *cc2);
 static int tcpci_start_toggling(struct tcpc_dev *tcpc,
 				enum typec_port_type port_type,
 				enum typec_cc_status cc)
@@ -186,8 +188,17 @@ 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)
+	if (port_type != TYPEC_PORT_DRP) {
+		enum typec_cc_status cc1, cc2;
+
+		ret = tcpci_get_cc(tcpc, &cc1, &cc2);
+		if (ret)
+			return ret;
+
+		tcpm_cc_change(tcpci->port);
+
 		return -EOPNOTSUPP;
+	}
 
 	/* Handle vendor drp toggling */
 	if (tcpci->data->start_drp_toggling) {

---
base-commit: be5d4872e528796df9d7425f2bd9b3893eb3a42c
change-id: 20250908-tcpci-non-drp-connection-bacd9a5d24bc

Best regards,
-- 
With best wishes
Dmitry


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ