summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-02-26 08:51:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-01 15:50:35 -0800
commitecde7fe66ceb8f5547b14a8d10ce7f5bf6446b84 (patch)
tree758b05b8b854f48fa3bdda4b1bef7cc134ec2d1d
parent39fefe9c75b7401cf4ca8ad4c8397496afb89a6a (diff)
downloadchrome-ec-ecde7fe66ceb8f5547b14a8d10ce7f5bf6446b84.tar.gz
motion: Add config variable to fill LPC sense data
Writing sense data in LPC area is required for: - X86 host - unit tests. Add a CONFIG_ variable to make it explicit. BUG=b:120346412 BRANCH=None TEST=Buildall, emerge-* chromeos-ec Change-Id: Ib3db6ec4e53cba3057162d300de943b6c86bfcfe Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1491913 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--common/motion_sense.c10
-rw-r--r--include/config.h9
-rw-r--r--test/test_config.h1
3 files changed, 13 insertions, 7 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 970a151796..7b9d66204c 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -61,10 +61,6 @@ static int accel_disp;
#define SENSOR_ACTIVE(_sensor) (sensor_active & (_sensor)->active_mask)
-#if defined(CONFIG_HOSTCMD_X86) || defined(TEST_MOTION_LID)
-#define UPDATE_HOST_MEM_MAP
-#endif
-
/*
* Adjustment in us to ec rate when calculating interrupt interval:
* To be sure the EC will send an interrupt even if it finishes processing
@@ -636,7 +632,7 @@ static inline void set_present(uint8_t *lpc_status)
*lpc_status |= EC_MEMMAP_ACC_STATUS_PRESENCE_BIT;
}
-#ifdef UPDATE_HOST_MEM_MAP
+#ifdef CONFIG_MOTION_FILL_LPC_SENSE_DATA
/* Update/Write LPC data */
static inline void update_sense_data(uint8_t *lpc_status, int *psample_id)
{
@@ -935,7 +931,7 @@ void motion_sense_task(void *u)
#ifdef CONFIG_ACCEL_FIFO
timestamp_t ts_last_int;
#endif
-#ifdef UPDATE_HOST_MEM_MAP
+#ifdef CONFIG_MOTION_FILL_LPC_SENSE_DATA
int sample_id = 0;
uint8_t *lpc_status;
@@ -994,7 +990,7 @@ void motion_sense_task(void *u)
CPRINTF("]\n");
}
#endif
-#ifdef UPDATE_HOST_MEM_MAP
+#ifdef CONFIG_MOTION_FILL_LPC_SENSE_DATA
update_sense_data(lpc_status, &sample_id);
#endif
diff --git a/include/config.h b/include/config.h
index ad244988d0..595971203c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1801,6 +1801,10 @@
/* Define motion sensor count in board layer */
#undef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+
+/* Define when LPC memory space needs to be populated. */
+#undef CONFIG_MOTION_FILL_LPC_SENSE_DATA
+
/******************************************************************************/
/* Host to RAM (H2RAM) Memory Mapping */
@@ -4277,6 +4281,11 @@
#endif
#endif
+/* Fill LPC sense data on X86 architecture. */
+#ifdef CONFIG_HOSTCMD_X86
+#define CONFIG_MOTION_FILL_LPC_SENSE_DATA
+#endif
+
/*
* TODO(crbug.com/888109): Makes sure RDP as PSTATE is only enabled where it
* makes sense.
diff --git a/test/test_config.h b/test/test_config.h
index 1dfe0a2ffd..63cdfa6a9e 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -69,6 +69,7 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 1
#define CONFIG_TABLET_MODE
+#define CONFIG_MOTION_FILL_LPC_SENSE_DATA
#endif
#ifdef TEST_RMA_AUTH