diff options
author | James_Chao <james_chao@asus.corp-partner.google.com> | 2020-04-14 14:57:31 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-30 14:33:10 +0000 |
commit | ebc9b57eecb41b68a01244dfc40dca9ed4901f7d (patch) | |
tree | 960f2d3441a8ccc7c945bd0fdf2c37cf03a19e5e | |
parent | af9b76103a491a189b2935bc62097251d0337c62 (diff) | |
download | chrome-ec-ebc9b57eecb41b68a01244dfc40dca9ed4901f7d.tar.gz |
ampton: change sku id 3,4 for g-sensor BMA253 in the lid
The sku id 3,4 have never been manufactured. We use those id
to identify the sensor type in the lid.
BUG=b:153934973,b:154297511
BRANCH=octopus
TEST=Check the sensor work correctly.
Change-Id: Idf0b37fb0113e97a4927810cfaf9fbd1eb7a13a9
Signed-off-by: James_Chao <james_chao@asus.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2172563
Reviewed-by: Marco Chen <marcochen@chromium.org>
Reviewed-by: Li-jen Chen <lijen@google.com>
Commit-Queue: Li-jen Chen <lijen@google.com>
Commit-Queue: Henry Sun <henrysun@google.com>
-rw-r--r-- | board/ampton/board.c | 51 | ||||
-rw-r--r-- | board/ampton/board.h | 1 | ||||
-rw-r--r-- | board/ampton/gpio.inc | 3 |
3 files changed, 43 insertions, 12 deletions
diff --git a/board/ampton/board.c b/board/ampton/board.c index d6dc3fa258..3e5ab18510 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -11,6 +11,7 @@ #include "charge_state.h" #include "common.h" #include "cros_board_info.h" +#include "driver/accel_bma2x2.h" #include "driver/accel_kionix.h" #include "driver/accelgyro_bmi_common.h" #include "driver/ppc/sn5s330.h" @@ -175,6 +176,38 @@ const mat33_fp_t gyro_standard_ref = { static struct kionix_accel_data g_kx022_data; static struct bmi_drv_data_t g_bmi160_data; +/* BMA253 private data */ +static struct accelgyro_saved_data_t g_bma253_data; + +static const struct motion_sensor_t motion_sensor_bma253 = { + .name = "Lid Accel", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_BMA255, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_LID, + .drv = &bma2x2_accel_drv, + .mutex = &g_lid_mutex, + .drv_data = &g_bma253_data, + .port = I2C_PORT_SENSOR, + .i2c_spi_addr_flags = BMA2x2_I2C_ADDR2_FLAGS, + .rot_standard_ref = &lid_standard_ref, + .min_frequency = BMA255_ACCEL_MIN_FREQ, + .max_frequency = BMA255_ACCEL_MAX_FREQ, + .default_range = 2, /* g */ + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 0, + }, + /* Sensor on in S3 */ + [SENSOR_CONFIG_EC_S3] = { + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 0, + }, + }, +}; + /* Drivers */ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -267,11 +300,11 @@ static int board_is_convertible(void) /* SKU IDs of Ampton & unprovisioned: 1, 2, 3, 4, 255 */ return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 || sku_id == 255; -} + } -static int board_with_ar_cam(void) +static int board_with_sensor_bma253(void) { - /* SKU ID of Ampton with AR Cam: 3, 4 */ + /* SKU ID 3 and 4 of Ampton with BMA253 */ return sku_id == 3 || sku_id == 4; } @@ -279,6 +312,10 @@ static void board_update_sensor_config_from_sku(void) { if (board_is_convertible()) { motion_sensor_count = ARRAY_SIZE(motion_sensors); + + if (board_with_sensor_bma253()) + motion_sensors[LID_ACCEL] = motion_sensor_bma253; + /* Enable Base Accel interrupt */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); } else { @@ -289,14 +326,6 @@ static void board_update_sensor_config_from_sku(void) gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN); } - - if (board_with_ar_cam()) { - /* Enable interrupt from camera */ - gpio_enable_interrupt(GPIO_WFCAM_VSYNC); - } else { - /* Camera isn't stuffed, don't allow line to float */ - gpio_set_flags(GPIO_WFCAM_VSYNC, GPIO_INPUT | GPIO_PULL_DOWN); - } } static void board_customize_usbc_mux(uint32_t board_version) diff --git a/board/ampton/board.h b/board/ampton/board.h index 0420bc5ccf..69304cb7c8 100644 --- a/board/ampton/board.h +++ b/board/ampton/board.h @@ -33,6 +33,7 @@ #define CONFIG_STEINHART_HART_3V3_13K7_47K_4050B #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PP3300 +#define CONFIG_ACCEL_BMA255 /* Lid accel */ #define CONFIG_ACCEL_KX022 /* Lid accel */ #define CONFIG_ACCELGYRO_BMI160 /* Base accel */ #define CONFIG_SYNC /* Camera VSYNC */ diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc index 21ab353752..724d9a98d9 100644 --- a/board/ampton/gpio.inc +++ b/board/ampton/gpio.inc @@ -42,7 +42,6 @@ GPIO_INT(TABLET_MODE_L, PIN(H, 4), GPIO_INT_BOTH, gmr_tablet_switch_isr) GPIO_INT(EC_VOLDN_BTN_ODL, PIN(D, 6), GPIO_INT_BOTH, button_interrupt) GPIO_INT(EC_VOLUP_BTN_ODL, PIN(D, 5), GPIO_INT_BOTH, button_interrupt) GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt) -GPIO_INT(WFCAM_VSYNC, PIN(D, 4), GPIO_INT_RISING, sync_interrupt) GPIO(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INPUT | GPIO_SEL_1P8V) GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) /* PLT_RST_L: Platform Reset from SoC */ @@ -114,6 +113,8 @@ GPIO(BAT_LED_WHITE, PIN(A, 3), GPIO_OUT_LOW) /* LED_2_EC */ /* MKBP event synchronization */ GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH) +GPIO(WFCAM_VSYNC, PIN(D, 4), GPIO_INPUT | GPIO_PULL_DOWN) + UNIMPLEMENTED(KB_BL_PWR_EN) /* NC pins, enable internal pull-down to avoid floating state. */ |