summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorSheng-Liang Song <ssl@chromium.org>2014-09-29 11:38:40 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-08 02:51:17 +0000
commitac261c00c1b28c549a13aa54bac62b423d10fc6c (patch)
tree4354aa9ce74f90df73621d499f5985d3d099727d /include/motion_sense.h
parentc5b30aa9f2fa726ec77a825a5bc04f985d584ec5 (diff)
downloadchrome-ec-ac261c00c1b28c549a13aa54bac62b423d10fc6c.tar.gz
samus: support sensor at different power state.
Design Goals: 1. Every time the AP boots, the same default sensor settings are configured. 2. If the AP goes to suspend (S3) and wakes back up (S0), then the AP sensor settings will be restored. 3. In S3 and in S5, only sample specific sensors that are needed. BUG=chrome-os-partner:32368 BRANCH=ToT TEST=Verified on Samus. Verified suspend and resume logic with EC console messages. - Test Case0: close lid & open lid - Test Case1: powerd_dbus_suspend Change-Id: I553c53e63ecfcb39d5e649a7189aa6ea02589471 Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220371 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index c08083be8c..7fd0851a19 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -10,6 +10,7 @@
#include "gpio.h"
#include "math_util.h"
+#include "chipset.h"
/* Anything outside of lid angle range [-180, 180] should work. */
#define LID_ANGLE_UNRELIABLE 500.0F
@@ -92,13 +93,15 @@ enum sensor_state {
SENSOR_INIT_ERROR = 2
};
-enum sensor_power {
- SENSOR_POWER_OFF = 0,
- SENSOR_POWER_ON = 1
-};
+#define SENSOR_ACTIVE_S5 CHIPSET_STATE_SOFT_OFF
+#define SENSOR_ACTIVE_S3 CHIPSET_STATE_SUSPEND
+#define SENSOR_ACTIVE_S0 CHIPSET_STATE_ON
+#define SENSOR_ACTIVE_S0_S3 (SENSOR_ACTIVE_S3 | SENSOR_ACTIVE_S0)
+#define SENSOR_ACTIVE_S0_S3_S5 (SENSOR_ACTIVE_S0_S3 | SENSOR_ACTIVE_S5)
struct motion_sensor_t {
/* RO fields */
+ uint32_t active_mask;
char *name;
enum sensor_chip_t chip;
enum sensor_type_t type;
@@ -108,11 +111,20 @@ struct motion_sensor_t {
void *drv_data;
uint8_t i2c_addr;
- /* RW fields */
+ /* Default configuration parameters, RO only */
+ int default_odr;
+ int default_range;
+
+ /* Run-Time configuration parameters */
+ int odr;
+ int range;
+
+ /* state parameters */
enum sensor_state state;
- enum sensor_power power;
+ enum chipset_state_mask active;
vector_3_t raw_xyz;
vector_3_t xyz;
+
};
/* Defined at board level. */