[ARM] tegra: stingray: Add callback to indicate rx is done.
authorJaikumar Ganesh <jaikumar@google.com>
Wed, 8 Dec 2010 01:00:04 +0000 (17:00 -0800)
committerJaikumar Ganesh <jaikumar@google.com>
Wed, 8 Dec 2010 20:04:16 +0000 (12:04 -0800)
Change-Id: I2052e6bdd8d29371a63445695dc56aef505f000d
Signed-off-by: Jaikumar Ganesh <jaikumar@google.com>
arch/arm/mach-tegra/include/mach/tegra_hsuart.h
drivers/serial/tegra_hsuart.c

index ae459aa4917e0b8a87ec8f9ec945c7004eb3cae0..4e07d50d103fd125ac22b618f7722fa5a7a1b56f 100644 (file)
@@ -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
index 6f2913d91cfe63a172ee5d86e29562692abbbea1..b0d1b8de8712ebaa37037014a313c8495de9c5b0 100644 (file)
@@ -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) {