summaryrefslogtreecommitdiff
path: root/include/uart.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2013-10-14 17:55:42 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-21 23:59:38 +0000
commit10bd1db6d73e21619e789d73c8233dea2c493510 (patch)
treedfc03ce44ce9ef3697cb707d2f160861697628b4 /include/uart.h
parent1d6687429c1ea236bf09ac32d4936888a36730e6 (diff)
downloadchrome-ec-10bd1db6d73e21619e789d73c8233dea2c493510.tar.gz
lm4: Use low speed clock in deep sleep.
Changed the low power idle task to use the low speed clock in deep sleep. The low power idle task is currently only enabled for Peppy, Slippy, and Falco. This change decreases power consumption when the AP is not running. Note that the low speed clock is slow enough that the JTAG cannot be used and the EC console UART cannot be used. To work around that, this commit detects when the JTAG is in use and when the EC console is in use, and will not use the low speed clock if either is in use. The JTAG in use never clears after being set and the console in use clears after a fixed timeout period. BUG=None BRANCH=None TEST=Passes all unit tests. Tested that the EC console works when in deep sleep. Tested that it is possible to run flash_ec when in deep sleep and using the low speed clock. Change-Id: Ia65997eb8e607a5df9b2c7d68e4826bfb1e0194c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/uart.h')
-rw-r--r--include/uart.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/uart.h b/include/uart.h
index 762d885f08..2f0bc8bd8c 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -101,6 +101,11 @@ void uart_tx_flush(void);
int uart_tx_ready(void);
/**
+ * Return non-zero if a transmit is in progress.
+ */
+int uart_tx_in_progress(void);
+
+/**
* Return non-zero if UART is ready to start a DMA transfer.
*/
int uart_tx_dma_ready(void);
@@ -195,6 +200,33 @@ void uart_process_input(void);
*/
void uart_process_output(void);
+/**
+ * Return boolean expressing whether UART buffer is empty or not.
+ */
+int uart_buffer_empty(void);
+
+/**
+ * Disable the EC console UART and convert the UART RX pin to a generic GPIO
+ * with an edge detect interrupt.
+ */
+void uart_enter_dsleep(void);
+
+/**
+ * Enable the EC console UART after a uart_enter_dsleep().
+ */
+void uart_exit_dsleep(void);
+
+#ifdef CONFIG_LOW_POWER_IDLE
+/**
+ * Interrupt handler for UART RX pin transition in deep sleep.
+ *
+ * @param signal Signal which triggered the interrupt.
+ */
+void uart_deepsleep_interrupt(enum gpio_signal signal);
+#else
+#define uart_deepsleep_interrupt NULL
+#endif
+
/*
* COMx functions
*/