diff options
Diffstat (limited to 'zephyr/shim/src/motionsense_driver')
8 files changed, 0 insertions, 491 deletions
diff --git a/zephyr/shim/src/motionsense_driver/bma255-drvinfo.inc b/zephyr/shim/src/motionsense_driver/bma255-drvinfo.inc deleted file mode 100644 index 7db46811ad..0000000000 --- a/zephyr/shim/src/motionsense_driver/bma255-drvinfo.inc +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "driver/accel_bma2x2_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 BMI260 drvinfo instance in device tree. - * (compatible = "cros-ec,drvdata-bma255") - */ -/* Declare BMA255 driver data */ -#define CREATE_SENSOR_DATA_BMA255(id, drvdata_name) \ - static struct accelgyro_saved_data_t drvdata_name; - -CREATE_SENSOR_DATA(cros_ec_drvdata_bma255, CREATE_SENSOR_DATA_BMA255) - -/* - * 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 BMA255 - * instance(compatible = "cros-ec,bma255") in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_bma255, MOTIONSENSE_CHIP_BMA255, \ - MOTIONSENSE_TYPE_ACCEL, bma2x2_accel_drv, \ - BMA255_ACCEL_MIN_FREQ, BMA255_ACCEL_MAX_FREQ) diff --git a/zephyr/shim/src/motionsense_driver/bmi160-drvinfo.inc b/zephyr/shim/src/motionsense_driver/bmi160-drvinfo.inc deleted file mode 100644 index dd7b21641b..0000000000 --- a/zephyr/shim/src/motionsense_driver/bmi160-drvinfo.inc +++ /dev/null @@ -1,57 +0,0 @@ -/* 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 "driver/accelgyro_bmi_common_public.h" -#include "driver/accelgyro_bmi160_public.h" - -/* - * CREATE_SENSOR_DATA which is defined in motionsense_sensros.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. It can be shared among the entries in - * motion_sensors array which are using the same bmi160 driver. - */ -#define CREATE_SENSOR_DATA_BMI160(id, drvdata_name) \ - static struct bmi_drv_data_t drvdata_name; - -/* - * Create driver data for each BMI160 drvinfo instance in device tree. - * (compatible = "cros-ec,drvdata-bmi160") - */ -CREATE_SENSOR_DATA(cros_ec_drvdata_bmi160, CREATE_SENSOR_DATA_BMI160) -/* - * 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. - */ - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each BMI160_accel instance(compatible = "cros-ec,bmi160-accel") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_bmi160_accel, MOTIONSENSE_CHIP_BMI160, \ - MOTIONSENSE_TYPE_ACCEL, bmi160_drv, \ - BMI_ACCEL_MIN_FREQ, BMI_ACCEL_MAX_FREQ) - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each BMI260_gyro instance (compatible = "cros-ec,bmi160-gyro") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_bmi160_gyro, MOTIONSENSE_CHIP_BMI160, \ - MOTIONSENSE_TYPE_GYRO, bmi160_drv, \ - BMI_GYRO_MIN_FREQ, BMI_GYRO_MAX_FREQ) diff --git a/zephyr/shim/src/motionsense_driver/bmi260-drvinfo.inc b/zephyr/shim/src/motionsense_driver/bmi260-drvinfo.inc deleted file mode 100644 index 2457fca31a..0000000000 --- a/zephyr/shim/src/motionsense_driver/bmi260-drvinfo.inc +++ /dev/null @@ -1,57 +0,0 @@ -/* 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 "driver/accelgyro_bmi_common_public.h" -#include "driver/accelgyro_bmi260_public.h" - -/* - * CREATE_SENSOR_DATA which is defined in motionsense_sensros.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. It can be shared among the entries in - * motion_sensors array which are using the same bmi260 driver. - */ -#define CREATE_SENSOR_DATA_BMI260(id, drvdata_name) \ - static struct bmi_drv_data_t drvdata_name; - -/* - * Create driver data for each BMI260 drvinfo instance in device tree. - * (compatible = "cros-ec,drvdata-bmi260") - */ -CREATE_SENSOR_DATA(cros_ec_drvdata_bmi260, CREATE_SENSOR_DATA_BMI260) -/* - * CREATE_MOTION_SENSOR which is defined in motionsense_sensros.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. - */ - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each BMI260_accel instance(compatible = "cros-ec,bmi260-accel") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_bmi260_accel, MOTIONSENSE_CHIP_BMI260, \ - MOTIONSENSE_TYPE_ACCEL, bmi260_drv, \ - BMI_ACCEL_MIN_FREQ, BMI_ACCEL_MAX_FREQ) - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each BMI260_gyro instance (compatible = "cros-ec,bmi260-gyro") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_bmi260_gyro, MOTIONSENSE_CHIP_BMI260, \ - MOTIONSENSE_TYPE_GYRO, bmi260_drv, \ - BMI_GYRO_MIN_FREQ, BMI_GYRO_MAX_FREQ) diff --git a/zephyr/shim/src/motionsense_driver/drvdata-accelgyro.h b/zephyr/shim/src/motionsense_driver/drvdata-accelgyro.h deleted file mode 100644 index 069587f90f..0000000000 --- a/zephyr/shim/src/motionsense_driver/drvdata-accelgyro.h +++ /dev/null @@ -1,127 +0,0 @@ -/* 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. - */ - -/* - * Macros are to help creating driver data. A driver data that uses - * any data structures defined in accelgyro.h should use the macros here - * to utilize the information in device tree. - * - */ -#ifndef __ZEPHYR_SHIM_SRC_MOTIONSENSE_DRIVER_DRVDATA_ACCELGYRO_H -#define __ZEPHYR_SHIM_SRC_MOTIONSENSE_DRIVER_DRVDATA_ACCELGYRO_H - -/* - * compatible = "cros-ec,accelgyro-als-channel-scale" - * als_channel_scale_t in accelgyro.h - * - * e.g) The following is the example in DT for als_channel_scale_t - * als-channel-scale { - * compatible = "cros-ec,accelgyro-als-channel-scale"; - * k-channel-scale = <1>; - * cover-scale = <1>; - * }; - */ -#define ACCELGYRO_ALS_CHANNEL_SCALE(id) \ - { \ - .k_channel_scale = \ - ALS_CHANNEL_SCALE(DT_PROP(id, k_channel_scale)),\ - .cover_scale = \ - ALS_CHANNEL_SCALE(DT_PROP(id, cover_scale)), \ - } - -#define ALS_CALIBRATION_CHANNEL_SCALE(id) \ - .als_cal.channel_scale = ACCELGYRO_ALS_CHANNEL_SCALE(id), - -#define ALS_CALIBRATION_SET(id) \ - .als_cal.scale = DT_PROP(id, scale), \ - .als_cal.uscale = DT_PROP(id, uscale), \ - .als_cal.offset = DT_PROP(id, offset), \ - ALS_CALIBRATION_CHANNEL_SCALE(DT_CHILD(id, als_channel_scale)) - -/* - * compatible = "cros-ec,accelgyro-als-drv-data" - * als_drv_data_t in accelgyro.h - * - * e.g) The following is the example in DT for als_drv_data_t - * als-drv-data { - * compatible = "cros-ec,accelgyro-als-drv-data"; - * als-cal { - * scale = <1>; - * uscale = <0>; - * offset = <0>; - * als-channel-scale { - * compatible = "cros-ec,accelgyro-als-channel-scale"; - * k-channel-scale = <1>; - * cover-scale = <1>; - * }; - * }; - * }; - */ -#define ACCELGYRO_ALS_DRV_DATA(id) \ - { \ - ALS_CALIBRATION_SET(DT_CHILD(id, als_cal)) \ - } - -#define RGB_CAL_RGB_SET_SCALE(id) \ - .scale = ACCELGYRO_ALS_CHANNEL_SCALE(id), - -#define RGB_CAL_RGB_SET_ONE(id, suffix) \ - .rgb_cal[suffix] = { \ - .offset = DT_PROP(id, offset), \ - .coeff[0] = FLOAT_TO_FP(DT_PROP_BY_IDX(id, coeff, 0)), \ - .coeff[1] = FLOAT_TO_FP(DT_PROP_BY_IDX(id, coeff, 1)), \ - .coeff[2] = FLOAT_TO_FP(DT_PROP_BY_IDX(id, coeff, 2)), \ - .coeff[3] = FLOAT_TO_FP(DT_PROP_BY_IDX(id, coeff, 3)), \ - RGB_CAL_RGB_SET_SCALE(DT_CHILD(id, als_channel_scale)) \ - }, - -/* - * compatible = "cros-ec,accelgyro-rgb-calibration" - * rgb_calibration_t in accelgyro.h - * - * e.g) The following is the example in DT for rgb_calibration_t - * rgb_calibration { - * compatible = "cros-ec,accelgyro-rgb-calibration"; - * - * irt = <1>; - * - * rgb-cal-x { - * offset = <0>; - * coeff = <0 0 0 0>; - * als-channel-scale { - * compatible = "cros-ec,accelgyro-als-channel-scale"; - * k-channel-scale = <1>; - * cover-scale = <1>; - * }; - * }; - * rgb-cal-y { - * offset = <0>; - * coeff = <0 0 0 0>; - * als-channel-scale { - * compatible = "cros-ec,accelgyro-als-channel-scale"; - * k-channel-scale = <1>; - * cover-scale = <1>; - * }; - * }; - * rgb-cal-z { - * offset = <0>; - * coeff = <0 0 0 0>; - * als-channel-scale { - * compatible = "cros-ec,accelgyro-als-channel-scale"; - * k-channel-scale = <1>; - * cover-scale = <1>; - * }; - * }; - * }; - */ -#define ACCELGYRO_RGB_CALIBRATION(id) \ - { \ - RGB_CAL_RGB_SET_ONE(DT_CHILD(id, rgb_cal_x), X) \ - RGB_CAL_RGB_SET_ONE(DT_CHILD(id, rgb_cal_y), Y) \ - RGB_CAL_RGB_SET_ONE(DT_CHILD(id, rgb_cal_z), Z) \ - .irt = INT_TO_FP(DT_PROP(id, irt)), \ - } - -#endif /* __ZEPHYR_SHIM_SRC_MOTIONSENSE_DRIVER_DRVDATA_ACCELGYRO_H */ diff --git a/zephyr/shim/src/motionsense_driver/kx022-drvinfo.inc b/zephyr/shim/src/motionsense_driver/kx022-drvinfo.inc deleted file mode 100644 index 800a9a1543..0000000000 --- a/zephyr/shim/src/motionsense_driver/kx022-drvinfo.inc +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "driver/accel_kionix.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-kionix") - */ -/* Declare Kionix driver data */ -#define CREATE_SENSOR_DATA_KIONIX(id, drvdata_name) \ - static struct kionix_accel_data drvdata_name; - -CREATE_SENSOR_DATA(cros_ec_drvdata_kionix, CREATE_SENSOR_DATA_KIONIX) - -/* - * 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 KX022 - * instance(compatible = "cros-ec,kx022") in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_kx022, MOTIONSENSE_CHIP_KX022, \ - MOTIONSENSE_TYPE_ACCEL, kionix_accel_drv, \ - KX022_ACCEL_MIN_FREQ, KX022_ACCEL_MAX_FREQ) diff --git a/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc b/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc deleted file mode 100644 index 433a9d4192..0000000000 --- a/zephyr/shim/src/motionsense_driver/lis2dw12-drvinfo.inc +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 deleted file mode 100644 index f8fa4b7e53..0000000000 --- a/zephyr/shim/src/motionsense_driver/sensor_drv_list.inc +++ /dev/null @@ -1,39 +0,0 @@ -/* 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. - */ - -/* - * A driver should create <chip>-drvinfo.inc to create - * driver-specific data and an motion sensor entry in - * motion_sensors array that are used by motion sense task. - * - * This file includes the .inc file and is used by motionsense_sensrs.c to - * create the sensor driver data and the entries in mostion_sensors array. - * - * e.g) bma255-drvinfo.inc is provided for BMA255 chip - * - * #ifdef CONFIG_ACCEL_BMA255 - * #include "bma255-drvinfo.inc" - * #endif - */ - -/* supported sensor driver list */ -#ifdef CONFIG_PLATFORM_EC_ACCEL_BMA255 -#include "bma255-drvinfo.inc" -#endif -#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 -#ifdef CONFIG_PLATFORM_EC_ACCELGYRO_BMI260 -#include "bmi260-drvinfo.inc" -#endif -#ifdef CONFIG_PLATFORM_EC_ALS_TCS3400 -#include "tcs3400-drvinfo.inc" -#endif diff --git a/zephyr/shim/src/motionsense_driver/tcs3400-drvinfo.inc b/zephyr/shim/src/motionsense_driver/tcs3400-drvinfo.inc deleted file mode 100644 index 346688d646..0000000000 --- a/zephyr/shim/src/motionsense_driver/tcs3400-drvinfo.inc +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 "driver/als_tcs3400_public.h" - -/* - * CREATE_SENSOR_DATA which is defined in motionsense_sensros.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. - */ - -/* include macros for common data strutures from accelgyro.h */ -#include "drvdata-accelgyro.h" - -/* Create driver data for tcs3400 driver. */ -#define CREATE_SENSOR_DATA_TCS3400_CLEAR(id, drvdata_name) \ - static struct als_drv_data_t drvdata_name = \ - ACCELGYRO_ALS_DRV_DATA(DT_CHILD(id, als_drv_data)); - -/* - * Create driver data for each TCS3400-clear drvdata instance in device tree. - * (compatible = "cros-ec,drvdata-tcs3400-clear") - */ -CREATE_SENSOR_DATA(cros_ec_drvdata_tcs3400_clear, \ - CREATE_SENSOR_DATA_TCS3400_CLEAR) - -/* driver data for tcs3400 rgb */ -#define TCS3400_RGB_SATRURATION(id) \ - COND_CODE_1(DT_NODE_HAS_PROP(id, again), \ - (.saturation.again = DT_PROP(id, again),), \ - (.saturation.again = TCS_DEFAULT_AGAIN,)) \ - COND_CODE_1(DT_NODE_HAS_PROP(id, atime), \ - (.saturation.again = DT_PROP(id, atime),), \ - (.saturation.again = TCS_DEFAULT_ATIME,)) - -#define CREATE_SENSOR_DATA_TCS3400_RGB(id, drvdata_name) \ - static struct tcs3400_rgb_drv_data_t drvdata_name = { \ - .calibration = ACCELGYRO_RGB_CALIBRATION( \ - DT_CHILD(id, rgb_calibration)), \ - TCS3400_RGB_SATRURATION(DT_CHILD(id, saturation)) \ - }; - -/* - * Create driver data for each TCS3400-rgb drvdata instance in device tree. - * (compatible = "cros-ec,drvdata-tcs3400-rgb") - */ -CREATE_SENSOR_DATA(cros_ec_drvdata_tcs3400_rgb, CREATE_SENSOR_DATA_TCS3400_RGB) -/* - * CREATE_MOTION_SENSOR which is defined in motionsense_sensros.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. - */ - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each TCS3400 clear instance (compatible = "cros-ec,tcs3400-clear") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_tcs3400_clear, MOTIONSENSE_CHIP_TCS3400, \ - MOTIONSENSE_TYPE_LIGHT, tcs3400_drv, \ - TCS3400_LIGHT_MIN_FREQ, TCS3400_LIGHT_MAX_FREQ) - -/* - * Here, we call CREATE_MOTION_SENSOR to create a motion_sensor_t entry - * for each TCS3400 RGB instance (compatible = "cros-ec,tcs3400-rgb") - * in device tree. - */ -CREATE_MOTION_SENSOR(cros_ec_tcs3400_rgb, MOTIONSENSE_CHIP_TCS3400, \ - MOTIONSENSE_TYPE_LIGHT_RGB, tcs3400_rgb_drv, 0, 0) |