diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2016-12-28 15:09:33 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-12-28 21:49:29 -0800 |
commit | 1c68913e0205885329f29911d082c0327c14888a (patch) | |
tree | a3f671fdcc9c2f25919ec471022afc4b8124d456 | |
parent | b19bb1f22a3fd0102030485d324c0321a18827e8 (diff) | |
download | chrome-ec-1c68913e0205885329f29911d082c0327c14888a.tar.gz |
driver: Move sensor private struture definition to boards.
sensor private structure for bmi160 and bmp280 were defined
in the drivers themselves. It worked because there was only one
instance of each sensors on a board. However, this is an error it
should be in board files, as it was done for other sensors like the kionix.
BUG=none
TEST=buildall.
BRANCH=kevin,reef
Change-Id: Ica3aba358d141a7df9a3e97251d4c1e520cbf2c8
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424218
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/eve/board.c | 2 | ||||
-rw-r--r-- | board/glados/board.c | 2 | ||||
-rw-r--r-- | board/kevin/board.c | 4 | ||||
-rw-r--r-- | board/oak/board.c | 2 | ||||
-rw-r--r-- | board/pyro/board.c | 3 | ||||
-rw-r--r-- | board/reef/board.c | 4 | ||||
-rw-r--r-- | board/ryu/board.c | 2 | ||||
-rw-r--r-- | board/snappy/board.c | 3 | ||||
-rw-r--r-- | board/wheatley/board.c | 2 | ||||
-rw-r--r-- | driver/accelgyro_bmi160.c | 4 | ||||
-rw-r--r-- | driver/accelgyro_lsm6dsm.c | 5 | ||||
-rw-r--r-- | driver/baro_bmp280.c | 2 |
12 files changed, 17 insertions, 18 deletions
diff --git a/board/eve/board.c b/board/eve/board.c index c3d645fd47..c8d76d0a3d 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -654,8 +654,8 @@ static struct mutex g_base_mutex; /* Lid Sensor mutex */ static struct mutex g_lid_mutex; -/* kxcj9 local/private data */ struct kionix_accel_data g_kxcj9_data; +struct bmi160_drv_data_t g_bmi160_data; /* Matrix to rotate accelrator into standard reference frame */ const matrix_3x3_t base_standard_ref = { diff --git a/board/glados/board.c b/board/glados/board.c index b37f59feff..7ef71dd915 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -474,8 +474,8 @@ DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST); static struct mutex g_lid_mutex; static struct mutex g_base_mutex; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { /* diff --git a/board/kevin/board.c b/board/kevin/board.c index 3c9e9449f7..8c183ed2bb 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -474,6 +474,8 @@ int board_get_version(void) static struct mutex g_base_mutex; static struct mutex g_lid_mutex; +struct bmi160_drv_data_t g_bmi160_data; + #ifdef BOARD_KEVIN /* BMA255 private data */ struct bma2x2_accel_data g_bma255_data; @@ -504,8 +506,8 @@ const matrix_3x3_t lid_standard_ref = { { 0, 0, FLOAT_TO_FP(1)} }; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmp280_drv_data_t bmp280_drv_data; /* ALS instances. Must be in same order as enum als_id. */ struct als_t als[] = { diff --git a/board/oak/board.c b/board/oak/board.c index b56223adf3..99b4e9ba6b 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -649,8 +649,8 @@ const matrix_3x3_t base_standard_ref = { }; #endif -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { #ifdef CONFIG_ACCELGYRO_BMI160 diff --git a/board/pyro/board.c b/board/pyro/board.c index 38f3d37042..7253543d2f 100644 --- a/board/pyro/board.c +++ b/board/pyro/board.c @@ -780,8 +780,9 @@ const matrix_3x3_t lid_standard_ref = { { 0, 0, FLOAT_TO_FP(1)} }; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; +struct bmp280_drv_data_t bmp280_drv_data; /* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Pyro */ struct motion_sensor_t motion_sensors[] = { diff --git a/board/reef/board.c b/board/reef/board.c index 83d068bf49..8b7a9cecb2 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -779,8 +779,10 @@ const matrix_3x3_t mag_standard_ref = { { 0, 0, FLOAT_TO_FP(-1)} }; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; +struct bmp280_drv_data_t bmp280_drv_data; + /* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Reef */ struct motion_sensor_t motion_sensors[] = { diff --git a/board/ryu/board.c b/board/ryu/board.c index 0f7a5ba478..0950bc8ae0 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -269,6 +269,8 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /* Sensor mutex */ static struct mutex g_mutex; +struct bmi160_drv_data_t g_bmi160_data; + /* Matrix to rotate sensor vector into standard reference frame */ const matrix_3x3_t accelgyro_standard_ref = { {FLOAT_TO_FP(-1), 0, 0}, diff --git a/board/snappy/board.c b/board/snappy/board.c index 63d1ff1ada..0848857f2a 100644 --- a/board/snappy/board.c +++ b/board/snappy/board.c @@ -780,8 +780,9 @@ const matrix_3x3_t lid_standard_ref = { { 0, 0, FLOAT_TO_FP(-1)} }; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; +struct bmp280_drv_data_t bmp280_drv_data; /* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Snappy */ struct motion_sensor_t motion_sensors[] = { diff --git a/board/wheatley/board.c b/board/wheatley/board.c index c467d4dd89..c404475734 100644 --- a/board/wheatley/board.c +++ b/board/wheatley/board.c @@ -454,8 +454,8 @@ DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST); static struct mutex g_lid_mutex; static struct mutex g_base_mutex; -/* KX022 private data */ struct kionix_accel_data g_kx022_data; +struct bmi160_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index 359d8bddfd..0348e51bd9 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -1246,10 +1246,6 @@ const struct accelgyro_drv bmi160_drv = { #endif }; -struct bmi160_drv_data_t g_bmi160_data = { - .flags = 0, -}; - #ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL struct i2c_stress_test_dev bmi160_i2c_stress_test_dev = { .reg_info = { diff --git a/driver/accelgyro_lsm6dsm.c b/driver/accelgyro_lsm6dsm.c index 146ea4987f..4ef95c3018 100644 --- a/driver/accelgyro_lsm6dsm.c +++ b/driver/accelgyro_lsm6dsm.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -20,9 +20,6 @@ #define CPRINTF(format, args...) cprintf(CC_ACCEL, format, ## args) -struct lsm6dsm_data lsm6dsm_a_data; -struct lsm6dsm_data lsm6dsm_g_data; - /** * @return output base register for sensor */ diff --git a/driver/baro_bmp280.c b/driver/baro_bmp280.c index d755b278fd..2e939ceac3 100644 --- a/driver/baro_bmp280.c +++ b/driver/baro_bmp280.c @@ -396,8 +396,6 @@ static int bmp280_get_data_rate(const struct motion_sensor_t *s) return data->rate << BMP280_RATE_SHIFT; } -struct bmp280_drv_data_t bmp280_drv_data; - const struct accelgyro_drv bmp280_drv = { .init = bmp280_init, .read = bmp280_read, |