diff options
author | Duncan Laurie <dlaurie@google.com> | 2017-06-29 07:16:01 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-30 22:24:50 -0700 |
commit | a26ab019b05f6da69f671da7c93ed6dae467aa21 (patch) | |
tree | fb6a74fe3d8b4148cd423b93f0540ae91b0f7e0e /board | |
parent | 282765fdd409fd16ed1e092e5d7fee8de5af7a5a (diff) | |
download | chrome-ec-a26ab019b05f6da69f671da7c93ed6dae467aa21.tar.gz |
eve: Enable device events
Use device events for waking the system from Deep S3.
This enables the trackpad and DSP as Deep S3 wake sources and allows
the AP to log them properly.
BUG=b:36024430
BRANCH=eve
TEST=manual testing on Eve with trackpad and DSP wake events
Change-Id: If17698a4901002e1590f4852f970fd9963964cb6
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/555633
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/eve/board.c | 44 | ||||
-rw-r--r-- | board/eve/board.h | 1 | ||||
-rw-r--r-- | board/eve/gpio.inc | 5 |
3 files changed, 39 insertions, 11 deletions
diff --git a/board/eve/board.c b/board/eve/board.c index 86e27d7f70..86b034e0b8 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -15,6 +15,7 @@ #include "charger.h" #include "chipset.h" #include "console.h" +#include "device_event.h" #include "driver/accel_kionix.h" #include "driver/accel_kxcj9.h" #include "driver/accelgyro_bmi160.h" @@ -90,8 +91,13 @@ void tablet_mode_interrupt(enum gpio_signal signal) /* Send event to wake AP based on trackpad input */ void trackpad_interrupt(enum gpio_signal signal) { - /* TODO(b/36024430): Use device specific wake event */ - host_set_single_event(EC_HOST_EVENT_KEY_PRESSED); + device_set_single_event(EC_DEVICE_EVENT_TRACKPAD); +} + +/* Send event to wake AP based on DSP interrupt */ +void dsp_interrupt(enum gpio_signal signal) +{ + device_set_single_event(EC_DEVICE_EVENT_DSP); } #ifdef CONFIG_USB_PD_TCPC_LOW_POWER @@ -377,8 +383,8 @@ int board_has_working_reset_flags(void) { int version = board_get_version(); - /* board version >= P1b will lose reset flags on power cycle */ - if (version >= 3) + /* board version P1b to EVTb will lose reset flags on power cycle */ + if (version >= 3 && version < 6) return 0; /* All other board versions should have working reset flags */ @@ -563,6 +569,17 @@ 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; } +/* Clear pending interrupts and enable DSP for wake */ +static void dsp_wake_enable(int enable) +{ + if (enable) { + gpio_clear_pending_interrupt(GPIO_MIC_DSP_IRQ_1V8_L); + gpio_enable_interrupt(GPIO_MIC_DSP_IRQ_1V8_L); + } else { + gpio_disable_interrupt(GPIO_MIC_DSP_IRQ_1V8_L); + } +} + /* Clear pending interrupts and enable trackpad for wake */ static void trackpad_wake_enable(int enable) { @@ -628,8 +645,9 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT); /* Called on AP S3 -> S5 transition */ static void board_chipset_shutdown(void) { - /* Disable Trackpad */ + /* Disable Trackpad and DSP wake in S5 */ trackpad_wake_enable(0); + dsp_wake_enable(0); gpio_set_level(GPIO_TRACKPAD_SHDN_L, 0); hook_call_deferred(&enable_input_devices_data, 0); } @@ -639,8 +657,14 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0); - if (!tablet_get_mode() && lid_is_open()) - trackpad_wake_enable(1); + if (lid_is_open()) { + /* Enable DSP wake if suspended with lid open */ + dsp_wake_enable(1); + + /* Enable trackpad wake if suspended and not in tablet mode */ + if (!tablet_get_mode()) + trackpad_wake_enable(1); + } } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); @@ -648,6 +672,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); static void board_chipset_resume(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1); + dsp_wake_enable(0); trackpad_wake_enable(0); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -655,8 +680,11 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); /* Called on lid change */ static void board_lid_change(void) { - if (!lid_is_open()) + /* Disable trackpad and DSP wake if lid is closed */ + if (!lid_is_open()) { trackpad_wake_enable(0); + dsp_wake_enable(0); + } } DECLARE_HOOK(HOOK_LID_CHANGE, board_lid_change, HOOK_PRIO_DEFAULT); diff --git a/board/eve/board.h b/board/eve/board.h index 049f99bfc0..b828aa31dd 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -29,6 +29,7 @@ #define CONFIG_BOARD_SPECIFIC_VERSION #define CONFIG_BUTTON_COUNT 2 #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL +#define CONFIG_DEVICE_EVENT #define CONFIG_DPTF #define CONFIG_DPTF_DEVICE_ORIENTATION #define CONFIG_FLASH_SIZE 0x80000 diff --git a/board/eve/gpio.inc b/board/eve/gpio.inc index 6413c465ab..c57e1ee250 100644 --- a/board/eve/gpio.inc +++ b/board/eve/gpio.inc @@ -25,6 +25,8 @@ GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt) GPIO_INT(ACCELGYRO3_INT_L, PIN(9, 3), GPIO_INT_FALLING, bmi160_interrupt) GPIO_INT(TRACKPAD_INT_L, PIN(7, 1), GPIO_INT_FALLING, trackpad_interrupt) +/* DSP IRQ is active low in schematic but DSP treats as active high */ +GPIO_INT(MIC_DSP_IRQ_1V8_L, PIN(C, 6), GPIO_INT_RISING | GPIO_SEL_1P8V, dsp_interrupt) #ifdef CONFIG_USB_PD_TCPC_LOW_POWER GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt) GPIO_INT(USB_C1_CABLE_DET, PIN(D, 3), GPIO_INT_RISING, anx74xx_cable_det_interrupt) @@ -68,9 +70,6 @@ GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C2_SENSOR_3V3_SDA */ GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_I2C3_POWER_SCL */ GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C3_POWER_SDA */ -/* AP wake sources when in Deep-S3 state */ -GPIO(DSP_WAKE_L, PIN(C, 6), GPIO_INPUT | GPIO_SEL_1P8V) /* INT# from DSP Mic */ - /* * For P1 and prior: 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A * For P1B and later: 5V enables: OUT_LOW=VBUS Off, OUT_HIGH=VBUS On |