summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPooja Katiyar <pooja.katiyar@intel.com>2026-05-19 21:45:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-05-22 12:35:50 +0300
commitcc15435481696c09668934cd84ea1a8c63ebecb5 (patch)
tree75cf3e054e41df9bda1a87e4e9c48965916f6fc1
parent201b015f95b8d6276d467f81c150ec491c7bda26 (diff)
downloadlinux-cc15435481696c09668934cd84ea1a8c63ebecb5.tar.xz
usb: typec: ucsi: Add support for SET_PDOS command
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>
-rw-r--r--drivers/usb/typec/ucsi/debugfs.c5
-rw-r--r--drivers/usb/typec/ucsi/ucsi.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/typec/ucsi/debugfs.c b/drivers/usb/typec/ucsi/debugfs.c
index be987e53a8bd..ff33a5e7c6b0 100644
--- a/drivers/usb/typec/ucsi/debugfs.c
+++ b/drivers/usb/typec/ucsi/debugfs.c
@@ -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:
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 64ccfd6a6d50..325ed1e5ca80 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -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. */