diff options
| author | Kuen-Han Tsai <khtsai@google.com> | 2025-08-22 17:23:45 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-09-06 15:21:59 +0200 |
| commit | 55f4ac8f93f4281134dfcf47de7b4588bb6074f2 (patch) | |
| tree | 2c24b3cda034f396e14857b7b9d63271ef7af83d /drivers/usb/dwc3/debug.h | |
| parent | b570b346ddd727c4b41743a6a2f49e7217c5317f (diff) | |
usb: dwc3: Add trace event for dwc3_set_prtcap
Changes to the port capability can be indirectly observed by tracing
register writes to DWC3_GCTL. However, this requires interpreting the
raw value, which is neither intuitive nor precise for debugging.
Monitoring these mode changes is essential for resolving issues related
to USB role switching and enumeration.
Introduce a dedicated trace event to provide a human-readable log when
the port capability is configured.
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20250822092411.173519-1-khtsai@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc3/debug.h')
| -rw-r--r-- | drivers/usb/dwc3/debug.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h index 09d703852a92..6e1cdcdce7cc 100644 --- a/drivers/usb/dwc3/debug.h +++ b/drivers/usb/dwc3/debug.h @@ -14,6 +14,24 @@ #include "core.h" /** + * dwc3_mode_string - returns mode name + * @mode: GCTL.PrtCapDir value + */ +static inline const char *dwc3_mode_string(u32 mode) +{ + switch (mode) { + case DWC3_GCTL_PRTCAP_HOST: + return "host"; + case DWC3_GCTL_PRTCAP_DEVICE: + return "device"; + case DWC3_GCTL_PRTCAP_OTG: + return "otg"; + default: + return "UNKNOWN"; + } +} + +/** * dwc3_gadget_ep_cmd_string - returns endpoint command string * @cmd: command code */ |