mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-01 12:52:26 +00:00
hammer: Pulse detection pin on USB wake event
When usb_wake is called (key press, trackpad event), pulse
detection pin for 100us. This allows Lid EC to wake the AP
even when it is in deep S3 mode, where normal wake using USB
lines does not work.
BRANCH=none
BUG=b:35775062
TEST=Flash hammer, looks at poppy console: base power is not
disconnected, but events appear in the console.
Change-Id: I7b8ee407046d4caa1ce75190c30d693b71b00d2e
Reviewed-on: https://chromium-review.googlesource.com/448380
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
49c776b5b7
commit
7fb0338cbd
@@ -15,6 +15,7 @@
|
||||
#include "pwm_chip.h"
|
||||
#include "registers.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "update_fw.h"
|
||||
#include "usart-stm32f0.h"
|
||||
#include "usart_tx_dma.h"
|
||||
@@ -85,3 +86,23 @@ void board_config_pre_init(void)
|
||||
*/
|
||||
STM32_SYSCFG_CFGR1 |= (1 << 9) | (1 << 10); /* Remap USART1 RX/TX DMA */
|
||||
}
|
||||
|
||||
/*
|
||||
* Side-band USB wake, to be able to wake lid even in deep S3, when USB
|
||||
* controller is off.
|
||||
*/
|
||||
void board_usb_wake(void)
|
||||
{
|
||||
/*
|
||||
* Poke detection pin for less than 100us, we disable interrupts
|
||||
* to make sure that we do not get preempted (setting GPIO high
|
||||
* for too long would prevent pulse detection on lid EC side from
|
||||
* working properly, or even kill hammer power if it is held for
|
||||
* longer than debounce time).
|
||||
*/
|
||||
interrupt_disable();
|
||||
gpio_set_flags(GPIO_BASE_DET, GPIO_OUT_HIGH);
|
||||
udelay(100);
|
||||
gpio_set_flags(GPIO_BASE_DET, GPIO_INPUT);
|
||||
interrupt_enable();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ GPIO(KEYBOARD_BACKLIGHT, PIN(B, 9), GPIO_OUT_LOW)
|
||||
|
||||
GPIO(WP_L, PIN(A, 13), GPIO_INPUT)
|
||||
|
||||
GPIO(BASE_DET, PIN(A, 15), GPIO_INPUT)
|
||||
|
||||
/* Unimplemented signals since we are not an EC */
|
||||
UNIMPLEMENTED(ENTERING_RW)
|
||||
|
||||
|
||||
@@ -372,6 +372,12 @@ static volatile int usb_wake_done = 1;
|
||||
*/
|
||||
static volatile int esof_count;
|
||||
|
||||
__attribute__((weak))
|
||||
void board_usb_wake(void)
|
||||
{
|
||||
/* Side-band USB wake, do nothing by default. */
|
||||
}
|
||||
|
||||
void usb_wake(void)
|
||||
{
|
||||
if (!remote_wakeup_enabled ||
|
||||
@@ -396,6 +402,9 @@ void usb_wake(void)
|
||||
*/
|
||||
esof_count = 3;
|
||||
STM32_USB_CNTR |= STM32_USB_CNTR_RESUME | STM32_USB_CNTR_ESOFM;
|
||||
|
||||
/* Try side-band wake as well. */
|
||||
board_usb_wake();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@ int usb_is_suspended(void);
|
||||
*/
|
||||
void usb_wake(void);
|
||||
|
||||
/* Board-specific USB wake, for side-band wake, called by usb_wake above. */
|
||||
void board_usb_wake(void);
|
||||
|
||||
#ifdef CONFIG_USB_SELECT_PHY
|
||||
/* Select which PHY to use. */
|
||||
void usb_select_phy(uint32_t phy);
|
||||
|
||||
Reference in New Issue
Block a user