Recently, I find a special bug on pandaboard debug serial. The system runs on kernel 3.0.21-00003, Android 4.0;
I find the debug messages from kernel is normal, however the debug messages from anroid apps or linux system commands show slowly too much;
First, if don't plug in HDMI, the debug serial out/in put messages(output from apps, input from user) would become slow. Likely I enter 'ps afx' command,
the messages output from 'ps' command are very slow. However if plugs in HDMI, they become normal.
Second, if don't plug in HDMI, the message from android apps or linux system commands would show normal when some messages output from kernel at the sametime.
Now, I find that the HDMI driver(drivers/video/omap2/dss/hdmi.c) will call FUNC hdmi_set_l3_cstr to setup PM_QOS_CPU_DMA_LATENCY on value 100 when plug in HDMI. When pull out HDMI, the driver will call FUNC hdmi_set_l3_cstr to remove PM_QOS_CPU_DMA_LATENCY. Its look like the PM_QOS(kernel/pm_qos_params.c) interference the debug serial.
Here is the code on Hdmi.c :
--------------------------------------------------
/* Set / Release c-state constraints */
static void hdmi_set_l3_cstr(struct omap_dss_device *dssdev, bool enable)
{
#ifdef CONFIG_OMAP_PM
DSSINFO("%s c-state constraint for HDMI\n\n",
enable ? "Set" : "Release");
if (enable)
pm_qos_add_request(&pm_qos_handle, PM_QOS_CPU_DMA_LATENCY, 100);
else
pm_qos_remove_request(&pm_qos_handle);
#else
DSSINFO("C-STATE Constraints require COMFIG_OMAP_PM to be set\n");
#endif
}
--------------------------------------------------
So, I want enabl DMA for the serials(arch/arm/mach-omap2/serial.c). Test one, set ture omap_serial_default_info.use_dma = 1; Test two, setup PM_QOS_CPU_DMA_LATENCY on FUNC omap_serial_board_init. When the system run out, the debug serial showout the messages from apps or commands are normal. However if I input too much message too fast, the debug serial will output a lot of unreadable messages.
Here is the test code.
--------------------------------------------------
####Test one, use dma
static struct omap_uart_port_info omap_serial_default_info[] = {
{
###############Default value is 0, chang to use dma.###############
.use_dma = 1,
.dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
.dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
.dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
.auto_sus_timeout = DEFAULT_AUTOSUSPEND_DELAY,
.wer = (OMAP_UART_WER_RLSI | \
OMAP_UART_WER_RHRI | OMAP_UART_WER_RX | \
OMAP_UART_WER_DCDCD | OMAP_UART_WER_RI | \
OMAP_UART_WER_DSR | OMAP_UART_WER_CTS),
},
};
--------------------------------------------------
--------------------------------------------------
####Test two, setup PM_QOS_CPU_DMA_LATENCY like HDMI driver.
#ifdef CONFIG_OMAP_PM
#include <linux/pm_qos_params.h>
static struct pm_qos_request_list uart_qos_handle;
#endif
void __init omap_serial_board_init(struct omap_uart_port_info *platform_data)
{
struct omap_board_data bdata;
u8 i;
for (i = 0; i < OMAP_MAX_HSUART_PORTS; i++) {
bdata.id = i;
bdata.flags = 0;
bdata.pads = NULL;
bdata.pads_cnt = 0;
if (cpu_is_omap44xx() || cpu_is_omap34xx())
omap_serial_fill_default_pads(&bdata);
if (platform_data == NULL)
omap_serial_init_port(&bdata, NULL);
else
omap_serial_init_port(&bdata, &platform_data[i]);
}
###############Test 2, setup PM_QOS_CPU_DMA_LATENCY###############
pm_qos_add_request(&uart_qos_handle, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
}
--------------------------------------------------
Looking for Helping !
Thx!