Exemplo n.º 1
0
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
	BT_DBG("hdev %p", hdev);


	/* When in kernel 4.4.0 and greater, the HCI_RUNNING bit is
	 * cleared in hci_dev_do_close(). */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
		return 0;
#else
	if (test_bit(HCI_RUNNING, &hdev->flags)) {
		BT_ERR("HCI_RUNNING is not cleared before.");
		return -1;
	}
#endif

	hci_uart_flush(hdev);
	hdev->flush = NULL;

#ifdef BTCOEX
	rtk_btcoex_close();
#endif

	return 0;
}
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
	BT_DBG("hdev %p", hdev);

	hci_uart_flush(hdev);
	hdev->flush = NULL;
	return 0;
}
Exemplo n.º 3
0
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
	BT_DBG("hdev %p", hdev);

	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
		return 0;

	hci_uart_flush(hdev);
	return 0;
}
Exemplo n.º 4
0
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
	BT_DBG("hdev %p", hdev);

	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
		return 0;

#if defined(CONFIG_MT5931_MT6622)
	mt_bt_disable_irq();
#endif
	hci_uart_flush(hdev);
	hdev->flush = NULL;
	return 0;
}
Exemplo n.º 5
0
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
	BT_DBG("hdev %p", hdev);

	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
		return 0;

	hci_uart_flush(hdev);
	hdev->flush = NULL;

#ifdef BTCOEX
	rtk_uart_coex_close();
#endif

	return 0;
}
Exemplo n.º 6
0
/* Close device */
static int hci_uart_close(struct hci_dev *hdev)
{
    BT_DBG("hdev %p", hdev);

    if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
        return 0;

#ifdef CONFIG_TROUT_UART_TRANSPORT_DEBUG
    if(NULL != &timer_retransmit)
    {
        del_timer(&timer_retransmit);
    }
#endif

    hci_uart_flush(hdev);
    hdev->flush = NULL;
    return 0;
}
Exemplo n.º 7
0
static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file,
					const unsigned char *data, size_t count)
{
    struct hci_uart *hu = (void *) tty->disc_data;
    struct hci_dev *hdev = hu->hdev;
    int ret;

    BT_DBG("%s: hu = 0x%p, hci_dev = 0x%p", __func__, hu, hdev);

    ret = hci_uart_tty_access_allowed();
    if (ret < 0)
		return ret;

    if (!hdev)
		return -ENODEV;

    if (!hook)
		hook = kzalloc(sizeof(*hook), GFP_KERNEL);
    else {
		/* Cuase brcm_poke_helper's read/write is serialized,
		* it's almost safe to init hook data here
		*/
		BT_INFO("hook data still remains");
		memset(hook, 0, sizeof(*hook));
    }

    if (!hook)
		return -ENOMEM;

    hook->head = hook->data;

    hci_uart_flush(hdev);

#if 1
    if (hdev->wake_peer)
		hdev->wake_peer(hdev);
#endif

    ret = tty->ops->write(tty, data, count);

    BT_DBG("%s: ret = %d", __func__, ret);

	return ret;
}