summaryrefslogtreecommitdiff
path: root/driver
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 /driver
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 'driver')
-rw-r--r--driver/accel_kxcj9.c4
-rw-r--r--driver/accelgyro_lsm6ds0.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/driver/accel_kxcj9.c b/driver/accel_kxcj9.c
index e54564cb6e..22acbad5bd 100644
--- a/driver/accel_kxcj9.c
+++ b/driver/accel_kxcj9.c
@@ -507,7 +507,7 @@ static int init(const struct motion_sensor_t *s)
}
} while (1);
- ret = set_range(s, 2, 1);
+ ret = set_range(s, s->range, 1);
if (ret != EC_SUCCESS)
return ret;
@@ -515,7 +515,7 @@ static int init(const struct motion_sensor_t *s)
if (ret != EC_SUCCESS)
return ret;
- ret = set_data_rate(s, 100000, 1);
+ ret = set_data_rate(s, s->odr, 1);
if (ret != EC_SUCCESS)
return ret;
diff --git a/driver/accelgyro_lsm6ds0.c b/driver/accelgyro_lsm6ds0.c
index 8d50a64373..1083cb5c71 100644
--- a/driver/accelgyro_lsm6ds0.c
+++ b/driver/accelgyro_lsm6ds0.c
@@ -425,28 +425,29 @@ static int init(const struct motion_sensor_t *s)
if (ret)
return EC_ERROR_UNKNOWN;
- ret = set_range(s, 2, 1);
+ ret = set_range(s, s->range, 1);
if (ret)
return EC_ERROR_UNKNOWN;
- ret = set_data_rate(s, 119000, 1);
+ ret = set_data_rate(s, s->odr, 1);
if (ret)
return EC_ERROR_UNKNOWN;
}
if (SENSOR_GYRO == s->type) {
/* Config GYRO Range */
- ret = set_range(s, 2000, 1);
+ ret = set_range(s, s->range, 1);
if (ret)
return EC_ERROR_UNKNOWN;
/* Config ACCEL & GYRO ODR */
- ret = set_data_rate(s, 119000, 1);
+ ret = set_data_rate(s, s->odr, 1);
if (ret)
return EC_ERROR_UNKNOWN;
}
- CPRINTF("[%T %s: Done Init type:0x%X]", s->name, s->type);
+ CPRINTF("[%T %s: MS Done Init type:0x%X range:%d odr:%d]\n",
+ s->name, s->type, s->range, s->odr);
return ret;
}