summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-10-16 11:41:00 -0600
committerCommit Bot <commit-bot@chromium.org>2020-01-11 02:38:36 +0000
commit43d35e28ae67077797b0f6bc4cfd6afe2ce0e70a (patch)
tree7e268e06c9b777a3296a2784c9bc09204e26ee09 /include
parentf11df7732d4d4bfdc9b25441be5af3d5ba569cad (diff)
downloadchrome-ec-43d35e28ae67077797b0f6bc4cfd6afe2ce0e70a.tar.gz
common: motion_sense_fifo: Read temperature on stage
Assuming online calibration is enabled, and the driver implements the get_temp function. When a driver stages data, if this is the first staged sample, read the current internal sensor temperature and cache it (will later be used in commit_data()). BUG=b:138303429,chromium:1023858 BRANCH=None TEST=buildall Change-Id: I8e5404e628d3e8ded7c2d75b1b5cbac8166e97aa Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867225 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/config.h24
-rw-r--r--include/motion_sense_fifo.h5
2 files changed, 29 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index a43a8d052b..202de754eb 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2776,6 +2776,12 @@
/* Include sensor online calibration (requires CONFIG_FPU) */
#undef CONFIG_ONLINE_CALIB
+/*
+ * Duration after which an entry in the temperature cache is considered stale.
+ * Defaults to 5 minutes if not set.
+ */
+#undef CONFIG_TEMP_CACHE_STALE_THRES
+
/* Include code to do online compass calibration */
#undef CONFIG_MAG_CALIBRATE
@@ -5159,8 +5165,26 @@
#if !defined(CONFIG_ACCEL_FIFO_SIZE) || !defined(CONFIG_ACCEL_FIFO_THRES)
#error "Using CONFIG_ACCEL_FIFO, must define _SIZE and _THRES"
#endif
+
+#ifndef CONFIG_TEMP_CACHE_STALE_THRES
+#ifdef CONFIG_ONLINE_CALIB
+/*
+ * Boards may choose to leave this to default and just turn on online
+ * calibration, in which case we'll set the threshold to 5 minutes.
+ */
+#define CONFIG_TEMP_CACHE_STALE_THRES (5 * MINUTE)
+#else
+/*
+ * Boards that use the FIFO and not the online calibration can just leave this
+ * at 0.
+ */
+#define CONFIG_TEMP_CACHE_STALE_THRES 0
+#endif /* CONFIG_ONLINE_CALIB */
+#endif /* !CONFIG_TEMP_CACHE_STALE_THRES */
+
#endif /* CONFIG_ACCEL_FIFO */
+
/*
* If USB PD Discharge is enabled, verify that CONFIG_USB_PD_DISCHARGE_GPIO
* and CONFIG_USB_PD_PORT_MAX_COUNT, CONFIG_USB_PD_DISCHARGE_TCPC, or
diff --git a/include/motion_sense_fifo.h b/include/motion_sense_fifo.h
index e5d8566ed1..554475d9f3 100644
--- a/include/motion_sense_fifo.h
+++ b/include/motion_sense_fifo.h
@@ -17,6 +17,11 @@ enum motion_sense_async_event {
};
/**
+ * Initialize the motion sense fifo. This function should only be called once.
+ */
+void motion_sense_fifo_init(void);
+
+/**
* Whether or not we need to wake up the AP.
*
* @return Non zero when a wake-up is needed.