summaryrefslogtreecommitdiff
path: root/common/i2c_master.c
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-03-06 09:50:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-10 19:37:00 +0000
commit0d44674274c1b6d9bd7c3de90312982883a6e3c1 (patch)
tree0216336834abfa9a5bed5d2a627c0898e0983984 /common/i2c_master.c
parent739d2762604760e5ce24ef7be060f39f2ca5abd0 (diff)
downloadchrome-ec-0d44674274c1b6d9bd7c3de90312982883a6e3c1.tar.gz
i2c: Cleanup I2C tracing output
The output of the I2C tracing is hard to parse, especially for reads to I2C registers. This change creates only a single I2C trace for each I2C transfer (instead of 2 entries), and labels the write and read parts of the I2C transaction clearly. Example output (TCPC device during disconnect): i2c: 1:0x20 wr 0x10 rd 0x01 0x00 i2c: 1:0x20 wr 0x10 0x01 0x00 i2c: 1:0x20 wr 0x1A rd 0x1A i2c: 1:0x20 wr 0x1D rd 0x10 i2c: 1:0x20 wr 0x1C rd 0x70 i2c: 1:0x20 wr 0x2F 0x21 i2c: 1:0x20 wr 0x1C 0x70 i2c: 1:0x20 wr 0x2F 0x00 i2c: 1:0x20 wr 0x1C rd 0x70 i2c: 1:0x20 wr 0x1C 0x60 BUG=none BRANCH=none TEST=make buildall TEST=Enable CONFIG_I2C_DEBUG and verify output. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I077196e70ae3abb6c462cf08a3f944b43fdcf82a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2091573 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/i2c_master.c')
-rw-r--r--common/i2c_master.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/common/i2c_master.c b/common/i2c_master.c
index ccb5a34492..b7b490b7dd 100644
--- a/common/i2c_master.c
+++ b/common/i2c_master.c
@@ -98,9 +98,6 @@ static int chip_i2c_xfer_with_notify(const int port,
uint16_t addr_flags = slave_addr_flags;
const struct i2c_port_t *i2c_port = get_i2c_port(port);
- if (IS_ENABLED(CONFIG_I2C_DEBUG))
- i2c_trace_notify(port, slave_addr_flags, 0, out, out_size);
-
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
i2c_start_xfer_notify(port, slave_addr_flags);
@@ -120,8 +117,10 @@ static int chip_i2c_xfer_with_notify(const int port,
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
i2c_end_xfer_notify(port, slave_addr_flags);
- if (IS_ENABLED(CONFIG_I2C_DEBUG))
- i2c_trace_notify(port, slave_addr_flags, 1, in, in_size);
+ if (IS_ENABLED(CONFIG_I2C_DEBUG)) {
+ i2c_trace_notify(port, slave_addr_flags, out, out_size,
+ in, in_size);
+ }
return ret;
}