summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Zhang <Ryan.Zhang@quantatw.com>2017-02-21 18:05:05 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-02-23 01:16:10 +0000
commitb6fa203d58ca11d18bf498713466da0a25a7fca2 (patch)
treed640e3623a8589b6ff683514ff6b6c6b2ec98e51
parentf2c85cc155805ec4a100a550078b9d8a2d591bb5 (diff)
downloadchrome-ec-b6fa203d58ca11d18bf498713466da0a25a7fca2.tar.gz
Sand:remove unsupport functions
+ remove Volume Buttons + remove ALS related config + remove Tablet Mode BUG=None BRANCH=firmware-reef-9042.B TEST=`make -j BOARD=sand`, system can boot up Change-Id: I46c9efb5904a4ac63e5d25d1a187b0ed5c99ee74 Signed-off-by: Ryan Zhang<Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/446139 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--board/sand/board.c146
-rw-r--r--board/sand/board.h11
-rw-r--r--board/sand/ec.tasklist1
-rw-r--r--board/sand/gpio.inc16
4 files changed, 5 insertions, 169 deletions
diff --git a/board/sand/board.c b/board/sand/board.c
index 58fafed5ca..7cff166ac4 100644
--- a/board/sand/board.c
+++ b/board/sand/board.c
@@ -7,7 +7,6 @@
#include "adc.h"
#include "adc_chip.h"
-#include "als.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_ramp.h"
@@ -15,7 +14,6 @@
#include "charger.h"
#include "chipset.h"
#include "console.h"
-#include "driver/als_opt3001.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
@@ -98,20 +96,6 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
}
#endif
-/*
- * enable_input_devices() is called by the tablet_mode ISR, but changes the
- * state of GPIOs, so its definition must reside after including gpio_list.
- * Use DECLARE_DEFERRED to generate enable_input_devices_data.
- */
-static void enable_input_devices(void);
-DECLARE_DEFERRED(enable_input_devices);
-
-#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
-void tablet_mode_interrupt(enum gpio_signal signal)
-{
- hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
-}
-
#include "gpio_list.h"
/* power signal list. Must match order of enum power_signal. */
@@ -443,25 +427,10 @@ int board_get_ambient_temp(int idx, int *temp_ptr)
const struct temp_sensor_t temp_sensors[] = {
/* FIXME(dhendrix): tweak action_delay_sec */
{"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0, 1},
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, board_get_ambient_temp, 0, 5},
{"Charger", TEMP_SENSOR_TYPE_BOARD, board_get_charger_temp, 1, 1},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-/* ALS instances. Must be in same order as enum als_id. */
-struct als_t als[] = {
- /* FIXME(dhendrix): verify attenuation_factor */
- {"TI", opt3001_init, opt3001_read_lux, 5},
-};
-BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
-
-const struct button_config buttons[CONFIG_BUTTON_COUNT] = {
- {"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_EC_VOLDN_BTN_ODL,
- 30 * MSEC, 0},
- {"Volume Up", KEYBOARD_BUTTON_VOLUME_UP, GPIO_EC_VOLUP_BTN_ODL,
- 30 * MSEC, 0},
-};
-
/* Called by APL power state machine when transitioning from G3 to S5 */
static void chipset_pre_init(void)
{
@@ -492,20 +461,9 @@ static void chipset_pre_init(void)
}
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, chipset_pre_init, HOOK_PRIO_DEFAULT);
-static void board_set_tablet_mode(void)
-{
- tablet_set_mode(!gpio_get_level(GPIO_TABLET_MODE_L));
-}
-
/* Initialize board. */
static void board_init(void)
{
- /* Ensure tablet mode is initialized according to the hardware state
- * so that the cached state reflects reality. */
- board_set_tablet_mode();
-
- gpio_enable_interrupt(GPIO_TABLET_MODE_L);
-
/* Enable charger interrupts */
gpio_enable_interrupt(GPIO_CHARGER_INT_L);
@@ -655,32 +613,6 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
return charger_get_vbus_voltage(port) < BD9995X_BC12_MIN_VOLTAGE;
}
-static void enable_input_devices(void)
-{
- /* We need to turn on tablet mode for motion sense */
- board_set_tablet_mode();
-
- /* Then, we disable peripherals only when the lid reaches 360 position.
- * (It's probably already disabled by motion_sense_task.)
- * We deliberately do not enable peripherals when the lid is leaving
- * 360 position. Instead, we let motion_sense_task enable it once it
- * reaches laptop zone (180 or less). */
- if (tablet_get_mode())
- lid_angle_peripheral_enable(0);
-}
-
-/* Enable or disable input devices, based on chipset state and tablet mode */
-#ifndef TEST_BUILD
-void lid_angle_peripheral_enable(int enable)
-{
- /* If the lid is in 360 position, ignore the lid angle,
- * which might be faulty. Disable keyboard and touchpad. */
- if (tablet_get_mode() || chipset_in_state(CHIPSET_STATE_ANY_OFF))
- enable = 0;
- keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
-}
-#endif
-
/* Called on AP S5 -> S3 transition */
static void board_chipset_startup(void)
{
@@ -689,8 +621,6 @@ static void board_chipset_startup(void)
/* Enable Trackpad */
gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, 0);
-
- hook_call_deferred(&enable_input_devices_data, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
@@ -702,10 +632,6 @@ static void board_chipset_shutdown(void)
/* Disable Trackpad */
gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, 1);
-
- hook_call_deferred(&enable_input_devices_data, 0);
- /* FIXME(dhendrix): Drive USB_PD_RST_ODL low to prevent
- leakage? (see comment in schematic) */
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
@@ -770,7 +696,6 @@ void board_hibernate_late(void)
/* Motion sensors */
/* Mutexes */
-static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
@@ -793,42 +718,6 @@ struct bmp280_drv_data_t bmp280_drv_data;
/* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Sand */
struct motion_sensor_t motion_sensors[] = {
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_KX022,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &kionix_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_kx022_data,
- .port = I2C_PORT_LID_ACCEL,
- .addr = KX022_ADDR1,
- .rot_standard_ref = NULL, /* Identity matrix. */
- .default_range = 2, /* g, enough for laptop. */
- .config = {
- /* AP: by default use EC settings */
- [SENSOR_CONFIG_AP] = {
- .odr = 0,
- .ec_rate = 0,
- },
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 0,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 0,
- },
- [SENSOR_CONFIG_EC_S5] = {
- .odr = 0,
- .ec_rate = 0,
- },
- },
- },
-
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -939,41 +828,6 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
-
- [BASE_BARO] = {
- .name = "Base Baro",
- .active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_BMP280,
- .type = MOTIONSENSE_TYPE_BARO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmp280_drv,
- .drv_data = &bmp280_drv_data,
- .port = I2C_PORT_BARO,
- .addr = BMP280_I2C_ADDRESS1,
- .default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
- .config = {
- /* AP: by default shutdown all sensors */
- [SENSOR_CONFIG_AP] = {
- .odr = 0,
- .ec_rate = 0,
- },
- /* EC does not need in S0 */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 0,
- .ec_rate = 0,
- },
- /* Sensor off in S3/S5 */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 0,
- .ec_rate = 0,
- },
- /* Sensor off in S3/S5 */
- [SENSOR_CONFIG_EC_S5] = {
- .odr = 0,
- .ec_rate = 0,
- },
- },
- },
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
diff --git a/board/sand/board.h b/board/sand/board.h
index f0c1c579b3..3d64e2473a 100644
--- a/board/sand/board.h
+++ b/board/sand/board.h
@@ -32,8 +32,6 @@
BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#define CONFIG_CMD_I2C_STRESS_TEST
-#define CONFIG_CMD_I2C_STRESS_TEST_ACCEL
-#define CONFIG_CMD_I2C_STRESS_TEST_ALS
#define CONFIG_CMD_I2C_STRESS_TEST_BATTERY
#define CONFIG_CMD_I2C_STRESS_TEST_CHARGER
#define CONFIG_CMD_I2C_STRESS_TEST_TCPC
@@ -73,8 +71,6 @@
#define GPIO_USB_ILIM_SEL GPIO_USB_A_CHARGE_EN_L
#define GPIO_USB_CTL1 GPIO_EN_PP5000
-#define CONFIG_TABLET_MODE
-
/* USB PD config */
#define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
#define CONFIG_CMD_PD_CONTROL
@@ -121,7 +117,6 @@
#define CONFIG_ADC
#define CONFIG_BOARD_VERSION
#define CONFIG_BOARD_SPECIFIC_VERSION
-#define CONFIG_BUTTON_COUNT 2
#define CONFIG_EXTPOWER_GPIO
#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
@@ -184,9 +179,6 @@
/* I2C ports */
#define I2C_PORT_GYRO NPCX_I2C_PORT1
-#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
-#define I2C_PORT_ALS NPCX_I2C_PORT2
-#define I2C_PORT_BARO NPCX_I2C_PORT2
#define I2C_PORT_BATTERY NPCX_I2C_PORT3
#define I2C_PORT_CHARGER NPCX_I2C_PORT3
/* Accelerometer and Gyroscope are the same device. */
@@ -202,11 +194,9 @@
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
-#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
#define CONFIG_BARO_BMP280
#define CONFIG_LID_ANGLE
-#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
@@ -253,7 +243,6 @@ enum power_signal {
enum temp_sensor_id {
TEMP_SENSOR_BATTERY = 0,
- TEMP_SENSOR_AMBIENT,
TEMP_SENSOR_CHARGER,
TEMP_SENSOR_COUNT
};
diff --git a/board/sand/ec.tasklist b/board/sand/ec.tasklist
index 9be7fd234c..032ef34171 100644
--- a/board/sand/ec.tasklist
+++ b/board/sand/ec.tasklist
@@ -22,7 +22,6 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
diff --git a/board/sand/gpio.inc b/board/sand/gpio.inc
index 00e3ba9ecf..32d1a3cde9 100644
--- a/board/sand/gpio.inc
+++ b/board/sand/gpio.inc
@@ -29,21 +29,11 @@ GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt) /* ACOK_OD
/* TODO: We might remove external pull-up for POWER_BUTTON_L in EVT */
GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */
GPIO_INT(LID_OPEN, PIN(6, 7), GPIO_INT_BOTH, lid_interrupt)
-/* Volume up and down buttons need to be swapped. The one closer to the hinge
- * should be volume up and the one closer to the user should be volume down.
- * (cros.bug/p/60057) */
-GPIO_INT(EC_VOLDN_BTN_ODL_SWAPPED, PIN(8, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(EC_VOLUP_BTN_ODL_SWAPPED, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-#define GPIO_EC_VOLDN_BTN_ODL GPIO_EC_VOLUP_BTN_ODL_SWAPPED
-#define GPIO_EC_VOLUP_BTN_ODL GPIO_EC_VOLDN_BTN_ODL_SWAPPED
-/* Tablet switch is active-low. L: lid is attached (360 position) H: detached */
-GPIO_INT(TABLET_MODE_L, PIN(3, 6), GPIO_INT_BOTH, tablet_mode_interrupt)
GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH | GPIO_SEL_1P8V, switch_interrupt) /* EC_WP_ODL */
GPIO_INT(BASE_SIXAXIS_INT_L, PIN(9, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V,
bmi160_interrupt)
-GPIO(LID_ACCEL_INT_L, PIN(C, 7), GPIO_INPUT | GPIO_SEL_1P8V)
/* I2C GPIOs will be set to alt. function later. */
GPIO(EC_I2C_GYRO_SDA, PIN(8, 7), GPIO_INPUT | GPIO_SEL_1P8V)
@@ -78,6 +68,11 @@ GPIO(PCH_SLP_S0_L, PIN(7, 5), GPIO_INPUT) /* SLP_S0_L */
ALTERNATE(PIN_MASK(4, 0x08), 1, MODULE_ADC, 0)
GPIO(EC_BRD_ID_EN_ODL, PIN(3, 5), GPIO_INPUT)
+GPIO(NC_36, PIN(3, 6), GPIO_INPUT | GPIO_PULL_UP) /* NC */
+GPIO(NC_82, PIN(8, 2), GPIO_INPUT | GPIO_PULL_UP) /* NC */
+GPIO(NC_83, PIN(8, 3), GPIO_INPUT | GPIO_PULL_UP) /* NC */
+GPIO(NC_C7, PIN(C, 7), GPIO_INPUT | GPIO_PULL_UP) /* NC */
+
GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT)
GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_ODR_HIGH)
GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC_ENTERING_RW */
@@ -163,7 +158,6 @@ ALTERNATE(PIN(4, 5), 6, MODULE_ADC, 0) /* TEMP_SENSOR_CHARGER (FIXME: alt funct
ALTERNATE(PIN_MASK(8, 0x80), 1, MODULE_I2C, 0) /* GPIO87 for EC_I2C_GYRO_SDA */
ALTERNATE(PIN_MASK(9, 0x01), 1, MODULE_I2C, 0) /* GPIO90 for EC_I2C_GYRO_SCL */
-ALTERNATE(PIN_MASK(9, 0x06), 1, MODULE_I2C, 0) /* GPIO92-91 for EC_I2C_SENSOR_SDA/SCL */
ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* GPIOB5-B4 for EC_I2C_USB_C0_PD_SDA/SCL */
ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* GPOPB3-B2 for EC_I2C_USB_C1_PD_SDA/SCL */
ALTERNATE(PIN_MASK(D, 0x03), 1, MODULE_I2C, 0) /* GPIOD1-D0 for EC_I2C_POWER_SDA/SCL */