mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
rambi: change EC accel sampling rate and default sensor output data rate.
Two accelerometer changes: - Lower accel sampling rate when chipset is off to 10Hz. Increase sampling rate back up to 100Hz when transitioning to S0. - Change the default output data rate of the accelerometers to 100Hz which matches the EC sampling rate when in S0. BUG=none BRANCH=rambi TEST=manual testing. used lidangle command to verify that in S0, EC is sampling at 100Hz, and in S3 or lower it is sampling at 10Hz. Change-Id: Ie4e20f45f9371d674c3325a362d2729c331fac4f Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190032 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
b9b5c89c30
commit
5bd3d71259
@@ -28,8 +28,12 @@ static vector_3_t acc_lid_raw, acc_lid, acc_base;
|
||||
static vector_3_t acc_lid_host, acc_base_host;
|
||||
static float lid_angle_deg;
|
||||
|
||||
/* Accelerometer polling intervals based on chipset state. */
|
||||
#define ACCEL_INTERVAL_AP_ON_MS 10
|
||||
#define ACCEL_INTERVAL_AP_SUSPEND_MS 100
|
||||
|
||||
/* Sampling interval for measuring acceleration and calculating lid angle. */
|
||||
static int accel_interval_ms = 10;
|
||||
static int accel_interval_ms = ACCEL_INTERVAL_AP_SUSPEND_MS;
|
||||
|
||||
#ifdef CONFIG_CMD_LID_ANGLE
|
||||
static int accel_disp;
|
||||
@@ -117,6 +121,20 @@ void motion_get_accel_base(vector_3_t *v)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Lower accel polling rate on chipset suspend. */
|
||||
static void set_slow_accel_polling(void)
|
||||
{
|
||||
accel_interval_ms = ACCEL_INTERVAL_AP_SUSPEND_MS;
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, set_slow_accel_polling, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/* Raise accel polling rate on chipset resume. */
|
||||
static void set_fast_accel_polling(void)
|
||||
{
|
||||
accel_interval_ms = ACCEL_INTERVAL_AP_ON_MS;
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, set_fast_accel_polling, HOOK_PRIO_DEFAULT);
|
||||
|
||||
|
||||
void motion_sense_task(void)
|
||||
{
|
||||
@@ -244,7 +262,11 @@ static int command_ctrl_print_lid_angle_calcs(int argc, char **argv)
|
||||
accel_disp = val;
|
||||
}
|
||||
|
||||
/* Second arg changes the accel task time interval. */
|
||||
/*
|
||||
* Second arg changes the accel task time interval. Note accel
|
||||
* sampling interval will be clobbered when chipset suspends or
|
||||
* resumes.
|
||||
*/
|
||||
if (argc > 2) {
|
||||
val = strtoi(argv[2], &e, 0);
|
||||
if (*e)
|
||||
|
||||
@@ -21,8 +21,8 @@ static int sensor_range[ACCEL_COUNT] = {KXCJ9_GSEL_2G, KXCJ9_GSEL_2G};
|
||||
static int sensor_resolution[ACCEL_COUNT] = {KXCJ9_RES_12BIT, KXCJ9_RES_12BIT};
|
||||
|
||||
/* Output data rate: KXCJ9_OSA_* ranges from 0.781Hz to 1600Hz. */
|
||||
static int sensor_datarate[ACCEL_COUNT] = {KXCJ9_OSA_12_50HZ,
|
||||
KXCJ9_OSA_12_50HZ};
|
||||
static int sensor_datarate[ACCEL_COUNT] = {KXCJ9_OSA_100_0HZ,
|
||||
KXCJ9_OSA_100_0HZ};
|
||||
|
||||
/**
|
||||
* Read register from accelerometer.
|
||||
|
||||
Reference in New Issue
Block a user