diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2014-07-31 13:44:30 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-19 06:59:28 +0000 |
commit | a048d76e0df9244e2deb104201e14afc80e0864c (patch) | |
tree | 236a1dbd34def4b73ced8957c27a450531d98af2 /driver/accel_kxcj9.h | |
parent | be060242e310090a421f70caa5917e2808f26433 (diff) | |
download | chrome-ec-a048d76e0df9244e2deb104201e14afc80e0864c.tar.gz |
Refactor accel / gyro driver to accomodate various configurations
Previously our accel / gyro drivers assumed that we had exactly two of
each identical part in the system. Some systems may have different
configurations, so allow this to be specified at the board-level.
Note that our motion_sense algorithm currently assumes that we have one
accelerometer in the lid and one in the base -- we'll need to fix that
in another CL.
BUG=chrome-os-partner:27320
TEST=Compile-only. Tested in future Samus commit.
BRANCH=None.
Change-Id: I1fae1f6c578fedebe78b473a5d66a5794ccaae00
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212321
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'driver/accel_kxcj9.h')
-rw-r--r-- | driver/accel_kxcj9.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/driver/accel_kxcj9.h b/driver/accel_kxcj9.h index ea15b6ec17..30bea0e737 100644 --- a/driver/accel_kxcj9.h +++ b/driver/accel_kxcj9.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_ACCEL_KXCJ9_H #define __CROS_EC_ACCEL_KXCJ9_H +#include "task.h" + /* * 7-bit address is 000111Xb. Where 'X' is determined * by the voltage on the ADDR pin. @@ -99,17 +101,18 @@ #define KXCJ9_OSA_800_0HZ 6 #define KXCJ9_OSA_1600_HZ 7 - -#ifdef CONFIG_ACCEL_INTERRUPTS -/** - * Setup a one-time accel interrupt. If the threshold is low enough, the - * interrupt may trigger due simply to noise and not any real motion. If the - * threshold is 0, the interrupt will fire immediately. - * - * @param id Target accelerometer - * @param threshold Threshold for interrupt in units of counts. - */ -int accel_set_interrupt(const enum accel_id id, unsigned int threshold); -#endif +struct kxcj9_data { + struct mutex accel_mutex; + /* Current range of accelerometer. */ + int sensor_range; + /* Current output data rate of accelerometer. */ + int sensor_datarate; + /* Current resolution of accelerometer. */ + int sensor_resolution; + /* Device address. */ + int accel_addr; +}; + +extern const struct accelgyro_info accel_kxcj9; #endif /* __CROS_EC_ACCEL_KXCJ9_H */ |