summaryrefslogtreecommitdiff
path: root/include/accelgyro.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-07-01 12:35:21 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-09 06:01:00 +0000
commitfc17034c5240298954619f820b554e060c580b3b (patch)
tree873a26ce6068fbdd4d85af0f460561227a82783d /include/accelgyro.h
parent52ff2e4c8d7e7e10088461980d6b381647874d4d (diff)
downloadchrome-ec-fc17034c5240298954619f820b554e060c580b3b.tar.gz
motion: Add commands for calibration
Move calibration in the EC to returns raw value with offset already applied, as recommended by iio interface. BRANCH=smaug TEST=On Samus, with kernel change CL:283103 Check raw value are returned properly. BUG=chromium:506101 Change-Id: I3dcb4f2fcfff35639e3bfdcc6c1468bdb5e53c45 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/283161 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/accelgyro.h')
-rw-r--r--include/accelgyro.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h
index 5ac486c660..723efa569c 100644
--- a/include/accelgyro.h
+++ b/include/accelgyro.h
@@ -77,6 +77,20 @@ struct accelgyro_drv {
int (*get_data_rate)(const struct motion_sensor_t *s,
int *rate);
+
+ /**
+ * Setter and getter methods for the sensor offset.
+ * @s Pointer to sensor data.
+ * @offset: offset to apply to raw data.
+ * @temp: temperature when calibration was done.
+ * @return EC_SUCCESS if successful, non-zero if error.
+ */
+ int (*set_offset)(const struct motion_sensor_t *s,
+ const int16_t *offset,
+ int16_t temp);
+ int (*get_offset)(const struct motion_sensor_t *s,
+ int16_t *offset,
+ int16_t *temp);
#ifdef CONFIG_ACCEL_INTERRUPTS
/**
* Setup a one-time accel interrupt. If the threshold is low enough, the