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.c | |
parent | 3b563b901eefb47ce27a9897dea2739abe70ee5a (diff) | |
download | linux-df0383ffad64dc09954a60873c1e202b47f08d90.tar.gz linux-df0383ffad64dc09954a60873c1e202b47f08d90.tar.bz2 linux-df0383ffad64dc09954a60873c1e202b47f08d90.zip |
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.c')
-rw-r--r-- | drivers/usb/typec/ucsi/ucsi.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index f6901319639d..c6dfe3dff346 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1530,6 +1530,7 @@ EXPORT_SYMBOL_GPL(ucsi_create); */ void ucsi_destroy(struct ucsi *ucsi) { + ucsi_debugfs_unregister(ucsi); kfree(ucsi); } EXPORT_SYMBOL_GPL(ucsi_destroy); @@ -1552,6 +1553,7 @@ int ucsi_register(struct ucsi *ucsi) queue_delayed_work(system_long_wq, &ucsi->work, 0); + ucsi_debugfs_register(ucsi); return 0; } EXPORT_SYMBOL_GPL(ucsi_register); @@ -1611,6 +1613,19 @@ void ucsi_unregister(struct ucsi *ucsi) } EXPORT_SYMBOL_GPL(ucsi_unregister); +static int __init ucsi_module_init(void) +{ + ucsi_debugfs_init(); + return 0; +} +module_init(ucsi_module_init); + +static void __exit ucsi_module_exit(void) +{ + ucsi_debugfs_exit(); +} +module_exit(ucsi_module_exit); + MODULE_AUTHOR("Heikki Krogerus <heikki.krogerus@linux.intel.com>"); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("USB Type-C Connector System Software Interface driver"); |