summaryrefslogtreecommitdiff
path: root/include/i2c.h
diff options
context:
space:
mode:
authorChun-Ta Lin <itspeter@google.com>2017-11-28 15:16:22 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-07 05:09:28 -0800
commitab238235f8f45cb1ba3e26893199c01f4792a8ff (patch)
tree9f89b9428d868a80c5d9c0a5fb9ead38941f7b71 /include/i2c.h
parent1956a98ad4988305777bbb633fb007cb5f86b89f (diff)
downloadchrome-ec-ab238235f8f45cb1ba3e26893199c01f4792a8ff.tar.gz
i2c: support large reading in i2c_xfer()
There might be more than one place that will use very similar codes in CL:542716 (usb_i2c.c). To avoid unnecessary duplication of code, we fold the logic into i2c_xfer(). With config enabled (illustrated in this CL), i2c_xfer() will support large reading. An early prototype of potential usage is demostrated in CL:781300. BRANCH=none TEST=For CONFIG_I2C_XFER_LARGE_READ: With proprietary software on slave: ./touchpad_updater -d TEST=For usb_i2c regression: ./touchpad_updater still works (where the reading is less than 255) TEST=For generic EC regression test: On poppy EC (With CONFIG_I2C_XFER_LARGE_READ defined) (1) Prevent override of update /usr/share/vboot/bin/set_gbb_flags.sh 0xa39 (2) flashrom -p ec -w ec_binary_contains_this_CL.bin (3) ectool reboot_ec cold (4) "ectool version" verified that both RO/RW/Build info is local. (5) Test with a type-C DP dongle on DELL 2408WFP. (6) Plug-in type-C charger and external display still works. (7) Confirmed that battery is charging. (7) "ectool battery" reads same data (for fixed field) as before. (8) "ectool usbpdpower", confirmed charger info displayed as before. (9) "ectool usbpd 0", confirmed content exactly as before. (10) For Gyro. Verify under Arc++ Using App: com.gamma.bubblelevel, works the same as before. (11) For Accelerometers. Verify under Arc++ Using App: com.innoventions.sensorkinetics, small movement's charts looks as expected. TEST=For generic EC regression test: On Caroline EC (Without CONFIG_I2C_XFER_LARGE_READ defined). Details in CL:810332 BUG=b:63993891 Change-Id: I654868945fa535e784800177d54eb2d9803f5249 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/788479 Commit-Ready: Chun-ta Lin <itspeter@chromium.org> Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 73716cf705..63169ec055 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -89,7 +89,9 @@ extern const int i2c_test_dev_used;
#define I2C_XFER_SINGLE (I2C_XFER_START | I2C_XFER_STOP) /* One transaction */
/**
- * Transmit one block of raw data, then receive one block of raw data.
+ * Transmit one block of raw data, then receive one block of raw data. However,
+ * received data might be capped at CONFIG_I2C_CHIP_MAX_READ_SIZE if
+ * CONFIG_I2C_XFER_LARGE_READ is not defined.
*
* This is a wrapper function for chip_i2c_xfer(), a low-level chip-dependent
* function. It must be called between i2c_lock(port, 1) and i2c_lock(port, 0).