static int bluesleep_write_proc_lpm(struct file *file, const char __user * buffer, size_t count, loff_t * ppos) { char b; if (count < 1) return -EINVAL; if (copy_from_user(&b, buffer, 1)) return -EFAULT; if (b == '0') { /* HCI_DEV_UNREG */ bluesleep_stop(); has_lpm_enabled = false; bsi->uport = NULL; } else { /* HCI_DEV_REG */ if (!has_lpm_enabled) { has_lpm_enabled = true; bsi->uport = msm_hs_get_uart_port(BT_PORT_ID); /* if bluetooth started, start bluesleep */ bluesleep_start(); } } return count; }
struct uart_port *bluesleep_get_uart_port(void) { struct uart_port *uport = NULL; uport = msm_hs_get_uart_port(0); if(uport == NULL) BT_ERR("(bluesleep_get_uart_port) uport is null"); return uport; }
static int ath_lpm_start(void) { BT_DBG("Start LPM mode"); if (!bsi) { BT_ERR("HCIATH3K bluesleep info does not exist"); return -EIO; } bsi->uport = msm_hs_get_uart_port(0); if (!bsi->uport) { BT_ERR("UART Port is not available"); return -ENODEV; } INIT_WORK(&ws_sleep, wakeup_host_work); if (ath_bluesleep_gpio_config(1) < 0) { BT_ERR("HCIATH3K GPIO Config failed"); return -EIO; } return 0; }