Re: [PATCH 2/6] usb: typec: ucsi: psy: Add support for DRP USB type
From: Heikki Krogerus
Date: Wed Oct 08 2025 - 09:02:56 EST
On Tue, Oct 07, 2025 at 12:00:03AM +0000, Jameson Thies wrote:
> 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@xxxxxxxxxx>
Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> ---
> 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
--
heikki