reef: Enable sensors for ARC++

- Enable MKBP events:
Allow EC to send sensor event to the kernel sensor stack.
- Disable APCI message display, to avoid overwhelming the console.
- Set the rotation matrices to match Android requirement.

BUG=b:27849483
CQ-DEPEND=CL:384341
BRANCH=reef
TEST=Check we can receive sensor events for ARC++.
Check the acceleromter axis are correct.

Change-Id: I5fa58e22167f027bd1b84e72f002060d15d882c4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/385082
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Gwendal Grignou
2016-09-12 21:16:42 -07:00
committed by chrome-bot
parent d50b7699b5
commit 22d7aeb277
2 changed files with 27 additions and 13 deletions

View File

@@ -704,9 +704,15 @@ static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
const matrix_3x3_t base_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
const matrix_3x3_t mag_standard_ref = {
{ FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
/* KX022 private data */
@@ -730,7 +736,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
.addr = BMI160_ADDR0,
.rot_standard_ref = NULL, /* Identity matrix. */
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.config = {
/* AP: by default use EC settings */
@@ -768,7 +774,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_GYRO,
.addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
.rot_standard_ref = NULL, /* Identity Matrix. */
.rot_standard_ref = &base_standard_ref,
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
@@ -805,7 +811,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_GYRO,
.addr = BMI160_ADDR0,
.default_range = 1 << 11, /* 16LSB / uT, fixed */
.rot_standard_ref = NULL, /* Identity Matrix. */
.rot_standard_ref = &mag_standard_ref,
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
@@ -841,7 +847,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
.addr = KX022_ADDR1,
.rot_standard_ref = &base_standard_ref, /* Identity matrix. */
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.config = {
/* AP: by default use EC settings */

View File

@@ -17,6 +17,15 @@
*/
#define CONFIG_SYSTEM_UNLOCKED
/*
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* EC console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
@@ -29,9 +38,6 @@
#define BD99955_PSYS_GAIN_SELECT \
BD99955_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* Battery */
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_CUSTOM
@@ -154,10 +160,12 @@
#define I2C_PORT_ACCEL I2C_PORT_GYRO
/* Sensors */
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HOST_EVENT
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_MAG_BMI160_BMM150
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_MAG_BMI160_BMM150
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001