summaryrefslogtreecommitdiff
path: root/include/i2c.h
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-04-03 23:38:09 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-07 02:20:38 +0000
commited4ffafa80319a0084b684eb0b9f95c120922862 (patch)
treec364070288a12fdb8199b8c39a3cac9d657213e3 /include/i2c.h
parent2dd71e66565bc09852567958b1f48748b7d20a49 (diff)
downloadchrome-ec-ed4ffafa80319a0084b684eb0b9f95c120922862.tar.gz
i2c: Fix port bug with i2ctrace and i2cscan commands
'port' is not the index into i2c_ports[]. Fix i2ctrace and i2cscan to use get_i2c_port() to find the matching port in i2c_ports[] table. Add the port name to the 'i2ctrace list' output to make it clear which port it is. > i2ctrace list id port address -- ---- ------- 0 8 ap_audio 0x4A 1 9 ap_hdmi 0x5A to 0x5F 2 3 ap_mux 0x30 3 4 thermal 0x40 4 5 sensor 0x50 BUG=none BRANCH=none TEST=i2ctrace for I2C_PORT_AP_HDMI on Zork: i2ctrace enable 9 0x4a Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I7b897ac9154751a46ef5961aded569aaec49bfd4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136526 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 3557d8e32b..1ba56e51bf 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -584,4 +584,7 @@ int i2c_set_freq(int port, enum i2c_freq freq);
*/
enum i2c_freq i2c_get_freq(int port);
+/* Find the matching port in i2c_ports[] table. */
+const struct i2c_port_t *get_i2c_port(const int port);
+
#endif /* __CROS_EC_I2C_H */