mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
4e7e1bb796
commit
32867104da
@@ -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,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -22,12 +22,6 @@
|
||||
#define CPRINTS(format, args...) cprints(CC_GESTURE, format, ## args)
|
||||
#define CPRINTF(format, args...) cprintf(CC_GESTURE, format, ## args)
|
||||
|
||||
/* Output datarate for tap sensor (in milli-Hz) */
|
||||
/*
|
||||
* Note: lsm6ds0 accel needs twice the expected data rate in order to guarantee
|
||||
* that we have a new data sample every reading.
|
||||
*/
|
||||
#define TAP_ODR (2 * (1000000 / CONFIG_GESTURE_SAMPLING_INTERVAL_MS))
|
||||
|
||||
/*
|
||||
* Double tap detection parameters
|
||||
@@ -286,13 +280,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, gesture_chipset_resume,
|
||||
|
||||
static void gesture_chipset_suspend(void)
|
||||
{
|
||||
/*
|
||||
* Set ODR to desired value
|
||||
* We assume EC rate set correctly: it works because the sensor used
|
||||
* is never offlined/suspened.
|
||||
*/
|
||||
sensor->drv->set_data_rate(sensor, TAP_ODR, 1);
|
||||
|
||||
/*
|
||||
* Clear tap init and history initialized so that we have to
|
||||
* record a whole new set of data, and enable tap detection
|
||||
|
||||
@@ -16,4 +16,11 @@ void gesture_calc(void);
|
||||
/* gesture hooks are triggered after the motion sense hooks. */
|
||||
#define GESTURE_HOOK_PRIO (MOTION_SENSE_HOOK_PRIO + 10)
|
||||
|
||||
/* Output datarate for tap sensor (in milli-Hz) */
|
||||
/*
|
||||
* Note: lsm6ds0 accel needs twice the expected data rate in order to guarantee
|
||||
* that we have a new data sample every reading.
|
||||
*/
|
||||
#define TAP_ODR (2 * (1000000 / CONFIG_GESTURE_SAMPLING_INTERVAL_MS))
|
||||
|
||||
#endif /* __CROS_EC_GESTURE_H */
|
||||
|
||||
@@ -42,15 +42,6 @@ enum sensor_config {
|
||||
/* Next 8 events for sensor interrupt lines */
|
||||
#define TASK_EVENT_MOTION_INTERRUPT_MASK (0xff << 2)
|
||||
|
||||
/* Define sensor sampling interval in suspend. */
|
||||
#ifdef CONFIG_GESTURE_DETECTION
|
||||
#define SUSPEND_SAMPLING_INTERVAL (CONFIG_GESTURE_SAMPLING_INTERVAL_MS * MSEC)
|
||||
#elif defined(CONFIG_ACCEL_FIFO)
|
||||
#define SUSPEND_SAMPLING_INTERVAL (1000 * MSEC)
|
||||
#else
|
||||
#define SUSPEND_SAMPLING_INTERVAL (100 * MSEC)
|
||||
#endif
|
||||
|
||||
/* Minimum time in between running motion sense task loop. */
|
||||
#define MIN_MOTION_SENSE_WAIT_TIME (3 * MSEC)
|
||||
#define MAX_MOTION_SENSE_WAIT_TIME (60000 * MSEC)
|
||||
|
||||
Reference in New Issue
Block a user