summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Wilson <evan@oliodevices.com>2015-06-16 11:25:45 -0700
committerEvan Wilson <evan@oliodevices.com>2015-06-16 11:25:45 -0700
commit6921a058152ba3ff952383467804b943f457897e (patch)
tree6388edbf8c1579ecbc84c82fd7e88ad468893031
parent12362900834a491c5cda716dd064cc816fd2082d (diff)
downloadolio-linux-3.10-6921a058152ba3ff952383467804b943f457897e.tar.xz
olio-linux-3.10-6921a058152ba3ff952383467804b943f457897e.zip
BT LPM working
Change-Id: I15947ef87d69d7eb9343afa34ed254a34ba3991d
-rw-r--r--arch/arm/mach-omap2/board-omap3h1-bluetooth.c14
-rw-r--r--arch/arm/mach-omap2/board-omap3h1.c2
-rw-r--r--arch/arm/mach-omap2/serial.c1
-rw-r--r--drivers/tty/serial/omap-serial.c41
-rw-r--r--include/linux/platform_data/serial-omap.h4
5 files changed, 56 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c
index 68b3d80d290..6c4a13ec093 100644
--- a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c
+++ b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c
@@ -36,6 +36,7 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <asm/mach-types.h>
+#include <linux/platform_data/serial-omap.h>
#include "serial.h"
#include "board-omap3h1.h"
#include <linux/regulator/driver.h>
@@ -46,6 +47,7 @@ static void update_host_wake_locked(int);
#define BT_REG_GPIO 180
#define BT_WAKE_GPIO 93
#define BT_HOST_WAKE_GPIO 11
+#define UART_PORT 1
static struct rfkill *bt_rfkill;
static struct regulator *clk32ksys_reg;
@@ -103,13 +105,13 @@ static void set_wake_locked(int wake)
if (!wake)
wake_unlock(&bt_lpm.wake_lock);
- //if (!wake_uart_enabled && wake)
- //omap_uart_enable(2);
+ if (!wake_uart_enabled && wake)
+ omap_serial_ext_uart_enable(UART_PORT);
gpio_set_value(BT_WAKE_GPIO, wake);
- //if (wake_uart_enabled && !wake)
- //omap_uart_disable(2);
+ if (wake_uart_enabled && !wake)
+ omap_serial_ext_uart_disable(UART_PORT);
wake_uart_enabled = wake;
}
@@ -145,11 +147,11 @@ static void update_host_wake_locked(int host_wake)
if (host_wake) {
wake_lock(&bt_lpm.wake_lock);
if (!host_wake_uart_enabled) {
- //omap_uart_enable(2);
+ omap_serial_ext_uart_enable(UART_PORT);
}
} else {
if (host_wake_uart_enabled) {
- //omap_uart_disable(2);
+ omap_serial_ext_uart_disable(UART_PORT);
}
// Take a timed wakelock, so that upper layers can take it.
// The chipset deasserts the hostwake lock, when there is no
diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c
index ff621b2a86c..25999b224cc 100644
--- a/arch/arm/mach-omap2/board-omap3h1.c
+++ b/arch/arm/mach-omap2/board-omap3h1.c
@@ -1010,6 +1010,8 @@ static struct omap_uart_port_info omap_uart_ports[] = {
.dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
.dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
.autosuspend_timeout = 1000,
+ .wakelock_timeout = 150,
+ .wake_peer = bcm_bt_lpm_exit_lpm_locked,
.wakeup_capable = true,
},
{
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index b570d93cbb7..b1f3fb1d396 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -301,6 +301,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
omap_up.dma_rx_timeout = info->dma_rx_timeout;
omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate;
omap_up.autosuspend_timeout = info->autosuspend_timeout;
+ omap_up.wake_peer = info->wake_peer;
omap_up.DTR_gpio = info->DTR_gpio;
omap_up.DTR_inverted = info->DTR_inverted;
omap_up.DTR_present = info->DTR_present;
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 3009a8909cc..9b19ae172c3 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1109,7 +1109,14 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);
}
+static void serial_omap_wake_peer(struct uart_port *port)
+{
+ struct uart_omap_port *up = to_uart_omap_port(port);
+ struct omap_uart_port_info *pdata = up->dev->platform_data;
+ if (pdata->wake_peer)
+ pdata->wake_peer(port);
+}
static void serial_omap_release_port(struct uart_port *port)
{
dev_dbg(port->dev, "serial_omap_release_port+\n");
@@ -1341,6 +1348,7 @@ static struct uart_ops serial_omap_pops = {
.shutdown = serial_omap_shutdown,
.set_termios = serial_omap_set_termios,
.pm = serial_omap_pm,
+ .wake_peer = serial_omap_wake_peer,
.type = serial_omap_type,
.release_port = serial_omap_release_port,
.request_port = serial_omap_request_port,
@@ -1860,6 +1868,39 @@ static void __exit serial_omap_exit(void)
uart_unregister_driver(&serial_omap_reg);
}
+/* Used by ext client device connected to uart to control uart */
+int omap_serial_ext_uart_enable(u8 port_id)
+{
+ struct uart_omap_port *up;
+ int err = 0;
+
+ if (port_id > OMAP_MAX_HSUART_PORTS) {
+ pr_err("Invalid Port_id %d passed to %s\n", port_id, __func__);
+ err = -ENODEV;
+ } else {
+ up = ui[port_id];
+ pm_runtime_get_sync(up->dev);
+ }
+ return err;
+}
+
+int omap_serial_ext_uart_disable(u8 port_id)
+{
+ struct uart_omap_port *up;
+ int err = 0;
+
+ if (port_id > OMAP_MAX_HSUART_PORTS) {
+ pr_err("Invalid Port_id %d passed to %s\n", port_id, __func__);
+ err = -ENODEV;
+ } else {
+ up = ui[port_id];
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
+ }
+ return err;
+}
+
+
module_init(serial_omap_init);
module_exit(serial_omap_exit);
diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h
index afba9011b52..9990f7cd03c 100644
--- a/include/linux/platform_data/serial-omap.h
+++ b/include/linux/platform_data/serial-omap.h
@@ -48,10 +48,14 @@ struct omap_uart_port_info {
int (*get_context_loss_count)(struct device *);
void (*enable_wakeup)(struct device *, bool);
+ void (*wake_peer)(struct uart_port *);
};
extern void omap_uart_remove_wakeup(struct device *dev);
extern void omap_uart_enable_wakeup(struct device *dev, bool enable);
extern int omap_pm_get_dev_context_loss_count(struct device *dev);
+extern int omap_serial_ext_uart_enable(u8 port_id);
+extern int omap_serial_ext_uart_disable(u8 port_id);
+
#endif /* __OMAP_SERIAL_H__ */