int bcm2076_bluetooth_suspend(struct platform_device *pdev, pm_message_t state) { #if BT_HOST_WAKE_INT_ENABLED 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; } //Mux RTS pin into GPIO PULL UP pin (this flows off the 2076) pr_debug("** suspend ** changing RTS pin to GPIO pulled up\n"); omap_rts_mux_write(MUX_PULL_UP, UART2); #else pr_debug( "%s: BT_HOST_WAKE disabled\n",__FUNCTION__); #endif //BT_HOST_WAKE_INT_ENABLED if( idme_query_board_type( IDME_BOARD_TYPE_TATE_EVT2 ) ) omap_serial_ext_uart_disable(UART2); return 0; }
/* Call the uart disable of serial driver */ static int plat_bt_uart_disable(void) { int port_id = 0; int err = 0; if (uart_req) { sscanf(BT_UART_DEV_NAME, "/dev/ttyO%d", &port_id); err = omap_serial_ext_uart_disable(port_id); if (!err) uart_req = false; } return err; }
/* Call the uart disable of serial driver */ static int plat_uart_disable(void) { int port_id = 0; int err = 0; if (uart_req) { sscanf(WILINK_UART_DEV_NAME, "/dev/ttyO%d", &port_id); err = omap_serial_ext_uart_disable(port_id); if (!err) uart_req = false; } wake_unlock(&st_wk_lock); return err; }
static void update_host_wake_locked(int host_wake) { pr_debug( "%s TOP, host_wake=%d\n",__FUNCTION__,host_wake); if (host_wake == bt_lpm.host_wake) { pr_debug( "%s (host_wake==bt_lpm.host_wake), returning early\n",__FUNCTION__); return; } bt_lpm.host_wake = host_wake; if (host_wake) { wake_lock(&bt_lpm.wake_lock); if (!host_wake_uart_enabled) { omap_serial_ext_uart_enable(UART2); pr_debug( "%s !host_wake_uart_enabled, called omap_serial_ext_uart_enable\n",__FUNCTION__); //Mux back GPIO PULL UP pin in RTS pin pr_debug("** update_host_wake_locked ** changing RTS pin from GPIO back to RTS\n"); omap_rts_mux_write(0, UART2); } } else { if (host_wake_uart_enabled) { //Mux RTS pin into GPIO PULL UP pin (this flows off the 2076) pr_debug("** update_host_wake_locked ** changing RTS pin to GPIO pulled up\n"); omap_rts_mux_write(MUX_PULL_UP, UART2); omap_serial_ext_uart_disable(UART2); pr_debug( "%s host_wake_uart_enabled, called omap_serial_ext_uart_disable\n",__FUNCTION__); } // Take a timed wakelock, so that upper layers can take it. // The chipset deasserts the hostwake lock, when there is no // more data to send. wake_lock_timeout(&bt_lpm.wake_lock, HZ/2); } host_wake_uart_enabled = host_wake; pr_debug( "%s host_wake_uart_enabled = host_wake = %d\n",__FUNCTION__,host_wake); }
static void set_wake_locked(int wake) { //pr_debug( "bbbluetooth.c:%s wake=%d TOP\n",__FUNCTION__,wake); bt_lpm.wake = wake; if (!wake) wake_unlock(&bt_lpm.wake_lock); if (!wake_uart_enabled && wake) { pr_debug( "%s !wake_uart_enabled && wake, calling omap_serial_ext_uart_enable\n",__FUNCTION__); omap_serial_ext_uart_enable(UART2); //Mux back GPIO PULL UP pin in RTS pin pr_debug("** set_wake_locked ** changing RTS pin from GPIO back to RTS\n"); omap_rts_mux_write(0, UART2); } // DOWN_STREAM_BT_WAKE_AND_UART_CONTROL_FIX ++ // Control BT_WAKE assertion/de-assertion in down-stream path only #if 0 pr_debug( "bbbluetooth.c:%s setting BT_WAKE(%s)\n",__FUNCTION__,wake ? "high":"low"); gpio_set_value(BT_WAKE_GPIO, wake); #endif // DOWN_STREAM_BT_WAKE_AND_UART_CONTROL_FIX -- if (wake_uart_enabled && !wake) { //Mux RTS pin into GPIO PULL UP pin (this flows off the 2076) pr_debug("** set_wake_locked ** changing RTS pin to GPIO pulled up\n"); omap_rts_mux_write(MUX_PULL_UP, UART2); pr_debug( "%s wake_uart_enabled && !wake, calling omap_serial_ext_uart_disable\n",__FUNCTION__); omap_serial_ext_uart_disable(UART2); } wake_uart_enabled = wake; //pr_debug( "bbbluetooth.c:%s wake_uart_enabled=%d END\n",__FUNCTION__,wake_uart_enabled); }