summaryrefslogtreecommitdiff
path: root/board/samus
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-08-25 22:58:41 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-08-29 01:34:15 -0700
commit32867104da45ae38e37163ba6d04f847bc15e6bc (patch)
treee33a7142343d43eeeabaed6a097304459cde4a83 /board/samus
parent4e7e1bb796190e658ea2de8d4e391efa59b0d643 (diff)
downloadchrome-ec-32867104da45ae38e37163ba6d04f847bc15e6bc.tar.gz
samus: Use new config, fix gesture
Use new config table. Move ODR setting in motion sense, fix variable names. BRANCH=samus BUG=chromium:513458 TEST=Test accelerator and double tap on Samus Change-Id: I341add11a18de8e4cc97c57da29f9114bd2014cf Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295638 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/samus')
-rw-r--r--board/samus/board.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/board/samus/board.c b/board/samus/board.c
index 35365754dc..e9d71de370 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -20,6 +20,7 @@
#include "driver/temp_sensor/tmp006.h"
#include "extpower.h"
#include "fan.h"
+#include "gesture.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
@@ -307,11 +308,28 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_saved_data[0],
.addr = LSM6DS0_ADDR1,
.rot_standard_ref = &base_standard_ref,
- .default_config = {
- .odr = 119000,
- .range = 2,
- .ec_rate = SUSPEND_SAMPLING_INTERVAL,
- }
+ .default_range = 2, /* g, enough for laptop. */
+ .config = {
+ /* AP: by default shutdown all sensors */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 119000 | ROUND_UP_FLAG,
+ .ec_rate = 100,
+ },
+ /* Used for double tap */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = TAP_ODR | ROUND_UP_FLAG,
+ .ec_rate = CONFIG_GESTURE_SAMPLING_INTERVAL_MS
+ },
+ [SENSOR_CONFIG_EC_S5] = {
+ .odr = TAP_ODR | ROUND_UP_FLAG,
+ .ec_rate = CONFIG_GESTURE_SAMPLING_INTERVAL_MS
+ },
+ },
},
{.name = "Lid",
@@ -324,11 +342,28 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kxcj9_data,
.addr = KXCJ9_ADDR0,
.rot_standard_ref = &lid_standard_ref,
- .default_config = {
- .odr = 100000,
- .range = 2,
- .ec_rate = SUSPEND_SAMPLING_INTERVAL,
- }
+ .default_range = 2, /* g, enough for laptop. */
+ .config = {
+ /* AP: by default shutdown all sensors */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 100000 | ROUND_UP_FLAG,
+ .ec_rate = 100,
+ },
+ /* unused */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ [SENSOR_CONFIG_EC_S5] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ },
},
{.name = "Base Gyro",
@@ -341,10 +376,27 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_saved_data[1],
.addr = LSM6DS0_ADDR1,
.rot_standard_ref = NULL,
- .default_config = {
- .odr = 119000,
- .range = 2000,
- .ec_rate = SUSPEND_SAMPLING_INTERVAL,
+ .default_range = 2000, /* g, enough for laptop. */
+ .config = {
+ /* AP: by default shutdown all sensors */
+ [SENSOR_CONFIG_AP] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 119000 | ROUND_UP_FLAG,
+ .ec_rate = 100,
+ },
+ /* unused */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
+ [SENSOR_CONFIG_EC_S5] = {
+ .odr = 0,
+ .ec_rate = 0,
+ },
}
},