From: Jaikumar Ganesh Date: Mon, 6 Dec 2010 21:52:44 +0000 (-0800) Subject: [ARM] tegra: stingray: Add optional low power mode callbacks. X-Git-Tag: firefly_0821_release~9834^2~275 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5556e08c6e09928c26d2230f7738104ec27a0ff5;p=firefly-linux-kernel-4.4.55.git [ARM] tegra: stingray: Add optional low power mode callbacks. Change-Id: Ia9821142252f6df8d81ec6356c6b2126f5d8d508 Signed-off-by: Jaikumar Ganesh --- 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 index 000000000000..ae459aa4917e --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/tegra_hsuart.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2010 Google, Inc. + * Author: Jaikumar Ganesh + * + * 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 diff --git a/drivers/serial/tegra_hsuart.c b/drivers/serial/tegra_hsuart.c index 09f5f454683c..6f2913d91cfe 100644 --- a/drivers/serial/tegra_hsuart.c +++ b/drivers/serial/tegra_hsuart.c @@ -43,6 +43,7 @@ #include #include #include +#include #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");