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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251007000007.3724229-3-jthies@google.com>
Date: Tue,  7 Oct 2025 00:00:03 +0000
From: Jameson Thies <jthies@...gle.com>
To: heikki.krogerus@...ux.intel.com, linux-usb@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Cc: jthies@...gle.com, dmitry.baryshkov@....qualcomm.com, bleung@...omium.org, 
	gregkh@...uxfoundation.org, akuchynski@...omium.org, 
	abhishekpandit@...omium.org, sebastian.reichel@...labora.com, 
	linux-pm@...r.kernel.org
Subject: [PATCH 2/6] usb: typec: ucsi: psy: Add support for DRP USB type

The USB Type registered with the power supply class is based on the
current power operation mode of the port. When the port is using USB
PD and is connected to a DRP partner, report that the power supply's
USB type is USB PD DRP.

Signed-off-by: Jameson Thies <jthies@...gle.com>
---
 drivers/usb/typec/ucsi/psy.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/ucsi/psy.c b/drivers/usb/typec/ucsi/psy.c
index 2b0225821502..985a90d3f898 100644
--- a/drivers/usb/typec/ucsi/psy.c
+++ b/drivers/usb/typec/ucsi/psy.c
@@ -209,8 +209,16 @@ static int ucsi_psy_get_usb_type(struct ucsi_connector *con,
 {
 	val->intval = POWER_SUPPLY_USB_TYPE_C;
 	if (UCSI_CONSTAT(con, CONNECTED) &&
-	    UCSI_CONSTAT(con, PWR_OPMODE) == UCSI_CONSTAT_PWR_OPMODE_PD)
+	    UCSI_CONSTAT(con, PWR_OPMODE) == UCSI_CONSTAT_PWR_OPMODE_PD) {
+		for (int i = 0; i < con->num_pdos; i++) {
+			if (pdo_type(con->src_pdos[i]) == PDO_TYPE_FIXED &&
+			    con->src_pdos[i] & PDO_FIXED_DUAL_ROLE) {
+				val->intval = POWER_SUPPLY_USB_TYPE_PD_DRP;
+				return 0;
+			}
+		}
 		val->intval = POWER_SUPPLY_USB_TYPE_PD;
+	}
 
 	return 0;
 }
-- 
2.51.0.618.g983fd99d29-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ