summaryrefslogtreecommitdiff
path: root/board/treeya/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/treeya/board.c')
-rw-r--r--board/treeya/board.c106
1 files changed, 46 insertions, 60 deletions
diff --git a/board/treeya/board.c b/board/treeya/board.c
index 642948dbd0..9a887a9f2d 100644
--- a/board/treeya/board.c
+++ b/board/treeya/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,45 +32,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);
@@ -83,19 +73,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",
@@ -162,8 +148,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 */
@@ -177,8 +162,8 @@ static int board_use_st_sensor(void)
/* sku_id 0xa8-0xa9, 0xbe, 0xbf use ST sensors */
uint32_t sku_id = system_get_sku_id();
- if (sku_id == 0xa8 || sku_id == 0xa9 ||
- sku_id == 0xbe || sku_id == 0xbf)
+ if (sku_id == 0xa8 || sku_id == 0xa9 || sku_id == 0xbe ||
+ sku_id == 0xbf)
return 1;
else
return 0;
@@ -197,10 +182,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 */
@@ -210,12 +197,11 @@ 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);
}
- if (sku_id == 160 || sku_id == 168 || sku_id == 169 ||
- sku_id == 190 || sku_id == 191) {
+ if (sku_id == 160 || sku_id == 168 || sku_id == 169 || sku_id == 190 ||
+ sku_id == 191) {
is_psl_hibernate = 0;
} else {
is_psl_hibernate = 1;
@@ -312,7 +298,7 @@ void board_hibernate_late(void)
}
/* Clear all pending IRQ otherwise wfi will have no affect */
- for (i = NPCX_IRQ_0 ; i < NPCX_IRQ_COUNT ; i++)
+ for (i = NPCX_IRQ_0; i < NPCX_IRQ_COUNT; i++)
task_clear_pending_irq(i);
__enter_hibernate_in_psl();