From 1afa7935c451c52d19efbd451c48d295db0f3dbc Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Fri, 27 May 2016 18:56:55 -0700 Subject: reef: corrections to motion sensors The motion sensors array as well as the config variables were copied from another board and mostly wrong for Reef. BUG=none BRANCH=none TEST=sensors which are connected successfully initialize, still need to test lid sensors. Change-Id: If8e1ec79803c7f378b21f4e9423a56bd6763eb4e Signed-off-by: David Hendricks Reviewed-on: https://chromium-review.googlesource.com/349733 Reviewed-by: Kevin K Wong Reviewed-by: Shawn N --- board/reef/board.c | 42 +++++++++++++++++++++--------------------- board/reef/board.h | 31 +++++++++++++------------------ 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/board/reef/board.c b/board/reef/board.c index 1fe7aaab80..333cca3e87 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -512,16 +512,16 @@ struct motion_sensor_t motion_sensors[] = { * Requirement: accelerometer sensor must init before gyro sensor * DO NOT change the order of the following table. */ - [LID_ACCEL] = { - .name = "Lid Accel", + [BASE_ACCEL] = { + .name = "Base Accel", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, + .location = MOTIONSENSE_LOC_BASE, .drv = &bmi160_drv, - .mutex = &g_lid_mutex, + .mutex = &g_base_mutex, .drv_data = &g_bmi160_data, - .port = I2C_PORT_ACCEL, + .port = I2C_PORT_GYRO, .addr = BMI160_ADDR0, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ @@ -549,14 +549,14 @@ struct motion_sensor_t motion_sensors[] = { }, }, - [LID_GYRO] = { - .name = "Lid Gyro", + [BASE_GYRO] = { + .name = "Base Gyro", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_GYRO, - .location = MOTIONSENSE_LOC_LID, + .location = MOTIONSENSE_LOC_BASE, .drv = &bmi160_drv, - .mutex = &g_lid_mutex, + .mutex = &g_base_mutex, .drv_data = &g_bmi160_data, .port = I2C_PORT_GYRO, .addr = BMI160_ADDR0, @@ -586,16 +586,16 @@ struct motion_sensor_t motion_sensors[] = { }, }, - [LID_MAG] = { - .name = "Lid Mag", + [BASE_MAG] = { + .name = "Base Mag", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_MAG, - .location = MOTIONSENSE_LOC_LID, + .location = MOTIONSENSE_LOC_BASE, .drv = &bmi160_drv, - .mutex = &g_lid_mutex, + .mutex = &g_base_mutex, .drv_data = &g_bmi160_data, - .port = I2C_PORT_ACCEL, + .port = I2C_PORT_GYRO, .addr = BMI160_ADDR0, .default_range = 1 << 11, /* 16LSB / uT, fixed */ .rot_standard_ref = NULL, /* Identity Matrix. */ @@ -623,17 +623,17 @@ struct motion_sensor_t motion_sensors[] = { }, }, - [BASE_ACCEL] = { - .name = "Base Accel", + [LID_ACCEL] = { + .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KXCJ9, + .chip = MOTIONSENSE_CHIP_KX022, .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, + .location = MOTIONSENSE_LOC_LID, .drv = &kionix_accel_drv, - .mutex = &g_base_mutex, + .mutex = &g_lid_mutex, .drv_data = &g_kx022_data, - .port = I2C_PORT_ACCEL, - .addr = KXCJ9_ADDR1, + .port = I2C_PORT_LID_ACCEL, + .addr = KX022_ADDR1, .rot_standard_ref = &base_standard_ref, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ .config = { diff --git a/board/reef/board.h b/board/reef/board.h index b02a28d4f5..a6c91a2cc2 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -71,9 +71,6 @@ #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_COL2_INVERTED /* #define CONFIG_LED_COMMON */ -/* #define CONFIG_LID_ANGLE */ /* FIXME(dhendrix): maybe? */ -/* #define CONFIG_LID_ANGLE_SENSOR_BASE 0 */ /* FIXME(dhendrix): maybe? */ -/* #define CONFIG_LID_ANGLE_SENSOR_LID 2 */ /* FIXME(dhendrix): maybe? */ #define CONFIG_LID_SWITCH /* #define CONFIG_LOW_POWER_IDLE */ #define CONFIG_LTO @@ -110,26 +107,24 @@ /* I2C ports */ #define I2C_PORT_GYRO NPCX_I2C_PORT1 +#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2 #define I2C_PORT_ALS NPCX_I2C_PORT2 -#define I2C_PORT_ACCEL NPCX_I2C_PORT2 #define I2C_PORT_BATTERY NPCX_I2C_PORT3 #define I2C_PORT_CHARGER NPCX_I2C_PORT3 -#define I2C_PORT_PD_MCU NPCX_I2C_PORT3 +/* Sensors */ #define CONFIG_ACCELGYRO_BMI160 +#define CONFIG_MAG_BMI160_BMM150 +#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */ +#define CONFIG_MAG_CALIBRATE #define CONFIG_ACCEL_KX022 -/* FIXME: Need to add BMP280 barometer */ - #define CONFIG_ALS #define CONFIG_ALS_OPT3001 - -#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */ -#define CONFIG_MAG_BMI160_BMM150 -#define BMM150_I2C_ADDRESS BMM150_ADDR0 -#define CONFIG_MAG_CALIBRATE - -/* Ambient Light Sensor address */ #define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1 +/* FIXME: Need to add BMP280 barometer */ +/* #define CONFIG_LID_ANGLE */ /* FIXME(dhendrix): maybe? */ +/* #define CONFIG_LID_ANGLE_SENSOR_BASE 0 */ /* FIXME(dhendrix): maybe? */ +/* #define CONFIG_LID_ANGLE_SENSOR_LID 2 */ /* FIXME(dhendrix): maybe? */ #undef DEFERRABLE_MAX_COUNT #define DEFERRABLE_MAX_COUNT 15 @@ -184,10 +179,10 @@ enum als_id { /* Motion sensors */ enum sensor_id { - LID_ACCEL = 0, - LID_GYRO, - LID_MAG, - BASE_ACCEL, + BASE_ACCEL = 0, + BASE_GYRO, + BASE_MAG, + LID_ACCEL, }; /* start as a sink in case we have no other power supply/battery */ -- cgit v1.2.1