summaryrefslogtreecommitdiff
path: root/board/storo
diff options
context:
space:
mode:
authorMike Lee <mike5@huaqin.corp-partner.google.com>2021-07-12 11:40:55 +0800
committerCommit Bot <commit-bot@chromium.org>2021-07-21 03:24:13 +0000
commit0300ef969203bc462090496b0d14e7e839fc3921 (patch)
tree3a99d38d47d2fb881f5697913a640405ed68e674 /board/storo
parent082f6232f68251a65ef4cdca643323d60afb7f5c (diff)
downloadchrome-ec-0300ef969203bc462090496b0d14e7e839fc3921.tar.gz
storo: remove base sensor of clamshell board
according to OEM request, we will remove base sensor for clamshell baord in DVT2 state. BUG=b:193314277 BRANCH=dedede TEST=make BOARD=storo pass, and test rework board OK. Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Change-Id: Iefc965f468529e48c521c600f3edd98fabb1cdff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3016494 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/storo')
-rw-r--r--board/storo/board.c59
-rw-r--r--board/storo/board.h1
2 files changed, 48 insertions, 12 deletions
diff --git a/board/storo/board.c b/board/storo/board.c
index 664e731013..d4c36d5456 100644
--- a/board/storo/board.c
+++ b/board/storo/board.c
@@ -8,6 +8,7 @@
#include "adc_chip.h"
#include "button.h"
#include "cbi_fw_config.h"
+#include "cros_board_info.h"
#include "cbi_ssfc.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -46,6 +47,7 @@
#include "usb_pd_tcpm.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ## args)
#define INT_RECHECK_US 5000
@@ -624,7 +626,7 @@ struct motion_sensor_t motion_sensors[] = {
},
};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
static const mat33_fp_t lid_lis2dwl_ref = {
{ 0, FLOAT_TO_FP(1), 0},
@@ -715,6 +717,7 @@ struct motion_sensor_t icm42607_base_gyro = {
void board_init(void)
{
int on;
+ uint32_t board_id;
gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C1_INT_ODL);
@@ -742,19 +745,51 @@ void board_init(void)
if (!gpio_get_level(GPIO_PEN_DET_ODL))
gpio_set_level(GPIO_EN_PP3300_PEN, 1);
- if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM42607) {
- motion_sensors[BASE_ACCEL] = icm42607_base_accel;
- motion_sensors[BASE_GYRO] = icm42607_base_gyro;
- ccprints("BASE GYRO is ICM42607");
+ cbi_get_board_version(&board_id);
+
+ if (board_id > 2) {
+ if (get_cbi_fw_config_tablet_mode()) {
+ if (get_cbi_ssfc_base_sensor() ==
+ SSFC_SENSOR_ICM42607) {
+ motion_sensors[BASE_ACCEL] =
+ icm42607_base_accel;
+ motion_sensors[BASE_GYRO] = icm42607_base_gyro;
+ CPRINTF("BASE GYRO is ICM42607");
+ } else {
+ CPRINTF("BASE GYRO is BMI160");
+ }
+
+ if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_LIS2DWL) {
+ motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
+ CPRINTF("LID_ACCEL is LIS2DWL");
+ } else {
+ CPRINTF("LID_ACCEL is BMA253");
+ }
+ } else {
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ /*
+ * Base accel is not stuffed, don't allow
+ * line to float.
+ */
+ gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
+ GPIO_INPUT | GPIO_PULL_DOWN);
+ }
} else {
- ccprints("BASE GYRO is BMI160");
- }
+ if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM42607) {
+ motion_sensors[BASE_ACCEL] = icm42607_base_accel;
+ motion_sensors[BASE_GYRO] = icm42607_base_gyro;
+ CPRINTF("BASE GYRO is ICM42607");
+ } else {
+ CPRINTF("BASE GYRO is BMI160");
+ }
- if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_LIS2DWL) {
- motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
- ccprints("LID_ACCEL is LIS2DWL");
- } else {
- ccprints("LID_ACCEL is BMA253");
+ if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_LIS2DWL) {
+ motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
+ CPRINTF("LID_ACCEL is LIS2DWL");
+ } else {
+ CPRINTF("LID_ACCEL is BMA253");
+ }
}
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/storo/board.h b/board/storo/board.h
index 6f6392005b..428ba7173c 100644
--- a/board/storo/board.h
+++ b/board/storo/board.h
@@ -43,6 +43,7 @@
/* Sensors */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
#define CONFIG_ACCEL_BMA255 /* Lid accel */
#define CONFIG_ACCEL_LIS2DWL