diff options
-rw-r--r-- | zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml | 1 | ||||
-rw-r--r-- | zephyr/projects/nissa/BUILD.py | 1 | ||||
-rw-r--r-- | zephyr/projects/nissa/craask/cbi.dts | 39 | ||||
-rw-r--r-- | zephyr/projects/nissa/craask/motionsense.dts | 44 | ||||
-rw-r--r-- | zephyr/projects/nissa/craask/prj.conf | 1 | ||||
-rw-r--r-- | zephyr/projects/nissa/craask/src/form_factor.c | 2 |
6 files changed, 87 insertions, 1 deletions
diff --git a/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml b/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml index bd6c1d535b..054522068b 100644 --- a/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml +++ b/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml @@ -20,6 +20,7 @@ child-binding: description: Enum values used only for description purposes enum: + - AUDIO_CODEC - BASE_SENSOR - LID_SENSOR - LIGHTBAR diff --git a/zephyr/projects/nissa/BUILD.py b/zephyr/projects/nissa/BUILD.py index 34e1ce9a74..c18e68071f 100644 --- a/zephyr/projects/nissa/BUILD.py +++ b/zephyr/projects/nissa/BUILD.py @@ -58,6 +58,7 @@ craask = register_nissa_project( chip="npcx9m3f", extra_dts_overlays=[ "generated.dts", + "cbi.dts", "overlay.dts", "motionsense.dts", "keyboard.dts", diff --git a/zephyr/projects/nissa/craask/cbi.dts b/zephyr/projects/nissa/craask/cbi.dts new file mode 100644 index 0000000000..aa397941c0 --- /dev/null +++ b/zephyr/projects/nissa/craask/cbi.dts @@ -0,0 +1,39 @@ +/* Copyright 2022 The Chromium OS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/ { + /* Craask-specific ssfc fields. */ + cbi-ssfc { + compatible = "named-cbi-ssfc"; + /* + * SSFC bit0-1 was defined for AUDIO CODEC. + * 0: ALC5682I_VS + * 1: NAU8825 + */ + audio_codec { + enum-name = "AUDIO_CODEC"; + size = <2>; + }; + /* + * SSFC field to identify LID motion sensor. + */ + lid-sensor { + enum-name = "LID_SENSOR"; + size = <2>; + + lid_sensor_0: lis2dw12 { + compatible = "named-cbi-ssfc-value"; + status = "okay"; + value = <0>; + default; + }; + lid_sensor_1: bma422 { + compatible = "named-cbi-ssfc-value"; + status = "okay"; + value = <1>; + }; + }; + }; +}; diff --git a/zephyr/projects/nissa/craask/motionsense.dts b/zephyr/projects/nissa/craask/motionsense.dts index 445de5c9a9..a0085d63e6 100644 --- a/zephyr/projects/nissa/craask/motionsense.dts +++ b/zephyr/projects/nissa/craask/motionsense.dts @@ -24,7 +24,10 @@ */ motionsense-mutex { compatible = "cros-ec,motionsense-mutex"; - lid_mutex: lid-mutex { + lid_mutex: lis2dw12-mutex { + }; + + lid_mutex_bma422: bma422-mutex { }; base_mutex: base-mutex { @@ -51,6 +54,12 @@ 0 (-1) 0 0 0 1>; }; + + lid_rot_bma422: lid-rotation-ref { + mat33 = <1 0 0 + 0 (-1) 0 + 0 0 (-1)>; + }; }; /* @@ -72,6 +81,11 @@ compatible = "cros-ec,drvdata-lis2dw12"; status = "okay"; }; + + bma422_data: bma4xx-drv-data { + compatible = "cros-ec,drvdata-bma4xx"; + status = "okay"; + }; }; /* @@ -143,6 +157,34 @@ }; }; + motionsense-sensor-alt { + alt_lid_accel: alt-lid-accel { + compatible = "cros-ec,bma4xx"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + mutex = <&lid_mutex_bma422>; + port = <&i2c_ec_i2c_sensor>; + rot-standard-ref = <&lid_rot_bma422>; + default-range = <2>; + drv-data = <&bma422_data>; + i2c-spi-addr-flags = "BMA4_I2C_ADDR_PRIMARY"; + 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)>; + }; + }; + }; + }; + motionsense-sensor-info { compatible = "cros-ec,motionsense-sensor-info"; diff --git a/zephyr/projects/nissa/craask/prj.conf b/zephyr/projects/nissa/craask/prj.conf index 8e68048e35..75ec8e59e6 100644 --- a/zephyr/projects/nissa/craask/prj.conf +++ b/zephyr/projects/nissa/craask/prj.conf @@ -14,6 +14,7 @@ CONFIG_TACH_NPCX=n # Sensor drivers CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y +CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y # Keyboard CONFIG_CROS_KB_RAW_NPCX=y diff --git a/zephyr/projects/nissa/craask/src/form_factor.c b/zephyr/projects/nissa/craask/src/form_factor.c index cc0c4bd7f4..82f1f01a72 100644 --- a/zephyr/projects/nissa/craask/src/form_factor.c +++ b/zephyr/projects/nissa/craask/src/form_factor.c @@ -37,5 +37,7 @@ static void form_factor_init(void) motion_sensors[BASE_SENSOR].rot_standard_ref = &ALT_MAT; motion_sensors[BASE_GYRO].rot_standard_ref = &ALT_MAT; } + + motion_sensors_check_ssfc(); } DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C); |