diff options
author | Ben Chen <ben.chen2@quanta.corp-partner.google.com> | 2021-01-25 18:30:17 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-27 02:08:34 +0000 |
commit | 4d6efb50a1449121f5de3449b0905dca1da70be3 (patch) | |
tree | c3b3984a62ebbe65607ba4e6edbcee11f20180d3 /board | |
parent | c10b22901e01e00a9c2c0a5e790a54487f391fe6 (diff) | |
download | chrome-ec-4d6efb50a1449121f5de3449b0905dca1da70be3.tar.gz |
magolor: disable tablet mode by fw_config
Enable/disable teblet mode by fw_config
BUG=b:173908972
BRANCH=cros/main
TEST=`make buildall` PASS
Change-Id: Ia375fd18e8f910a547351b5c8b96c5e0ce16d383
Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2644795
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/magolor/board.c | 31 | ||||
-rw-r--r-- | board/magolor/board.h | 1 |
2 files changed, 22 insertions, 10 deletions
diff --git a/board/magolor/board.c b/board/magolor/board.c index 1ef86724a1..8a4a083343 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -7,6 +7,7 @@ #include "adc_chip.h" #include "button.h" +#include "cbi_fw_config.h" #include "cbi_ssfc.h" #include "charge_manager.h" #include "charge_state_v2.h" @@ -576,7 +577,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); void board_init(void) { @@ -589,15 +590,7 @@ void board_init(void) /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); - - /* Turn on 5V if the system is on, otherwise turn it off. */ - on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND | - CHIPSET_STATE_SOFT_OFF); - board_power_5v_enable(on); - - /* Initialize THERMAL */ - setup_thermal(); - + if (get_cbi_fw_config_tablet_mode()) { #ifdef BOARD_MAGOLOR if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM426XX) { motion_sensors[BASE_ACCEL] = icm426xx_base_accel; @@ -612,6 +605,24 @@ void board_init(void) } else ccprints("LID_ACCEL is BMA253"); #endif + motion_sensor_count = ARRAY_SIZE(motion_sensors); + /* Enable gpio interrupt for base accelgyro sensor */ + gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); + } 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); + } + + /* Turn on 5V if the system is on, otherwise turn it off. */ + on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND | + CHIPSET_STATE_SOFT_OFF); + board_power_5v_enable(on); + + /* Initialize THERMAL */ + setup_thermal(); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/magolor/board.h b/board/magolor/board.h index 648d431be5..f2bee3c30a 100644 --- a/board/magolor/board.h +++ b/board/magolor/board.h @@ -112,6 +112,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_ACCELGYRO_BMI160 /* Base accel */ |