diff options
Diffstat (limited to 'board/elm')
-rw-r--r-- | board/elm/board.c | 79 | ||||
-rw-r--r-- | board/elm/board.h | 10 |
2 files changed, 49 insertions, 40 deletions
diff --git a/board/elm/board.c b/board/elm/board.c index f2d567ace7..312caa6509 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -450,50 +450,53 @@ const mat33_fp_t lid_standard_ref = { struct kionix_accel_data g_kx022_data[2]; struct motion_sensor_t motion_sensors[] = { - {.name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KX022, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &kionix_accel_drv, - .mutex = &g_kx022_mutex[0], - .drv_data = &g_kx022_data[0], - .addr = 1, /* SPI, device ID 0 */ - .rot_standard_ref = &base_standard_ref, - .default_range = 2, /* g, enough for laptop. */ - .min_frequency = KX022_ACCEL_MIN_FREQ, - .max_frequency = KX022_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + [BASE_ACCEL] = { + .name = "Base Accel", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_KX022, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_BASE, + .drv = &kionix_accel_drv, + .mutex = &g_kx022_mutex[0], + .drv_data = &g_kx022_data[0], + .addr = 1, /* SPI, device ID 0 */ + .rot_standard_ref = &base_standard_ref, + .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, }, - }, }, - {.name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KX022, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &kionix_accel_drv, - .mutex = &g_kx022_mutex[1], - .drv_data = &g_kx022_data[1], - .addr = 3, /* SPI, device ID 1 */ - .rot_standard_ref = &lid_standard_ref, - .default_range = 2, /* g, enough for laptop. */ - .min_frequency = KX022_ACCEL_MIN_FREQ, - .max_frequency = KX022_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + [LID_ACCEL] = { + .name = "Lid Accel", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_KX022, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_LID, + .drv = &kionix_accel_drv, + .mutex = &g_kx022_mutex[1], + .drv_data = &g_kx022_data[1], + .addr = 3, /* SPI, device ID 1 */ + .rot_standard_ref = &lid_standard_ref, + .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, }, - }, }, }; + const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); void lid_angle_peripheral_enable(int enable) diff --git a/board/elm/board.h b/board/elm/board.h index 8d1283244c..0de9730454 100644 --- a/board/elm/board.h +++ b/board/elm/board.h @@ -19,8 +19,8 @@ #define CONFIG_CMD_ACCELS #define CONFIG_CMD_ACCEL_INFO #define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE 0 -#define CONFIG_LID_ANGLE_SENSOR_LID 1 +#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL +#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL #define CONFIG_LID_ANGLE_UPDATE #define CONFIG_ADC @@ -215,6 +215,12 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; +enum sensor_id { + BASE_ACCEL, + LID_ACCEL, + SENSOR_COUNT, +}; + /* TODO: determine the following board specific type-C power constants */ /* * delay to turn on the power supply max is ~16ms. |