static void bluesleep_uart_awake_work(struct work_struct *work)
{
	int clk_state;

	if (!bsi->uport) {
		BT_DBG("hsuart_power called. But uport is null");
		return;
	}

	clk_state = bluesleep_get_uart_state();
	if (clk_state == MSM_HS_CLK_OFF) {
		BT_DBG("bluesleep_uart_awake_work : hsuart_power on");
		msm_hs_request_clock_on(bsi->uport);
		msm_hs_set_mctrl(bsi->uport, TIOCM_RTS);
	}else if(clk_state == MSM_HS_CLK_REQUEST_OFF){
		bluesleep_uart_work();
	}
}
Beispiel #2
0
static void hsuart_power(int on)
{
	int clk_state;

	if (test_bit(BT_SUSPEND, &flags)) {
		BT_DBG("it's suspend state. waiting for resume.");
		return;
	}

	if (!bsi->uport) {
		BT_DBG("hsuart_power called. But uport is null");
		return;
	}

	if (on && bluesleep_get_uart_clock_count() >= 1) {
		BT_DBG("hsuart_power called. But HS Uart clock count is %d", bluesleep_get_uart_clock_count());
		return;
	}

	if (on) {
		if(test_bit(BT_TXDATA, &flags)) {
			BT_DBG("hsuart_power on");
			msm_hs_request_clock_on(bsi->uport);
			msm_hs_set_mctrl(bsi->uport, TIOCM_RTS);
			return;
		}

		clk_state = bluesleep_get_uart_state();
		if(clk_state == MSM_HS_CLK_REQUEST_OFF) {
			BT_DBG("hsuart_power wait");
			bluesleep_uart_work();
		} else {
			BT_DBG("hsuart_power on");
			msm_hs_request_clock_on(bsi->uport);
			msm_hs_set_mctrl(bsi->uport, TIOCM_RTS);
		}
	} else {
		BT_DBG("hsuart_power off");
		msm_hs_set_mctrl(bsi->uport, 0);
		msm_hs_request_clock_off(bsi->uport);
	}
}