summaryrefslogtreecommitdiff
path: root/board/samus
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2015-09-10 17:18:43 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-15 11:02:43 -0700
commit16a18a5e0eeaeebff5f4ab5c9363481f8d1426aa (patch)
treebb62d47ffad8c4f9f80a50c1a8bd3fd06788af4b /board/samus
parent070a82524836efe44dc7e5908b9b0ba019996097 (diff)
downloadchrome-ec-16a18a5e0eeaeebff5f4ab5c9363481f8d1426aa.tar.gz
driver: Refactor Kionix Accelerometer drivers.
This commit adds a new basic driver for the Kionix KX022 Accelerometer. Currently, the driver is capable of reading the sensor data and manipulating its ODR, resolution, and range. This sensor also has integrated support for Directional Tap/Double-Tap(TM), however that functionality is not yet implemented in the driver. Lastly, since this accelerometer is very similar to the previous KXCJ9, this commit tries to combine the drivers. Note, the variant of the Kionix accelerometer MUST be specified in the private data structure. BUG=chrome-os-partner:43494 BRANCH=None TEST=Build GLaDOS EC with driver enabled and verify that valid accelerometer data is read, and that range, resolution, and odr can all be modified. TEST=Build samus EC image and verify that the lid still works. Additionally, verify that I can change the odr, rate, and resolution. TEST=make buildall tests Change-Id: I238ff1dc13f5342a93f8f701a0da85c52f25d214 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/299013 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'board/samus')
-rw-r--r--board/samus/board.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/board/samus/board.c b/board/samus/board.c
index 5e53a7ba05..f20855e6e6 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -14,6 +14,7 @@
#include "charge_state.h"
#include "common.h"
#include "console.h"
+#include "driver/accel_kionix.h"
#include "driver/accel_kxcj9.h"
#include "driver/accelgyro_lsm6ds0.h"
#include "driver/als_isl29035.h"
@@ -273,7 +274,9 @@ static struct mutex g_base_mutex;
static struct mutex g_lid_mutex;
/* kxcj9 local/private data */
-struct kxcj9_data g_kxcj9_data;
+struct kionix_accel_data g_kxcj9_data = {
+ .variant = KXCJ9,
+};
/* lsm6ds0 local sensor data (per-sensor) */
struct lsm6ds0_data g_saved_data[2];
@@ -337,7 +340,7 @@ struct motion_sensor_t motion_sensors[] = {
.chip = MOTIONSENSE_CHIP_KXCJ9,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_LID,
- .drv = &kxcj9_drv,
+ .drv = &kionix_accel_drv,
.mutex = &g_lid_mutex,
.drv_data = &g_kxcj9_data,
.addr = KXCJ9_ADDR0,