]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: typec: ucsi: Add support for SET_PDOS command
authorPooja Katiyar <pooja.katiyar@intel.com>
Tue, 19 May 2026 18:45:14 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 May 2026 09:35:50 +0000 (11:35 +0200)
Add support for UCSI SET_PDOS command as per UCSI specification v2.1 and
above to debugfs.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Pooja Katiyar <pooja.katiyar@intel.com>
Link: https://patch.msgid.link/e3e127122c0a6910c4840a13d5c74ab5fc4eb868.1778798352.git.pooja.katiyar@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/debugfs.c
drivers/usb/typec/ucsi/ucsi.h

index be987e53a8bd123c8626b2d493e30905fa86c477..ff33a5e7c6b0dd9766e0185ec8dd15f549e9768e 100644 (file)
@@ -40,6 +40,11 @@ static int ucsi_cmd(void *data, u64 val)
        case UCSI_READ_POWER_LEVEL:
                ret = ucsi_send_command(ucsi, val, NULL, 0);
                break;
+       case UCSI_SET_PDOS:
+               ret = ucsi_write_message_out_command(ucsi, val, NULL, 0,
+                                                    ucsi->debugfs->message_out,
+                                                    UCSI_COMMAND_DATA_LEN(val));
+               break;
        case UCSI_GET_CAPABILITY:
        case UCSI_GET_CONNECTOR_CAPABILITY:
        case UCSI_GET_ALTERNATE_MODES:
index 64ccfd6a6d502b048c2e2c2d6d774e6cfa6e73ac..325ed1e5ca804c8562f507c77339ebb24aa04831 100644 (file)
@@ -138,6 +138,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num);
 #define UCSI_GET_PD_MESSAGE                    0x15
 #define UCSI_GET_CAM_CS                        0x18
 #define UCSI_SET_SINK_PATH                     0x1c
+#define UCSI_SET_PDOS                          0x1d
 #define UCSI_READ_POWER_LEVEL                  0x1e
 #define UCSI_SET_USB                           0x21
 #define UCSI_GET_LPM_PPM_INFO                  0x22
@@ -215,6 +216,9 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num);
 #define   UCSI_GET_PD_MESSAGE_TYPE_IDENTITY    4
 #define   UCSI_GET_PD_MESSAGE_TYPE_REVISION    5
 
+/* Data length bits */
+#define UCSI_COMMAND_DATA_LEN(_cmd_)           (((_cmd_) >> 8) & GENMASK(7, 0))
+
 /* -------------------------------------------------------------------------- */
 
 /* Error information returned by PPM in response to GET_ERROR_STATUS command. */