diff options
author | Saranya Gopal <saranya.gopal@intel.com> | 2023-08-07 16:22:05 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-08 10:36:18 +0200 |
commit | df0383ffad64dc09954a60873c1e202b47f08d90 (patch) | |
tree | eaa855def449a2d8145f6ea4f759897a58f541cf /drivers/usb/typec/ucsi/ucsi.h | |
parent | 3b563b901eefb47ce27a9897dea2739abe70ee5a (diff) |
usb: typec: ucsi: Add debugfs for ucsi commands
Add support for UCSI commands through the following debugfs:
# /sys/kernel/debug/usb/ucsi/$UCSI_DEVICE/command
# /sys/kernel/debug/usb/ucsi/$UCSI_DEVICE/response
Eg: To execute UCSI GetCapabilities:
# echo 0x6 > /sys/kernel/debug/usb/ucsi/<ucsi device>/command
Then read the result,
# cat /sys/kernel/debug/usb/ucsi/<ucsi device>/response
0x02000320000000020000ff0400000445
UCSI command will be written into the command file and the
response for the command can be viewed under the response file.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Co-developed-by: Rajaram Regupathy <rajaram.regupathy@intel.com>
Signed-off-by: Rajaram Regupathy <rajaram.regupathy@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230807105205.742819-1-saranya.gopal@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/ucsi/ucsi.h')
-rw-r--r-- | drivers/usb/typec/ucsi/ucsi.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index c09af859f573..474315a72c77 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -15,6 +15,7 @@ struct ucsi; struct ucsi_altmode; +struct dentry; /* UCSI offsets (Bytes) */ #define UCSI_VERSION 0 @@ -277,6 +278,16 @@ struct ucsi_connector_status { /* -------------------------------------------------------------------------- */ +struct ucsi_debugfs_entry { + u64 command; + struct ucsi_data { + u64 low; + u64 high; + } response; + u32 status; + struct dentry *dentry; +}; + struct ucsi { u16 version; struct device *dev; @@ -286,6 +297,7 @@ struct ucsi { struct ucsi_capability cap; struct ucsi_connector *connector; + struct ucsi_debugfs_entry *debugfs; struct work_struct resume_work; struct delayed_work work; @@ -388,6 +400,18 @@ static inline void ucsi_displayport_remove_partner(struct typec_altmode *adev) { } #endif /* CONFIG_TYPEC_DP_ALTMODE */ +#ifdef CONFIG_DEBUG_FS +void ucsi_debugfs_init(void); +void ucsi_debugfs_exit(void); +void ucsi_debugfs_register(struct ucsi *ucsi); +void ucsi_debugfs_unregister(struct ucsi *ucsi); +#else +static inline void ucsi_debugfs_init(void) { } +static inline void ucsi_debugfs_exit(void) { } +static inline void ucsi_debugfs_register(struct ucsi *ucsi) { } +static inline void ucsi_debugfs_unregister(struct ucsi *ucsi) { } +#endif /* CONFIG_DEBUG_FS */ + /* * NVIDIA VirtualLink (svid 0x955) has two altmode. VirtualLink * DP mode with vdo=0x1 and NVIDIA test mode with vdo=0x3 |