diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-05-12 07:45:33 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-12 23:35:51 +0000 |
commit | a9a9ae1abc4ddb6a89ee0d29b88fbdd1d2ef67b1 (patch) | |
tree | 26b9855187a83412b181009031878826faab8b97 /board/strago/board.c | |
parent | 39bd18b890bb708e79e9ba50dd3b5bf3d35e9ff1 (diff) | |
download | chrome-ec-a9a9ae1abc4ddb6a89ee0d29b88fbdd1d2ef67b1.tar.gz |
driver: Use common data structure to store default accel values
Move structure used by lms6ds0 to motion_sense.h,
so that bosh driver can use the same mechanism.
Use code to avoid reading chip range when reading data.
BUG=none
BRANCH=none
TEST=Check Bosh driver is working as expected.
Change-Id: Id8b5bb8735e479a122ef32ab9a400fba189d7488
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270453
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/strago/board.c')
-rw-r--r-- | board/strago/board.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/board/strago/board.c b/board/strago/board.c index 2ed9b9c426..a18dd7ed78 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -123,14 +123,36 @@ const matrix_3x3_t lid_standard_ref = { }; struct motion_sensor_t motion_sensors[] = { - {SENSOR_ACTIVE_S0, "Base Accel", MOTIONSENSE_CHIP_KXCJ9, - MOTIONSENSE_TYPE_ACCEL, MOTIONSENSE_LOC_BASE, - &kxcj9_drv, &g_kxcj9_mutex[0], &g_kxcj9_data[0], - KXCJ9_ADDR1, &base_standard_ref, 100000, 2}, - {SENSOR_ACTIVE_S0, "Lid Accel", MOTIONSENSE_CHIP_KXCJ9, - MOTIONSENSE_TYPE_ACCEL, MOTIONSENSE_LOC_LID, - &kxcj9_drv, &g_kxcj9_mutex[1], &g_kxcj9_data[1], - KXCJ9_ADDR0, &lid_standard_ref, 100000, 2}, + {.name = "Base Accel", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_KXCJ9, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_BASE, + .drv = &kxcj9_drv, + .mutex = &g_kxcj9_mutex[0], + .drv_data = &g_kxcj9_data[0], + .i2c_addr = KXCJ9_ADDR1, + .rot_standard_ref = &base_standard_ref, + .default_config = { + .odr = 100000, + .range = 2 + } + }, + {.name = "Lid Accel", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_KXCJ9, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_LID, + .drv = &kxcj9_drv, + .mutex = &g_kxcj9_mutex[1], + .drv_data = &g_kxcj9_data[1], + .i2c_addr = KXCJ9_ADDR0, + .rot_standard_ref = &lid_standard_ref, + .default_config = { + .odr = 100000, + .range = 2 + } + }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); @@ -165,8 +187,8 @@ static void motion_sensors_pre_init(void) sensor = &motion_sensors[i]; sensor->state = SENSOR_NOT_INITIALIZED; - sensor->odr = sensor->default_odr; - sensor->range = sensor->default_range; + sensor->runtime_config.odr = sensor->default_config.odr; + sensor->runtime_config.range = sensor->default_config.range; } } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sensors_pre_init, |