diff options
Diffstat (limited to 'board/nuwani/board.c')
-rw-r--r-- | board/nuwani/board.c | 96 |
1 files changed, 41 insertions, 55 deletions
diff --git a/board/nuwani/board.c b/board/nuwani/board.c index 567a26c8ef..eb36ad9df8 100644 --- a/board/nuwani/board.c +++ b/board/nuwani/board.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -29,45 +29,35 @@ const enum gpio_signal hibernate_wake_pins[] = { GPIO_POWER_BUTTON_L, GPIO_EC_RST_ODL, }; -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); +const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /* I2C port map. */ const struct i2c_port_t i2c_ports[] = { - { - .name = "power", - .port = I2C_PORT_POWER, - .kbps = 100, - .scl = GPIO_I2C0_SCL, - .sda = GPIO_I2C0_SDA - }, - { - .name = "tcpc0", - .port = I2C_PORT_TCPC0, - .kbps = 400, - .scl = GPIO_I2C1_SCL, - .sda = GPIO_I2C1_SDA - }, - { - .name = "tcpc1", - .port = I2C_PORT_TCPC1, - .kbps = 400, - .scl = GPIO_I2C2_SCL, - .sda = GPIO_I2C2_SDA - }, - { - .name = "thermal", - .port = I2C_PORT_THERMAL_AP, - .kbps = 400, - .scl = GPIO_I2C3_SCL, - .sda = GPIO_I2C3_SDA - }, - { - .name = "sensor", - .port = I2C_PORT_SENSOR, - .kbps = 400, - .scl = GPIO_I2C7_SCL, - .sda = GPIO_I2C7_SDA - }, + { .name = "power", + .port = I2C_PORT_POWER, + .kbps = 100, + .scl = GPIO_I2C0_SCL, + .sda = GPIO_I2C0_SDA }, + { .name = "tcpc0", + .port = I2C_PORT_TCPC0, + .kbps = 400, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA }, + { .name = "tcpc1", + .port = I2C_PORT_TCPC1, + .kbps = 400, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA }, + { .name = "thermal", + .port = I2C_PORT_THERMAL_AP, + .kbps = 400, + .scl = GPIO_I2C3_SCL, + .sda = GPIO_I2C3_SDA }, + { .name = "sensor", + .port = I2C_PORT_SENSOR, + .kbps = 400, + .scl = GPIO_I2C7_SCL, + .sda = GPIO_I2C7_SDA }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); @@ -80,19 +70,15 @@ static struct stprivate_data g_lis2dwl_data; /* Base accel private data */ static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA; - /* Matrix to rotate accelrator into standard reference frame */ -static const mat33_fp_t lsm6dsm_base_standard_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +static const mat33_fp_t lsm6dsm_base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, + FLOAT_TO_FP(1) } }; -static const mat33_fp_t treeya_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +static const mat33_fp_t treeya_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; struct motion_sensor_t lid_accel_1 = { .name = "Lid Accel", @@ -159,8 +145,7 @@ struct motion_sensor_t base_gyro_1 = { .location = MOTIONSENSE_LOC_BASE, .drv = &lsm6dsm_drv, .mutex = &g_base_mutex_1, - .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data, - MOTIONSENSE_TYPE_GYRO), + .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data, MOTIONSENSE_TYPE_GYRO), .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ @@ -188,10 +173,12 @@ void board_update_sensor_config_from_sku(void) motion_sensors[LID_ACCEL] = lid_accel_1; motion_sensors[BASE_ACCEL] = base_accel_1; motion_sensors[BASE_GYRO] = base_gyro_1; - } else{ + } else { /*Need to change matrix for treeya*/ - motion_sensors[BASE_ACCEL].rot_standard_ref = &treeya_standard_ref; - motion_sensors[BASE_GYRO].rot_standard_ref = &treeya_standard_ref; + motion_sensors[BASE_ACCEL].rot_standard_ref = + &treeya_standard_ref; + motion_sensors[BASE_GYRO].rot_standard_ref = + &treeya_standard_ref; } /* Enable Gyro interrupts */ @@ -201,8 +188,7 @@ void board_update_sensor_config_from_sku(void) /* Device is clamshell only */ tablet_set_mode(0, TABLET_TRIGGER_LID); /* Gyro is not present, don't allow line to float */ - gpio_set_flags(GPIO_6AXIS_INT_L, - GPIO_INPUT | GPIO_PULL_DOWN); + gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN); } } |