From 13c68a3e7a85119367ddbcd130518163e4dcd619 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Thu, 20 Oct 2022 11:35:45 -0600 Subject: zephyr: rename projects folder to program Renme the projects folder to program for consistency with the name scheme used by the boxster configuration. BUG=b:254097139 BRANCH=none TEST=zmake compare-builds -a TEST=twister Signed-off-by: Keith Short Change-Id: Ib56a57f1e5942e6dd0460e3be81722896eed72af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3968444 Reviewed-by: Jeremy Bettis Commit-Queue: Jeremy Bettis --- zephyr/program/nissa/pujjo/motionsense.dtsi | 245 ++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 zephyr/program/nissa/pujjo/motionsense.dtsi (limited to 'zephyr/program/nissa/pujjo/motionsense.dtsi') diff --git a/zephyr/program/nissa/pujjo/motionsense.dtsi b/zephyr/program/nissa/pujjo/motionsense.dtsi new file mode 100644 index 0000000000..2dfca337c4 --- /dev/null +++ b/zephyr/program/nissa/pujjo/motionsense.dtsi @@ -0,0 +1,245 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + + +/ { + aliases { + /* + * Interrupt bindings for sensor devices. + */ + bmi3xx-int = &base_accel; + lsm6dsm-int = &base_accel; + lis2dw12-int = &lid_accel; + }; + + /* + * Declare mutexes used by sensor drivers. + * A mutex node is used to create an instance of mutex_t. + * A mutex node is referenced by a sensor node if the + * corresponding sensor driver needs to use the + * instance of the mutex. + */ + motionsense-mutex { + compatible = "cros-ec,motionsense-mutex"; + lid_mutex: lid-mutex { + }; + + base_mutex: base-mutex { + }; + }; + + /* Rotation matrix used by drivers. */ + motionsense-rotation-ref { + compatible = "cros-ec,motionsense-rotation-ref"; + lid_rot_ref: lid-rotation-ref { + mat33 = <0 (-1) 0 + (-1) 0 0 + 0 0 (-1)>; + }; + + lid_rot_lis2dw12: lid-rotation-lis2dw12 { + mat33 = <0 (-1) 0 + (-1) 0 0 + 0 0 (-1)>; + }; + + base_rot_ref: base-rotation-ref { + mat33 = <0 1 0 + (-1) 0 0 + 0 0 1>; + }; + + base_rot_lsm6dsm: base-rotation-lsm6dsm { + mat33 = <1 0 0 + 0 1 0 + 0 0 1>; + }; + }; + + /* + * Driver specific data. A driver-specific data can be shared with + * different motion sensors while they are using the same driver. + * + * If a node's compatible starts with "cros-ec,accelgyro-", it is for + * a common structure defined in accelgyro.h. + * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for + * "struct als_drv_data_t" in accelgyro.h + */ + motionsense-sensor-data { + bmi323_data: bmi323-drv-data { + compatible = "cros-ec,drvdata-bmi3xx"; + status = "okay"; + }; + + lsm6dsm_data_accel: lsm6dsm-accel-drv-data { + compatible = "cros-ec,drvdata-lsm6dsm"; + status = "okay"; + }; + + lsm6dsm_data_gyro: lsm6dsm-gyro-drv-data { + compatible = "cros-ec,drvdata-lsm6dsm"; + status = "okay"; + }; + + bma422_data: bma422-drv-data { + compatible = "cros-ec,drvdata-bma4xx"; + status = "okay"; + }; + + lis2dw12_data: lis2dw12-drv-data { + compatible = "cros-ec,drvdata-lis2dw12"; + status = "okay"; + }; + }; + + /* + * List of motion sensors that creates motion_sensors array. + * The nodelabel "lid_accel" and "base_accel" are used to indicate + * motion sensor IDs for lid angle calculation. + * TODO(b/238139272): The first entries of the array must be + * accelerometers,then gyroscope. Fix this dependency in the DTS + * processing which makes the devicetree entries independent. + */ + motionsense-sensor { + lid_accel: lid-accel { + compatible = "cros-ec,bma4xx"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + mutex = <&lid_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&lid_rot_ref>; + default-range = <2>; + drv-data = <&bma422_data>; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + base_accel: base-accel { + compatible = "cros-ec,bmi3xx-accel"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&base_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + drv-data = <&bmi323_data>; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + base_gyro: base-gyro { + compatible = "cros-ec,bmi3xx-gyro"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&base_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&base_rot_ref>; + drv-data = <&bmi323_data>; + }; + }; + + motionsense-sensor-alt { + alt_lid_accel: alt-lid-accel { + compatible = "cros-ec,lis2dw12"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + mutex = <&lid_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&lid_rot_lis2dw12>; + default-range = <2>; + drv-data = <&lis2dw12_data>; + i2c-spi-addr-flags = "LIS2DWL_ADDR1_FLAGS"; + alternate-for = <&lid_accel>; + alternate-ssfc-indicator = <&lid_sensor_1>; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + }; + }; + }; + + alt_base_accel: alt-base-accel { + compatible = "cros-ec,lsm6dsm-accel"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&base_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&base_rot_lsm6dsm>; + drv-data = <&lsm6dsm_data_accel>; + alternate-for = <&base_accel>; + alternate-ssfc-indicator = <&base_sensor_1>; + configs { + compatible = + "cros-ec,motionsense-sensor-config"; + ec-s0 { + odr = <(10000 | ROUND_UP_FLAG)>; + ec-rate = <(100 * USEC_PER_MSEC)>; + }; + ec-s3 { + odr = <(10000 | ROUND_UP_FLAG)>; + ec-rate = <0>; + }; + }; + }; + + alt_base_gyro: alt-base-gyro { + compatible = "cros-ec,lsm6dsm-gyro"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + mutex = <&base_mutex>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&base_rot_lsm6dsm>; + drv-data = <&lsm6dsm_data_gyro>; + alternate-for = <&base_gyro>; + alternate-ssfc-indicator = <&base_sensor_1>; + }; + }; + + motionsense-sensor-info { + compatible = "cros-ec,motionsense-sensor-info"; + + /* + * list of GPIO interrupts that have to + * be enabled at initial stage + */ + sensor-irqs = <&int_imu>; + /* list of sensors in force mode */ + accel-force-mode-sensors = <&lid_accel>; + }; +}; -- cgit v1.2.1 From 05dee9db4e4d863665925dfa374f37b9641af036 Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Fri, 4 Nov 2022 15:30:24 +1100 Subject: pujjo: enable interrupts for lid accel The BMA4xx driver now supports interrupts, so stop polling the lid accel. BUG=b:254380338 TEST=accelinfo still shows accurate lid angle on pujjo with LIS2DW12 sensor installed BRANCH=none LOW_COVERAGE_REASON=board-specific code is not tested Signed-off-by: Peter Marheine Change-Id: I29b8675736d38e1f737f9faf139ae9aa0058758c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4005683 Reviewed-by: Andrew McRae Code-Coverage: Zoss --- zephyr/program/nissa/pujjo/motionsense.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'zephyr/program/nissa/pujjo/motionsense.dtsi') diff --git a/zephyr/program/nissa/pujjo/motionsense.dtsi b/zephyr/program/nissa/pujjo/motionsense.dtsi index 2dfca337c4..1ca53252b6 100644 --- a/zephyr/program/nissa/pujjo/motionsense.dtsi +++ b/zephyr/program/nissa/pujjo/motionsense.dtsi @@ -14,6 +14,7 @@ bmi3xx-int = &base_accel; lsm6dsm-int = &base_accel; lis2dw12-int = &lid_accel; + bma4xx-int = &lid_accel; }; /* @@ -238,8 +239,6 @@ * list of GPIO interrupts that have to * be enabled at initial stage */ - sensor-irqs = <&int_imu>; - /* list of sensors in force mode */ - accel-force-mode-sensors = <&lid_accel>; + sensor-irqs = <&int_imu &int_lid_accel>; }; }; -- cgit v1.2.1 From 5dbfddec42bf47f88b371f16660beb48de058b57 Mon Sep 17 00:00:00 2001 From: Andrew McRae Date: Thu, 24 Nov 2022 11:55:03 +1100 Subject: pujjo: Add missing gyro config default-range Add missing default-range config properties for the lsm6dsm-gyro DTS. BUG=b:259551403 TEST=./twister -T zephyr/test/drivers BRANCH=none Signed-off-by: Andrew McRae Change-Id: Idaed21d75428aae93efd8d97252c63a6cded3ac2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4054384 Reviewed-by: Kazuhiro Inaba Reviewed-by: Peter Marheine Commit-Queue: Peter Marheine Code-Coverage: Zoss Reviewed-by: Tirath Ramdas --- zephyr/program/nissa/pujjo/motionsense.dtsi | 1 + 1 file changed, 1 insertion(+) (limited to 'zephyr/program/nissa/pujjo/motionsense.dtsi') diff --git a/zephyr/program/nissa/pujjo/motionsense.dtsi b/zephyr/program/nissa/pujjo/motionsense.dtsi index 1ca53252b6..af21e0509e 100644 --- a/zephyr/program/nissa/pujjo/motionsense.dtsi +++ b/zephyr/program/nissa/pujjo/motionsense.dtsi @@ -227,6 +227,7 @@ port = <&i2c_ec_i2c_sensor>; rot-standard-ref = <&base_rot_lsm6dsm>; drv-data = <&lsm6dsm_data_gyro>; + default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */ alternate-for = <&base_gyro>; alternate-ssfc-indicator = <&base_sensor_1>; }; -- cgit v1.2.1