diff options
author | Denis Brockus <dbrockus@google.com> | 2021-06-07 09:48:00 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-07 18:15:22 +0000 |
commit | 4df10f7b2b0e67d1c36bb69285436ec0d5e3fdfd (patch) | |
tree | 4276acbab14b79df5066770362347e14b0d6380d /zephyr/shim/src | |
parent | 43fffb5b0292ee1c48015b04ea55793a140d8177 (diff) | |
download | chrome-ec-4df10f7b2b0e67d1c36bb69285436ec0d5e3fdfd.tar.gz |
zephyr: driver: add ST accel_lis2dw12
BUG=b:180980668,b:189857004
BRANCH=none
TEST=make buildall
TEST=zmake configure -b $PROJ_HAYATO
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: Ib743f0dbcc4a9731ccb575344413f161cd0dbba2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2944617
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Yuval Peress <peress@chromium.org>
Commit-Queue: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/shim/src')
-rw-r--r-- | zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc | 44 | ||||
-rw-r--r-- | zephyr/shim/src/motionsense_driver/sensor_drv_list.inc | 3 |
2 files changed, 47 insertions, 0 deletions
diff --git a/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc b/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc new file mode 100644 index 0000000000..433a9d4192 --- /dev/null +++ b/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc @@ -0,0 +1,44 @@ +/* Copyright 2021 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. + */ + +#include "accel_lis2dw12_public.h" + +/* + * CREATE_SENSOR_DATA which is defined in motionsense_sensors.c is + * the helper to create sensor driver specific data. + * + * CREATE_SENSOR_DATA gets two arguments. One is the compatible + * property value specified in device tree and the other one is the macro + * that actually creates sensor driver specific data. The macro gets + * node id and the name to be used for the sensor driver data. + */ + +/* + * Create driver data for each Kionix drvinfo instance in device tree. + * (compatible = "cros-ec,drvdata-lis2dw12") + */ +/* Declare LIS2DW12 driver data */ +#define CREATE_SENSOR_DATA_LIS2DW12(id, drvdata_name) \ + static struct motion_sensor_t drvdata_name; + +CREATE_SENSOR_DATA(cros_ec_drvdata_lis2dw12, CREATE_SENSOR_DATA_LIS2DW12) + +/* + * CREATE_MOTION_SENSOR which is defined in motionsense_sensors.c is + * the macro to create an entry in motion_sensors array. + * The macro gets value of compatible property of + * the sensor in device tree and sensor specific values like chip ID, + * type of sensor, name of driver, default min/max frequency. + * Then using the values, it creates the corresponding motion_sense_t entry + * in motion_sensors array. + */ + +/* + * Create a motion_sensor_t entry for each LIS2DW12 + * instance(compatible = "cros-ec,lis2dw12") in device tree. + */ +CREATE_MOTION_SENSOR(cros_ec_lis2dw12, MOTIONSENSE_CHIP_LIS2DW12, \ + MOTIONSENSE_TYPE_ACCEL, lis2dw12_drv, \ + LIS2DW12_ODR_MIN_VAL, LIS2DW12_ODR_MAX_VAL) diff --git a/zephyr/shim/src/motionsense_driver/sensor_drv_list.inc b/zephyr/shim/src/motionsense_driver/sensor_drv_list.inc index b9b3a189ad..f8fa4b7e53 100644 --- a/zephyr/shim/src/motionsense_driver/sensor_drv_list.inc +++ b/zephyr/shim/src/motionsense_driver/sensor_drv_list.inc @@ -25,6 +25,9 @@ #ifdef CONFIG_PLATFORM_EC_ACCEL_KX022 #include "kx022-drvinfo.inc" #endif +#ifdef CONFIG_PLATFORM_EC_ACCEL_LIS2DW12 +#include "lis2dw12-drvinfo.inc" +#endif #ifdef CONFIG_PLATFORM_EC_ACCELGYRO_BMI160 #include "bmi160-drvinfo.inc" #endif |