summaryrefslogtreecommitdiff
path: root/zephyr/projects/nissa/craask/src/form_factor.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/nissa/craask/src/form_factor.c')
-rw-r--r--zephyr/projects/nissa/craask/src/form_factor.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/zephyr/projects/nissa/craask/src/form_factor.c b/zephyr/projects/nissa/craask/src/form_factor.c
index 7c642119f1..ccf0e66a4f 100644
--- a/zephyr/projects/nissa/craask/src/form_factor.c
+++ b/zephyr/projects/nissa/craask/src/form_factor.c
@@ -22,9 +22,13 @@ LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
* Mainboard orientation support.
*/
+#define LIS_ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(lid_rot_bma422))
+#define BMA_ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(lid_rot_ref))
#define ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(base_rot_ver1))
+#define LID_SENSOR SENSOR_ID(DT_NODELABEL(lid_accel))
#define BASE_SENSOR SENSOR_ID(DT_NODELABEL(base_accel))
#define BASE_GYRO SENSOR_ID(DT_NODELABEL(base_gyro))
+#define ALT_LID_S SENSOR_ID(DT_NODELABEL(alt_lid_accel))
static bool use_alt_sensor;
@@ -51,6 +55,23 @@ static void form_factor_init(void)
motion_sensors[BASE_GYRO].rot_standard_ref = &ALT_MAT;
}
+ /*
+ * If the firmware config indicates
+ * an craaskbowl form factor, use the alternative
+ * rotation matrix.
+ */
+ ret = cros_cbi_get_fw_config(FW_LID_INVERSION, &val);
+ if (ret != 0) {
+ LOG_ERR("Error retrieving CBI FW_CONFIG field %d",
+ FW_LID_INVERSION);
+ return;
+ }
+ if (val == FW_LID_XY_ROT_180) {
+ LOG_INF("Lid sensor placement rotate 180 on xy plane");
+ motion_sensors[LID_SENSOR].rot_standard_ref = &LIS_ALT_MAT;
+ motion_sensors_alt[ALT_LID_S].rot_standard_ref = &BMA_ALT_MAT;
+ }
+
/* check which base sensor is used for motion_interrupt */
use_alt_sensor = cros_cbi_ssfc_check_match(
CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_1)));