summaryrefslogtreecommitdiff
path: root/drivers/usb/host/xhci-dbgcap.h
AgeCommit message (Collapse)AuthorFilesLines
2024-03-02xhci: dbc: poll at different rate depending on data transfer activityMathias Nyman1-0/+2
DbC driver starts polling for events immediately when DbC is enabled. The current polling interval is 1ms, which keeps the CPU busy, impacting power management even when there are no active data transfers. Solve this by polling at a slower rate, with a 64ms interval as default until a transfer request is queued, or if there are still are pending unhandled transfers at event completion. Tested-by: Uday M Bhat <uday.m.bhat@intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20240229141438.619372-9-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-04xhci: dbc: Use sysfs_emit() to instead of scnprintf()Andy Shevchenko1-0/+1
Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20231201150647.1307406-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-23xhci: dbc: Provide sysfs option to configure dbc descriptorsMathias Nyman1-0/+4
When DbC is enabled the first port on the xHC host acts as a usb device. xHC provides the descriptors automatically when the DbC device is enumerated. Most of the values are hardcoded, but some fields such as idProduct, idVendor, bcdDevice and bInterfaceProtocol can be modified. Add sysfs entries that allow userspace to change these. User can only change them before dbc is enabled, i.e. before writing "enable" to dbc sysfs file as we don't want these values to change while device is connected, or during enumeration. Add documentation for these entries in Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20230317154715.535523-9-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-17xhci: dbgtty: use IDR to support several dbc instances.Mathias Nyman1-0/+1
To support systems with several xhci controllers with active dbc on each xhci we need to use IDR to identify and give an index to each port. Avoid using global struct tty_driver.driver_state for storing dbc port pointer as it won't work with several dbc ports Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220216095153.1303105-6-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-17xhci: dbc: Don't call dbc_tty_init() on every dbc tty probeMathias Nyman1-1/+11
The current workaround to call the dbc_tty_init() in probe is not working in case we have several xhci devices with dbc enabled. dbc_tty_init() should be called only once by a module init call when module is loaded. until dbgtty is its own module call dbc_tty_init() from xhci module init call. Same is true for unloading and dbc_tty_exit() Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220216095153.1303105-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-17xhci: dbc: Rename xhci_dbc_init and xhci_dbc_exitMathias Nyman1-4/+4
These names give the impression the functions are related to module init calls, but are in fact creating and removing the dbc fake device Rename them to xhci_create_dbc_dev() and xhci_remove_dbc_dev(). We will need the _init and _exit names for actual dbc module init and exit calls. No functional changes Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220216095153.1303105-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-17xhci: dbc: create and remove dbc structure in dbgtty driver.Mathias Nyman1-1/+4
Turn the dbgtty closer to a device driver by allocating the dbc structure in its own xhci_dbc_tty_probe() function, and freeing it in xhci_dbc_tty_remove() Remove xhci_do_dbc_exit() as its no longer needed. allocate and create the dbc strcuture in xhci_dbc_tty_probe() Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220216095153.1303105-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: remove tty specific port structure from struct xhci_dbcMathias Nyman1-1/+1
Use a void pointer that any function driver can use instead. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-28-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: Add a operations structure to access driver functionsMathias Nyman1-2/+6
Don't call dbctty driver functions directly from dbc core code. Introduce a new dbc_driver structure that contains function pointers for disconnect and configure operations. The driver (ttydbc) must provide these opeations when creating a dbc. Name the structure dbc_driver instead of dbc_ops as we plan to add more driver configureable values here, such as vid and pid. Decouples dbc and dbctty. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-26-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbctty: split dbc tty driver registration and unregistration functions.Mathias Nyman1-2/+2
Split the dbc tty driver registrations function into separate init and probe parts. The init part will register the tty driver, and should in the future be called from module_init(). The probe part will become the normal probe function, but for now it is called from the init part. The unregister function is s likewise split into remove and exit parts. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-25-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: remove endpoint pointers from dbc_port structureMathias Nyman1-2/+0
dbctty no longer needs references directly to dbc endpoints, so remove them Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-24-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: simplify dbc requests allocation and queueingMathias Nyman1-5/+7
Don't pass endpoint pointer, dbctty should not be aware of struct dbc_ep, knowing the direction is enough. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-23-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: Use dbc structure in the request completion instead of xhci_hcdMathias Nyman1-17/+17
The dbc request completion callback doesn't need a xhci_hcd pointer. The only user of the xhci_hcd pointer in dbgtty request callback was the xhci_warn() function. Change it to dev_warn() instead. While changing the callback function parameter to dbc in struct xhci_requeset, move the struct xhci_request declaraion down a bit in the header file to avoid compiler warinings No functional changes This change helps decoupling xhci and DbC Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-18-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: Pass dbc pointer to get_in/out_ep() helper functions to get endpointsMathias Nyman1-6/+2
Pass dbc pointer instead of struct xhci_hcd pointer to the get_in_ep() and get_out_ep() helper functions. No functional changes This change helps decoupling xhci and DbC Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-17-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbgtty: Pass dbc pointer when registering a dbctty deviceMathias Nyman1-2/+2
Pass dbc pointer to the xhci_dbc_tty_register_device() and xhci_dbc_tty_unregister_device() functions instead of xhci_hcd pointer These functions don't need a xhci_hcd pointer anymore, only use case was the xhci_err() function, which is now changed to a dev_err() instead. No functional changes This change helps decoupling xhci and DbC Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-16-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23xhci: dbc: Add device pointer to dbc structureMathias Nyman1-0/+1
Currently the dbc structure contains a pointer to struct xhci_hcd, and dbc functions use that to dig up the underlying device pointer. We are trying to decouple xhci and dbc code, and prepare for code that use dbc such as dbctty into into real device drivers. This is one step along the way. Keep functionality the same and keep the xhci pointer, and let the new device pointer point to the xhci device for now. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-8-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: xhci: dbc: Add SPDX identifiers to dbc filesLu Baolu1-1/+1
Update the xhci dbc files with the correct SPDX license identifiers. Fixes: dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver") Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Philippe Ombredanne <pombredanne@nexB.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08usb: xhci: Add DbC support in xHCI driverLu Baolu1-0/+229
xHCI compatible USB host controllers(i.e. super-speed USB3 controllers) can be implemented with the Debug Capability(DbC). It presents a debug device which is fully compliant with the USB framework and provides the equivalent of a very high performance full-duplex serial link. The debug capability operation model and registers interface are defined in 7.6.8 of the xHCI specification, revision 1.1. The DbC debug device shares a root port with the xHCI host. By default, the debug capability is disabled and the root port is assigned to xHCI. When the DbC is enabled, the root port will be assigned to the DbC debug device, and the xHCI sees nothing on this port. This implementation uses a sysfs node named <dbc> under the xHCI device to manage the enabling and disabling of the debug capability. When the debug capability is enabled, it will present a debug device through the debug port. This debug device is fully compliant with the USB3 framework, and it can be enumerated by a debug host on the other end of the USB link. As soon as the debug device is configured, a TTY serial device named /dev/ttyDBC0 will be created. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>