tty: serial: imx: add busfreq and pm qos support for DMA mode
Add busfreq and pm qos support for DMA mode. DMA mode cannot work stablely at low busfreq mode, so request high busfreq once DMA is enabled. Signed-off-by: Fugang Duan <fugang.duan@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
9fc55e60c4
commit
926ebffe56
|
@ -33,6 +33,8 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
#include <linux/busfreq-imx.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/platform_data/serial-imx.h>
|
||||
#include <linux/platform_data/dma-imx.h>
|
||||
|
||||
|
@ -227,6 +229,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 {
|
||||
|
@ -1223,6 +1227,9 @@ static void imx_uart_dma_exit(struct imx_port *sport)
|
|||
dma_release_channel(sport->dma_chan_tx);
|
||||
sport->dma_chan_tx = NULL;
|
||||
}
|
||||
|
||||
pm_qos_remove_request(&sport->pm_qos_req);
|
||||
release_bus_freq(BUS_FREQ_HIGH);
|
||||
}
|
||||
|
||||
static int imx_uart_dma_init(struct imx_port *sport)
|
||||
|
@ -1231,6 +1238,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) {
|
||||
|
|
Loading…
Reference in New Issue