OSDN Git Service

usb: typec: ucsi: Add debugfs for ucsi commands
authorSaranya Gopal <saranya.gopal@intel.com>
Mon, 7 Aug 2023 10:52:05 +0000 (16:22 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Aug 2023 08:36:18 +0000 (10:36 +0200)
commitdf0383ffad64dc09954a60873c1e202b47f08d90
treeeaa855def449a2d8145f6ea4f759897a58f541cf
parent3b563b901eefb47ce27a9897dea2739abe70ee5a
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>
drivers/usb/typec/ucsi/Kconfig
drivers/usb/typec/ucsi/Makefile
drivers/usb/typec/ucsi/debugfs.c [new file with mode: 0644]
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/typec/ucsi/ucsi.h