21 #include <linux/module.h>
39 priv->
adapter->wakeup_tries = 0;
63 priv->
adapter->cmd_complete =
true;
68 BT_DBG(
"vendor event skipped: ogf 0x%4.4x ocf 0x%4.4x",
86 if (event->
ec != 0xff) {
87 BT_DBG(
"Not Marvell Event=%x", event->
ec);
92 switch (event->
data[0]) {
94 if (!event->
data[2]) {
100 (adapter->
psmode) ?
"Enable" :
"Disable");
102 BT_DBG(
"PS Mode command failed");
111 BT_DBG(
"HSCFG command failed");
115 if (!event->
data[1]) {
122 BT_DBG(
"HS Enable failed");
132 "Bring-up succeed" :
"Bring-up failed");
143 "Shutdown failed" :
"Shutdown succeed");
145 BT_DBG(
"BT_CMD_MODULE_CFG_REQ resp for APP");
154 (adapter->
ps_state) ?
"PS_SLEEP" :
"PS_AWAKE");
195 priv->
adapter->cmd_complete =
false;
197 BT_DBG(
"Queue module cfg Command");
205 BT_ERR(
"module_cfg_cmd(%x): timeout: %d",
209 BT_DBG(
"module cfg Command done");
238 BT_DBG(
"Queue HSCFG Command, gpio=0x%x, gap=0x%x", cmd->
data[0],
271 BT_DBG(
"Queue PSMODE Command:%d", cmd->
data[0]);
298 BT_DBG(
"Queue hs enable Command");
347 if (!skb || !skb->
data)
351 BT_ERR(
"Tx Error: Bad skb length %d : %d",
361 BT_ERR(
"Tx Error: realloc_headroom failed %d",
377 skb->
data[0] = (skb->
len & 0x0000ff);
378 skb->
data[1] = (skb->
len & 0x00ff00) >> 8;
379 skb->
data[2] = (skb->
len & 0xff0000) >> 16;
390 skb_queue_head_init(&priv->
adapter->tx_queue);
406 static int btmrvl_ioctl(
struct hci_dev *hdev,
407 unsigned int cmd,
unsigned long arg)
412 static int btmrvl_send_frame(
struct sk_buff *skb)
420 BT_ERR(
"Frame for unknown HCI device");
424 priv = hci_get_drvdata(hdev);
427 BT_ERR(
"Failed testing HCI_RUNING, flags=%lx", hdev->
flags);
454 static int btmrvl_flush(
struct hci_dev *hdev)
463 static int btmrvl_close(
struct hci_dev *hdev)
475 static int btmrvl_open(
struct hci_dev *hdev)
486 static int btmrvl_service_main_thread(
void *
data)
495 init_waitqueue_entry(&wait,
current);
505 skb_queue_empty(&adapter->
tx_queue)))) {
506 BT_DBG(
"main_thread is sleeping...");
514 BT_DBG(
"main_thread woke up");
517 BT_DBG(
"main_thread: break from main thread");
527 !skb_queue_empty(&adapter->
tx_queue)) {
544 if (btmrvl_tx_pkt(priv, skb))
563 BT_ERR(
"Can not allocate HCI device");
568 hci_set_drvdata(hdev, priv);
571 hdev->
open = btmrvl_open;
572 hdev->
close = btmrvl_close;
573 hdev->
flush = btmrvl_flush;
574 hdev->
send = btmrvl_send_frame;
575 hdev->
ioctl = btmrvl_ioctl;
583 BT_ERR(
"Can not register HCI device");
584 goto err_hci_register_dev;
587 #ifdef CONFIG_DEBUG_FS
593 err_hci_register_dev:
600 btmrvl_free_adapter(priv);
613 BT_ERR(
"Can not allocate priv");
619 BT_ERR(
"Allocate buffer for btmrvl_adapter failed!");
623 btmrvl_init_adapter(priv);
625 BT_DBG(
"Starting kthread...");
656 #ifdef CONFIG_DEBUG_FS
666 btmrvl_free_adapter(priv);