From 72b534b19a97cbf8d25fd07ca48f48c22f8fcdc6 Mon Sep 17 00:00:00 2001 From: Huibin Hong Date: Fri, 12 Aug 2016 11:19:48 +0800 Subject: [PATCH] fiq_debugger: print log by console thread Change-Id: Id664cdfe02f87b1f8bb37b9a4e3985c1eafef226 Signed-off-by: Huibin Hong --- drivers/soc/rockchip/rk_fiq_debugger.c | 4 ++-- drivers/staging/android/fiq_debugger/Kconfig | 6 ++++++ drivers/staging/android/fiq_debugger/fiq_debugger.c | 7 +++++++ drivers/staging/android/fiq_debugger/fiq_debugger.h | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/soc/rockchip/rk_fiq_debugger.c b/drivers/soc/rockchip/rk_fiq_debugger.c index 61a4ab600c63..e6f960894b89 100755 --- a/drivers/soc/rockchip/rk_fiq_debugger.c +++ b/drivers/soc/rockchip/rk_fiq_debugger.c @@ -239,9 +239,9 @@ static void console_write(struct platform_device *pdev, const char *s, unsigned } else { while (count--) { if (*s == '\n') { - kfifo_put(&fifo, &r); + kfifo_put(&fifo, r); } - kfifo_put(&fifo, s++); + kfifo_put(&fifo, *s++); } wake_up_process(t->console_task); } diff --git a/drivers/staging/android/fiq_debugger/Kconfig b/drivers/staging/android/fiq_debugger/Kconfig index 60fc224d4efc..097f53b450aa 100644 --- a/drivers/staging/android/fiq_debugger/Kconfig +++ b/drivers/staging/android/fiq_debugger/Kconfig @@ -56,3 +56,9 @@ config FIQ_WATCHDOG select FIQ_DEBUGGER select PSTORE_RAM default n + +config RK_CONSOLE_THREAD + bool "Console write by thread" + default n + help + Normal kernel printk will write out to UART by "kconsole" kthread diff --git a/drivers/staging/android/fiq_debugger/fiq_debugger.c b/drivers/staging/android/fiq_debugger/fiq_debugger.c index b132cff14f01..b1746502fe30 100644 --- a/drivers/staging/android/fiq_debugger/fiq_debugger.c +++ b/drivers/staging/android/fiq_debugger/fiq_debugger.c @@ -811,6 +811,13 @@ static void fiq_debugger_console_write(struct console *co, if (!state->console_enable && !state->syslog_dumping) return; +#ifdef CONFIG_RK_CONSOLE_THREAD + if (state->pdata->console_write) { + state->pdata->console_write(state->pdev, s, count); + return; + } +#endif + fiq_debugger_uart_enable(state); spin_lock_irqsave(&state->console_lock, flags); while (count--) { diff --git a/drivers/staging/android/fiq_debugger/fiq_debugger.h b/drivers/staging/android/fiq_debugger/fiq_debugger.h index c9ec4f8db086..caf75155110f 100644 --- a/drivers/staging/android/fiq_debugger/fiq_debugger.h +++ b/drivers/staging/android/fiq_debugger/fiq_debugger.h @@ -59,6 +59,11 @@ struct fiq_debugger_pdata { void (*force_irq)(struct platform_device *pdev, unsigned int irq); void (*force_irq_ack)(struct platform_device *pdev, unsigned int irq); + +#ifdef CONFIG_RK_CONSOLE_THREAD + void (*console_write)(struct platform_device *pdev, const char *s, + unsigned int count); +#endif }; #endif -- 2.34.1