summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt_wang <matt_wang@compal.corp-partner.google.com>2023-01-30 19:14:45 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-31 06:58:23 +0000
commitaf02307a2610db11153b9ca0863bf8391bc02ab6 (patch)
tree390cdc6f89d515a6cf3f6a495bb856f7dc8e0871
parentf22f03e698fb89988c7b576a9d794cf04fdd2393 (diff)
downloadchrome-ec-af02307a2610db11153b9ca0863bf8391bc02ab6.tar.gz
xivu: modify form_factor motionsene function
Disable the tablet mode motionsense function when unit is 180 sku. BUG=b:265752765 BRANCH=nissa TEST=The 180 SKU DTT Platform Type is not the tablet mode. And the 360 SKU can get the correct clamshell mode or the tablet mode. LOW_COVERAGE_REASON=Skyrim board tests not created yet: b/247151116 Change-Id: I2ce7976dac02b2baf29da392f839e9ef06aaf057 Signed-off-by: matt_wang <matt_wang@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4199253 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com>
-rw-r--r--zephyr/program/nissa/xivu/src/form_factor.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/zephyr/program/nissa/xivu/src/form_factor.c b/zephyr/program/nissa/xivu/src/form_factor.c
index 51632c2f6b..bfb3eee466 100644
--- a/zephyr/program/nissa/xivu/src/form_factor.c
+++ b/zephyr/program/nissa/xivu/src/form_factor.c
@@ -22,22 +22,34 @@
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-static bool use_alt_sensor;
-static bool use_alt_lid_accel;
+enum motionsense_type {
+ motion_none = 0,
+ motion_bmi323,
+ motion_lsm6dso,
+};
+
+enum lid_accel_type {
+ lid_none = 0,
+ lid_bma422,
+ lid_lis2dw12,
+};
+
+static int use_sensor = motion_bmi323;
+static int use_lid_accel = lid_bma422;
void motion_interrupt(enum gpio_signal signal)
{
- if (use_alt_sensor)
+ if (use_sensor == motion_bmi323)
bmi3xx_interrupt(signal);
- else
+ else if (use_sensor == motion_lsm6dso)
lsm6dso_interrupt(signal);
}
void lid_accel_interrupt(enum gpio_signal signal)
{
- if (use_alt_lid_accel)
+ if (use_lid_accel == lid_bma422)
bma4xx_interrupt(signal);
- else
+ else if (use_lid_accel == lid_lis2dw12)
lis2dw12_interrupt(signal);
}
@@ -45,33 +57,42 @@ static void form_factor_init(void)
{
if (cros_cbi_ssfc_check_match(
CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_bmi323)))) {
- use_alt_sensor = true;
+ use_sensor = motion_bmi323;
MOTIONSENSE_ENABLE_ALTERNATE(alt_base_accel);
MOTIONSENSE_ENABLE_ALTERNATE(alt_base_gyro);
ccprints("BASE ACCEL IS BMI323");
} else if (cros_cbi_ssfc_check_match(CBI_SSFC_VALUE_ID(
DT_NODELABEL(base_sensor_lsm6dso)))) {
- use_alt_sensor = false;
+ use_sensor = motion_lsm6dso;
ccprints("BASE ACCEL IS LSM6DSO");
} else {
- use_alt_sensor = false;
+ use_sensor = motion_none;
ccprints("no motionsense");
}
if (cros_cbi_ssfc_check_match(
CBI_SSFC_VALUE_ID(DT_NODELABEL(lid_sensor_bma422)))) {
- use_alt_lid_accel = true;
+ use_lid_accel = lid_bma422;
MOTIONSENSE_ENABLE_ALTERNATE(alt_lid_accel);
ccprints("LID SENSOR IS BMA422");
} else if (cros_cbi_ssfc_check_match(CBI_SSFC_VALUE_ID(
DT_NODELABEL(lid_sensor_lis2dw12)))) {
- use_alt_lid_accel = false;
+ use_lid_accel = lid_lis2dw12;
ccprints("LID SENSOR IS LIS2DW12");
} else {
- use_alt_lid_accel = false;
+ use_lid_accel = lid_none;
ccprints("no lid sensor");
}
- motion_sensors_check_ssfc();
+ if (use_sensor && use_lid_accel) {
+ motion_sensors_check_ssfc();
+ } else {
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ gpio_disable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_imu));
+ gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_imu_int_l),
+ GPIO_DISCONNECTED);
+ ccprints("Clamshell: disable motionsense function.");
+ }
}
DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C);