summaryrefslogtreecommitdiff
path: root/board/boten
diff options
context:
space:
mode:
authorarthur.lin <arthur.lin@lcfc.corp-partner.google.com>2021-11-15 13:41:47 +0800
committerCommit Bot <commit-bot@chromium.org>2021-11-17 07:16:02 +0000
commit88fe2efe372ebe3297a08a840ec4d51c2738a0e3 (patch)
tree0b91a63925d51edacefe05886ffcc02434f5484e /board/boten
parent82a369e7a5d1f664265b1e1896af45a034519e7b (diff)
downloadchrome-ec-88fe2efe372ebe3297a08a840ec4d51c2738a0e3.tar.gz
boten: support clamshell sku
Use tabletmode bit in FW_CONFIG to decide clamshell or convertible. Some GPIO will not to use in clamshell sku. BRANCH=dedede BUG=None TEST=make buildall -j Signed-off-by: arthur.lin <arthur.lin@lcfc.corp-partner.google.com> Change-Id: I1e0e640dd8497a4f2a36fddb77eb05a642baa312 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3281431 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Henry Sun <henrysun@google.com>
Diffstat (limited to 'board/boten')
-rw-r--r--board/boten/board.c83
-rw-r--r--board/boten/board.h2
2 files changed, 53 insertions, 32 deletions
diff --git a/board/boten/board.c b/board/boten/board.c
index b6301834bf..17436a0091 100644
--- a/board/boten/board.c
+++ b/board/boten/board.c
@@ -7,6 +7,7 @@
#include "adc_chip.h"
#include "button.h"
+#include "cbi_fw_config.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
#include "charger.h"
@@ -216,37 +217,6 @@ const int usb_port_enable[USB_PORT_COUNT] = {
GPIO_EN_USB_A0_VBUS,
};
-void board_init(void)
-{
- gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL);
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
- gpio_enable_interrupt(GPIO_HDMI_HPD_SUB_ODL);
- /* Enable gpio interrupt for pen detect */
- gpio_enable_interrupt(GPIO_PEN_DET_ODL);
-
- /* Make sure pen detection is triggered or not at sysjump */
- if (!gpio_get_level(GPIO_PEN_DET_ODL))
- gpio_set_level(GPIO_EN_PP5000_PEN, 1);
-
- if (gpio_get_level(GPIO_PEN_DET_ODL))
- gpio_set_level(GPIO_PEN_DET_PCH, 1);
-
- /* Set LEDs luminance */
- pwm_set_duty(PWM_CH_LED_RED, 70);
- pwm_set_duty(PWM_CH_LED_GREEN, 70);
- pwm_set_duty(PWM_CH_LED_WHITE, 70);
-
- /*
- * If interrupt lines are already low, schedule them to be processed
- * after inits are completed.
- */
- if (!gpio_get_level(GPIO_USB_C0_INT_ODL))
- hook_call_deferred(&check_c0_line_data, 0);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
void board_reset_pd_mcu(void)
{
/*
@@ -467,7 +437,56 @@ 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)
+{
+ gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL);
+ gpio_enable_interrupt(GPIO_HDMI_HPD_SUB_ODL);
+ if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_PRESENT) {
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ /* Enable gpio interrupt for base accelgyro sensor */
+ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+
+ /* Enable gpio interrupt for pen detect */
+ gpio_enable_interrupt(GPIO_PEN_DET_ODL);
+
+ /* Make sure pen detection is triggered or not at sysjump */
+ if (!gpio_get_level(GPIO_PEN_DET_ODL))
+ gpio_set_level(GPIO_EN_PP5000_PEN, 1);
+
+ if (gpio_get_level(GPIO_PEN_DET_ODL))
+ gpio_set_level(GPIO_PEN_DET_PCH, 1);
+ } 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);
+
+ /* only clamshell sku todo */
+ gpio_set_flags(GPIO_PEN_DET_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_PEN_DET_PCH, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_EN_PP5000_PEN, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_360_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_VOLDN_BTN_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
+ }
+
+ /* Set LEDs luminance */
+ pwm_set_duty(PWM_CH_LED_RED, 70);
+ pwm_set_duty(PWM_CH_LED_GREEN, 70);
+ pwm_set_duty(PWM_CH_LED_WHITE, 70);
+
+ /*
+ * If interrupt lines are already low, schedule them to be processed
+ * after inits are completed.
+ */
+ if (!gpio_get_level(GPIO_USB_C0_INT_ODL))
+ hook_call_deferred(&check_c0_line_data, 0);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
diff --git a/board/boten/board.h b/board/boten/board.h
index 0e2a72015c..8c2b1d4417 100644
--- a/board/boten/board.h
+++ b/board/boten/board.h
@@ -93,6 +93,8 @@
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"