From b5ceb944e647082c5515f92b79465661a11aac51 Mon Sep 17 00:00:00 2001 From: Fugang Duan Date: Wed, 17 Apr 2019 20:44:44 +0800 Subject: [PATCH] MLK-21491 serial: imx: add pm_qos to interact with cpu idle Add pm_qos to prevent cpuidle from entering low level idles for uart DMA mode when the uart port is active. Reviewed-by: Richard Zhu Signed-off-by: Fugang Duan --- drivers/tty/serial/imx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 7bdda136267e..2e18d0fabdf3 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -229,6 +230,8 @@ struct imx_port { unsigned int dma_tx_nents; unsigned int saved_reg[10]; bool context_saved; + + struct pm_qos_request pm_qos_req; }; struct imx_port_ucrs { @@ -1233,6 +1236,7 @@ static void imx_uart_dma_exit(struct imx_port *sport) sport->dma_chan_tx = NULL; } + pm_qos_remove_request(&sport->pm_qos_req); release_bus_freq(BUS_FREQ_HIGH); } @@ -1242,6 +1246,10 @@ static int imx_uart_dma_init(struct imx_port *sport) struct device *dev = sport->port.dev; int ret; + /* request high bus for DMA mode */ + request_bus_freq(BUS_FREQ_HIGH); + pm_qos_add_request(&sport->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 0); + /* Prepare for RX : */ sport->dma_chan_rx = dma_request_slave_channel(dev, "rx"); if (!sport->dma_chan_rx) { @@ -1286,8 +1294,6 @@ static int imx_uart_dma_init(struct imx_port *sport) goto err; } - request_bus_freq(BUS_FREQ_HIGH); - return 0; err: imx_uart_dma_exit(sport); -- 2.17.1