From 0cff1ca8038dc2ab682033f4f190e7edece5762e Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Tue, 7 Dec 2010 17:00:04 -0800 Subject: [PATCH] [ARM] tegra: stingray: Add callback to indicate rx is done. Change-Id: I2052e6bdd8d29371a63445695dc56aef505f000d Signed-off-by: Jaikumar Ganesh --- arch/arm/mach-tegra/include/mach/tegra_hsuart.h | 1 + drivers/serial/tegra_hsuart.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-tegra/include/mach/tegra_hsuart.h b/arch/arm/mach-tegra/include/mach/tegra_hsuart.h index ae459aa4917e..4e07d50d103f 100644 --- a/arch/arm/mach-tegra/include/mach/tegra_hsuart.h +++ b/arch/arm/mach-tegra/include/mach/tegra_hsuart.h @@ -18,6 +18,7 @@ /* Optional platform device data for tegra_hsuart driver. */ struct tegra_hsuart_platform_data { void (*exit_lpm_cb)(struct uart_port *); + void (*rx_done_cb)(struct uart_port *); }; #endif diff --git a/drivers/serial/tegra_hsuart.c b/drivers/serial/tegra_hsuart.c index 6f2913d91cfe..b0d1b8de8712 100644 --- a/drivers/serial/tegra_hsuart.c +++ b/drivers/serial/tegra_hsuart.c @@ -122,6 +122,8 @@ struct tegra_uart_port { /* optional callback to exit low power mode */ void (*exit_lpm_cb)(struct uart_port *); + /* optional callback to indicate rx is done */ + void (*rx_done_cb)(struct uart_port *); }; @@ -309,6 +311,9 @@ static void tegra_rx_dma_complete_callback(struct tegra_dma_req *req) spin_unlock(&u->lock); tty_flip_buffer_push(u->state->port.tty); + + if (t->rx_done_cb) + t->rx_done_cb(u); spin_lock(&u->lock); } @@ -320,6 +325,8 @@ static void do_handle_rx_dma(struct tegra_uart_port *t) set_rts(t, false); tegra_dma_dequeue(t->rx_dma); tty_flip_buffer_push(u->state->port.tty); + if (t->rx_done_cb) + t->rx_done_cb(u); /* enqueue the request again */ tegra_start_dma_rx(t); if (t->rts_active) @@ -525,6 +532,8 @@ static irqreturn_t tegra_uart_isr(int irq, void *data) spin_unlock_irqrestore(&u->lock, flags); tty_flip_buffer_push(u->state->port.tty); + if (t->rx_done_cb) + t->rx_done_cb(u); spin_lock_irqsave(&u->lock, flags); } break; @@ -559,6 +568,8 @@ static void tegra_stop_rx(struct uart_port *u) if (t->use_rx_dma && t->rx_dma) { tegra_dma_dequeue(t->rx_dma); tty_flip_buffer_push(u->state->port.tty); + if (t->rx_done_cb) + t->rx_done_cb(u); } return; @@ -1267,8 +1278,10 @@ static int tegra_uart_probe(struct platform_device *pdev) u->regshift = 2; - if (pdata) + if (pdata) { t->exit_lpm_cb = pdata->exit_lpm_cb; + t->rx_done_cb = pdata->rx_done_cb; + } t->clk = clk_get(&pdev->dev, NULL); if (!t->clk) { -- 2.34.1