[ARM] tegra: stingray: Add optional low power mode callbacks.
authorJaikumar Ganesh <jaikumar@google.com>
Mon, 6 Dec 2010 21:52:44 +0000 (13:52 -0800)
committerJaikumar Ganesh <jaikumar@google.com>
Tue, 7 Dec 2010 00:56:42 +0000 (16:56 -0800)
Change-Id: Ia9821142252f6df8d81ec6356c6b2126f5d8d508
Signed-off-by: Jaikumar Ganesh <jaikumar@google.com>
arch/arm/mach-tegra/include/mach/tegra_hsuart.h [new file with mode: 0644]
drivers/serial/tegra_hsuart.c

diff --git a/arch/arm/mach-tegra/include/mach/tegra_hsuart.h b/arch/arm/mach-tegra/include/mach/tegra_hsuart.h
new file mode 100644 (file)
index 0000000..ae459aa
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ * Author: Jaikumar Ganesh <jaikumar@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_TEGRA_HSUART_H
+#define __ASM_ARCH_TEGRA_HSUART_H
+
+/* Optional platform device data for tegra_hsuart driver. */
+struct tegra_hsuart_platform_data {
+       void (*exit_lpm_cb)(struct uart_port *);
+};
+
+#endif
index 09f5f454683cb3e5ac5525a5521872164486babe..6f2913d91cfe63a172ee5d86e29562692abbbea1 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/workqueue.h>
 #include <mach/dma.h>
 #include <mach/clk.h>
+#include <mach/tegra_hsuart.h>
 
 #define TX_EMPTY_STATUS (UART_LSR_TEMT | UART_LSR_THRE)
 
@@ -118,6 +119,10 @@ struct tegra_uart_port {
 
        bool                    rx_timeout;
        int                     rx_in_progress;
+
+       /* optional callback to exit low power mode */
+       void (*exit_lpm_cb)(struct uart_port *);
+
 };
 
 static inline u8 uart_readb(struct tegra_uart_port *t, unsigned long reg)
@@ -238,6 +243,9 @@ static void tegra_start_tx(struct uart_port *u)
        t = container_of(u, struct tegra_uart_port, uport);
        xmit = &u->state->xmit;
 
+       if (t->exit_lpm_cb)
+               t->exit_lpm_cb(u);
+
        if (!uart_circ_empty(xmit) && !t->tx_in_progress)
                tegra_start_next_tx(t);
 }
@@ -1223,6 +1231,7 @@ static int tegra_uart_probe(struct platform_device *pdev)
        struct tegra_uart_port *t;
        struct uart_port *u;
        struct resource *resource;
+       struct tegra_hsuart_platform_data *pdata = pdev->dev.platform_data;
        int ret;
        char name[64];
        if (pdev->id < 0 || pdev->id > tegra_uart_driver.nr) {
@@ -1258,6 +1267,9 @@ static int tegra_uart_probe(struct platform_device *pdev)
 
        u->regshift = 2;
 
+       if (pdata)
+               t->exit_lpm_cb = pdata->exit_lpm_cb;
+
        t->clk = clk_get(&pdev->dev, NULL);
        if (!t->clk) {
                dev_err(&pdev->dev, "Couldn't get the clock\n");