summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-02-24 15:31:31 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-01 02:36:03 +0000
commita2809457419479e6d8c6e7c75af640d47c994072 (patch)
tree53cc6eefcb097c6aca0c0eaf6fc73269fd16d012
parent2356c3e2130b24ba9a4eddfa93de721c3686907c (diff)
downloadchrome-ec-a2809457419479e6d8c6e7c75af640d47c994072.tar.gz
rambi: Changed accel i2c speed to 400kHz and added accels present bit
Changed speed of accelerometer i2c bus to 400kHz. Added an accelerometers present bit to the status byte for host shared memory so that the host knows whether this system has accelerometers or not. BUG=chrome-os-partner:25599 BRANCH=rambi TEST=manual test with a glimmer. To test speed, just ran for a while at 400kHz and made sure there were no i2c errors and the data looked accurate using the lidangle on command. To test the accelerometers present bit, I used the kernel patch for the cros_ec_accel driver. First, I verified that without this patch, the kernel driver throws an error when loading the module. Second, I verified that with this patch the module was loaded successfully. Change-Id: I19b8e800748b0d45dc1da6c59118e92b4908ee2f Original-Change-Id: If931b37bf057df96659852ef9699b3e6029275c7 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187732 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/188386
-rw-r--r--common/motion_sense.c5
-rw-r--r--include/ec_commands.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 4bf2e7293f..eea52d394e 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -141,6 +141,9 @@ void motion_sense_task(void)
return;
}
+ /* Write to status byte to represent that accelerometers are present. */
+ *lpc_status |= EC_MEMMAP_ACC_STATUS_PRESENCE_BIT;
+
while (1) {
ts0 = get_time();
@@ -194,7 +197,7 @@ void motion_sense_task(void)
*/
sample_id = (sample_id + 1) &
EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK;
- *lpc_status = sample_id;
+ *lpc_status = EC_MEMMAP_ACC_STATUS_PRESENCE_BIT | sample_id;
#ifdef CONFIG_CMD_LID_ANGLE
diff --git a/include/ec_commands.h b/include/ec_commands.h
index b3d221d7cf..1913361250 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -88,6 +88,7 @@
/* Define the format of the accelerometer mapped memory status byte. */
#define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f
#define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4)
+#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7)
/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */
#define EC_TEMP_SENSOR_ENTRIES 16