diff options
author | Jett Rink <jettrink@chromium.org> | 2019-02-07 15:19:49 -0700 |
---|---|---|
committer | Jett Rink <jettrink@chromium.org> | 2019-02-26 14:31:15 +0000 |
commit | 8df604fec43740653366a79f53ec6378b97255f9 (patch) | |
tree | b4ac96843a5eaa669b304e9107b0647db4eef7e7 /board/arcada_ish/board.c | |
parent | 101a82ebc5b2be19fd3f73b9324b4fd05dd6fa1f (diff) | |
download | chrome-ec-8df604fec43740653366a79f53ec6378b97255f9.tar.gz |
arcada_ish: add sensor and heci tasks
Add sensor configuration for LSM6DS3 and heci host command task to
transfer sensor data to AP
BRANCH=none
BUG=b:122281217
TEST=arcada_ish can pass sensor data through iio sysfs interface using
CL stack and under-development kernel driver
Change-Id: Ic9250f6781b8501afe99e2999940020a2437e664
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1460085
Diffstat (limited to 'board/arcada_ish/board.c')
-rw-r--r-- | board/arcada_ish/board.c | 71 |
1 files changed, 68 insertions, 3 deletions
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c index cd66add92c..0c0fabc86e 100644 --- a/board/arcada_ish/board.c +++ b/board/arcada_ish/board.c @@ -5,14 +5,17 @@ /* Arcada ISH board-specific configuration */ +#include "accelgyro_lsm6dsm.h" #include "console.h" #include "gpio.h" +#include "hooks.h" #include "host_command.h" #include "i2c.h" +#include "motion_sense.h" +#include "power.h" +#include "task.h" #include "gpio_list.h" /* has to be included last */ -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) /* I2C port map */ const struct i2c_port_t i2c_ports[] = { @@ -24,8 +27,70 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -/* dummy functions to remove 'undefined' symbol link error for acpi.o +/* Sensor config */ +static struct mutex g_base_mutex; +/* sensor private data */ +static struct lsm6dsm_data lsm6dsm_a_data; + +/* Drivers */ +struct motion_sensor_t motion_sensors[] = { + [BASE_ACCEL] = { + .name = "Base Accel", + .active_mask = SENSOR_ACTIVE_S0, + .chip = MOTIONSENSE_CHIP_LSM6DS3, + .type = MOTIONSENSE_TYPE_ACCEL, + .location = MOTIONSENSE_LOC_BASE, + .drv = &lsm6dsm_drv, + .mutex = &g_base_mutex, + .drv_data = &lsm6dsm_a_data, + .port = I2C_PORT_SENSOR, + .addr = LSM6DSM_ADDR1, + .rot_standard_ref = NULL, /* TODO rotate correctly */ + .default_range = 4, /* g */ + .min_frequency = LSM6DSM_ODR_MIN_VAL, + .max_frequency = LSM6DSM_ODR_MAX_VAL, + .config = { + /* EC use accel for angle detection */ + [SENSOR_CONFIG_EC_S0] = { + .odr = 13000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, + }, + }, + }, + /* TODO(b/122281217): Add remain sensors */ +}; +const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); + +/* TODO(b/122364080): replace when implement real chipset/power task */ +int chipset_in_state(int state_mask) +{ + /* Until we know better, ISH assumes AP is always ON */ + return state_mask & CHIPSET_STATE_ON; +} + +/* TODO(b/122364080): replace when implement real chipset/power task */ +int chipset_in_or_transitioning_to_state(int state_mask) +{ + /* Until we know better, ISH assumes AP is always ON */ + return state_mask & CHIPSET_STATE_ON; +} + +/* TODO(b/122364080): replace when implement real chipset/power task */ +void chipset_force_shutdown(enum chipset_shutdown_reason reason) +{ +} + +/* TODO(b/122364080): remove when implement real chipset/power task */ +int board_idle_task(void *unused) +{ + while (1) + task_wait_event(-1); +} + +/* + * Dummy functions to remove 'undefined' symbol link error for acpi.o * due to CONFIG_LPC flag + * TODO(b/123634700): clean this up when implement EC->AP communication */ #ifdef CONFIG_HOSTCMD_LPC int lpc_query_host_event_state(void) |