chrome/platform: cros_ec_proto: Add trace event to trace EC commands
Subsystems (2)
PATCH v3 1/1 chrome/platform: cros_ec_proto: Add trace event to trace EC commands
This is useful to see which EC commands are being executed and when.
To enable:
echo 'cros_ec:*' >> /sys/kernel/debug/tracing/set_event
Example:
/* cros_ec_cmd: version: 0, command: GET_VERSION */
/* cros_ec_cmd: version: 0, command: GET_PROTOCOL_INFO */
/* cros_ec_cmd: version: 1, command: GET_CMD_VERSIONS */
/* cros_ec_cmd: version: 1, command: USB_PD_CONTROL */Signed-off-by Raul E Rangel <[email protected]>
---
Changes in v3:
- Use a macro to avoid duplicating the ec command names.
Changes in v2:
- Changed comment style to match other cros_ec files.
- Fixed commit tag.
drivers/platform/chrome/Makefile | 4 +- drivers/platform/chrome/cros_ec_proto.c | 4 + drivers/platform/chrome/cros_ec_trace.c | 162 ++++++++++++++++++++++++ drivers/platform/chrome/cros_ec_trace.h | 51 ++++++++ 4 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 drivers/platform/chrome/cros_ec_trace.c create mode 100644 drivers/platform/chrome/cros_ec_trace.h
drivers/platform/chrome/Makefile +3 -1
@@ -3,12 +3,14 @@ obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o obj-$(CONFIG_CHROMEOS_TBMC) += chromeos_tbmc.o +# tell define_trace.h where to find the cros ec trace header +CFLAGS_cros_ec_trace.o:= -I$(src) obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o cros_ec_lpcs-objs := cros_ec_lpc.o cros_ec_lpc_reg.o cros_ec_lpcs-$(CONFIG_CROS_EC_LPC_MEC) += cros_ec_lpc_mec.o obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpcs.o -obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o +obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o cros_ec_trace.o obj-$(CONFIG_CROS_KBD_LED_BACKLIGHT) += cros_kbd_led_backlight.o obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o
drivers/platform/chrome/cros_ec_proto.c +4 -0
@@ -10,6 +10,8 @@#include <linux/slab.h> #include <asm/unaligned.h> +#include "cros_ec_trace.h" +#define EC_COMMAND_RETRIES 50 static int prepare_packet(struct cros_ec_device *ec_dev,
@@ -51,6 +53,8 @@ static int send_command(struct cros_ec_device *ec_dev,int ret;int (*xfer_fxn)(struct cros_ec_device *ec,struct cros_ec_command *msg); +trace_cros_ec_cmd (msg); +if (ec_dev->proto_version >2 ) xfer_fxn = ec_dev->pkt_xfer;else
drivers/platform/chrome/cros_ec_trace.c new file +162 -0
162 lines not on this page · raw message
drivers/platform/chrome/cros_ec_trace.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.21.0.392.gf8f6787159e-goog