diff options
| author | mattis fjallstrom <mattis@acm.org> | 2015-08-11 19:29:20 -0700 |
|---|---|---|
| committer | mattis fjallstrom <mattis@acm.org> | 2015-08-11 19:29:20 -0700 |
| commit | 9ccd6e0d99208ca9a7bb514cc956b1de6800940b (patch) | |
| tree | 3e5550dd0998fafb61e1d871a8da4df987f04f5a /arch/arm/mach-omap2/board-omap3h1-bluetooth.c | |
| parent | b66fe63ea9d50a1049d9142559121d16f86db9eb (diff) | |
| download | olio-linux-3.10-9ccd6e0d99208ca9a7bb514cc956b1de6800940b.tar.xz olio-linux-3.10-9ccd6e0d99208ca9a7bb514cc956b1de6800940b.zip | |
Bluetooth working in sleep mode.
Change-Id: I20e42e204dbf73c5f8468fc7733fa29c6ea1c2f2
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3h1-bluetooth.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1-bluetooth.c | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c index a56ae4e4bd5..2d502bab5a6 100644 --- a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c +++ b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c @@ -41,6 +41,10 @@ #include "board-omap3h1.h" #include <linux/regulator/driver.h> +#include "asm/io.h" +#include "mux.h" +#include "iomap.h" + static void set_host_wake_locked(int); #define BT_RESET_GPIO 179 @@ -48,6 +52,7 @@ static void set_host_wake_locked(int); #define BT_WAKE_GPIO 93 #define BT_HOST_WAKE_GPIO 11 #define UART_PORT 0 /* UART 1 = 0 */ +#define BT_RST_PIN 149 #define olio_debug(format, ...) printk ("OLIO %s: ", __FUNCTION__); printk (format, ##__VA_ARGS__) @@ -79,12 +84,49 @@ static struct bcm_bt_lpm { char bcm_wake_lock_name[100]; } bt_lpm; +static int wake_mode_calls = 0; + +/*************************************************************************** + * rts_enter_sleep_mode - set RTS pin to off mode + * + * The RTS pin needs to be kept high while sleeping. + */ + +void rts_enter_sleep_mode() +{ + if (wake_mode_calls == 0) + __raw_writew ((u16) ( 1 << 8 | 1 << 4 | 1 << 3 | 4 ), + (volatile void *) OMAP2_L4_IO_ADDRESS(OMAP3_CONTROL_PADCONF_MUX_PBASE) + + OMAP3_CONTROL_PADCONF_UART1_RTS_OFFSET); + + /* Now this is a GPIO pin. Send to sleep. */ + + return; +} + +/*************************************************************************** + * rts_exit_sleep_mode - set RTS pin to on mode + * + * The RTS pin needs to be kept high while sleeping, otherwise let the + * driver decide. + */ + +void rts_exit_sleep_mode() +{ + if (wake_mode_calls == 0) + __raw_writew ((u16) ( 0x0 ), + (volatile void *) OMAP2_L4_IO_ADDRESS(OMAP3_CONTROL_PADCONF_MUX_PBASE) + + OMAP3_CONTROL_PADCONF_UART1_RTS_OFFSET); + + return; +} + static int bcm20702_bt_rfkill_set_power(void *data, bool blocked) { // rfkill_ops callback. Turn transmitter on when blocked is false if (!blocked) { if (clk32ksys_reg && !bt_enabled) - regulator_enable(clk32ksys_reg); + (void) regulator_enable(clk32ksys_reg); gpio_set_value(BT_RESET_GPIO, 1); gpio_set_value(BT_REG_GPIO, 1); @@ -123,10 +165,6 @@ static void set_wake_locked(int wake) olio_debug ("Now locking wake lock\n"); wake_lock (&bt_lpm.bcm_wake_lock); - /* Does this even make sense here? We've already using the port, - doesn't that mean that we're */ - - if (!wake_uart_enabled) omap_serial_ext_uart_enable(UART_PORT); } @@ -190,11 +228,13 @@ static void set_host_wake_locked(int host_wake) if (host_wake) { olio_debug ("host_wake is set, taking wake lock\n"); wake_lock(&bt_lpm.host_wake_lock); - + if (!host_wake_uart_enabled) { omap_serial_ext_uart_enable(UART_PORT); - } + } + } else { + if (host_wake_uart_enabled) { omap_serial_ext_uart_disable(UART_PORT); } @@ -400,35 +440,6 @@ static int bcm20702_bluetooth_remove(struct platform_device *pdev) return 0; } -int bcm4430_bluetooth_suspend(struct platform_device *pdev, pm_message_t state) -{ - int irq = gpio_to_irq(BT_HOST_WAKE_GPIO); - int host_wake; - - disable_irq(irq); - - host_wake = gpio_get_value(BT_HOST_WAKE_GPIO); - - if (host_wake) { - enable_irq(irq); - return -EBUSY; - } - - return 0; -} - -int bcm4430_bluetooth_resume(struct platform_device *pdev) -{ - int irq = gpio_to_irq(BT_HOST_WAKE_GPIO); - enable_irq(irq); - return 0; -} - -/* - .suspend = bcm4430_bluetooth_suspend, - .resume = bcm4430_bluetooth_resume, -*/ - static struct platform_driver bcm20702_bluetooth_platform_driver = { .probe = bcm20702_bluetooth_probe, .remove = bcm20702_bluetooth_remove, |