Re: [PATCH] usb: typec: add trace point for typec_set_mode
From: Heikki Krogerus
Date: Thu Jun 18 2026 - 06:58:35 EST
Hi Ahmad,
On Wed, Jun 17, 2026 at 10:03:04PM +0200, Ahmad Fatoum wrote:
> Some Type-C controllers toggle muxes themselves. Other controllers like
> the TUSB320 report the mode to the host, so it can control the muxes.
>
> To improve debuggability of both kinds of drivers, add a trace point that
> can be used to keep track of the mode being set inside the Type-C
> framework:
>
> echo 1 > /sys/kernel/debug/tracing/events/typec/typec_mode/enable
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
> MAINTAINERS | 1 +
> drivers/usb/typec/class.c | 9 ++++++++-
> include/trace/events/typec.h | 36 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 45 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c8d4b913f26c..ddd59e5e6eaf 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -27753,6 +27753,7 @@ F: Documentation/ABI/testing/sysfs-class-typec
> F: Documentation/driver-api/usb/typec.rst
> F: drivers/usb/typec/
> F: include/linux/usb/typec.h
> +F: include/trace/events/typec*.h
>
> USB TYPEC INTEL PMC MUX DRIVER
> M: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 0977581ad1b6..9316d067f19a 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -20,6 +20,9 @@
> #include "class.h"
> #include "pd.h"
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/typec.h>
Those should probable go to drivers/usb/typec/trace.c and then you
need add something like this to drivers/usb/typec/Makefile:
obj-$(CONFIG_TYPEC) += typec.o
typec-y := class.o mux.o bus.o pd.o retimer.o mode_selection.o
typec-$(CONFIG_ACPI) += port-mapper.o
+typec-$(CONFIG_TRACING) += trace.o
obj-$(CONFIG_TYPEC) += altmodes/
obj-$(CONFIG_TYPEC_TCPM) += tcpm/
obj-$(CONFIG_TYPEC_UCSI) += ucsi/
Thanks,
--
heikki