Blame view
drivers/bluetooth/btmrvl_drv.h
3.74 KB
132ff4e5f Bluetooth: Add bt... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/* * Marvell Bluetooth driver: global definitions & declarations * * Copyright (C) 2009, Marvell International Ltd. * * This software file (the "File") is distributed by Marvell International * Ltd. under the terms of the GNU General Public License Version 2, June 1991 * (the "License"). You may use, redistribute and/or modify this File in * accordance with the terms and conditions of the License, a copy of which * is available by writing to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. * * * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE * ARE EXPRESSLY DISCLAIMED. The License provides additional details about * this warranty disclaimer. * */ |
132ff4e5f Bluetooth: Add bt... |
21 22 |
#include <linux/kthread.h> #include <linux/bitops.h> |
5a0e3ad6a include cleanup: ... |
23 |
#include <linux/slab.h> |
132ff4e5f Bluetooth: Add bt... |
24 25 26 |
#include <net/bluetooth/bluetooth.h> #define BTM_HEADER_LEN 4 |
132ff4e5f Bluetooth: Add bt... |
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#define BTM_UPLD_SIZE 2312 /* Time to wait until Host Sleep state change in millisecond */ #define WAIT_UNTIL_HS_STATE_CHANGED 5000 /* Time to wait for command response in millisecond */ #define WAIT_UNTIL_CMD_RESP 5000 struct btmrvl_thread { struct task_struct *task; wait_queue_head_t wait_q; void *priv; }; struct btmrvl_device { |
132ff4e5f Bluetooth: Add bt... |
41 42 |
void *card; struct hci_dev *hcidev; |
f120c6b63 Bluetooth: Set hd... |
43 |
u8 dev_type; |
132ff4e5f Bluetooth: Add bt... |
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
u8 tx_dnld_rdy; u8 psmode; u8 pscmd; u8 hsmode; u8 hscmd; /* Low byte is gap, high byte is GPIO */ u16 gpio_gap; u8 hscfgcmd; u8 sendcmdflag; }; struct btmrvl_adapter { u32 int_count; struct sk_buff_head tx_queue; u8 psmode; u8 ps_state; u8 hs_state; u8 wakeup_tries; wait_queue_head_t cmd_wait_q; u8 cmd_complete; }; struct btmrvl_private { struct btmrvl_device btmrvl_dev; struct btmrvl_adapter *adapter; struct btmrvl_thread main_thread; int (*hw_host_to_card) (struct btmrvl_private *priv, u8 *payload, u16 nb); int (*hw_wakeup_firmware) (struct btmrvl_private *priv); |
d1d10d783 Bluetooth: Proces... |
76 |
int (*hw_process_int_status) (struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
77 |
spinlock_t driver_lock; /* spinlock used by driver */ |
fb784f050 Bluetooth: Add de... |
78 79 80 |
#ifdef CONFIG_DEBUG_FS void *debugfs_data; #endif |
132ff4e5f Bluetooth: Add bt... |
81 82 83 84 85 86 87 88 89 |
}; #define MRVL_VENDOR_PKT 0xFE /* Bluetooth commands */ #define BT_CMD_AUTO_SLEEP_MODE 0x23 #define BT_CMD_HOST_SLEEP_CONFIG 0x59 #define BT_CMD_HOST_SLEEP_ENABLE 0x5A #define BT_CMD_MODULE_CFG_REQ 0x5B |
903c84377 Bluetooth: Decode... |
90 |
/* Sub-commands: Module Bringup/Shutdown Request/Response */ |
132ff4e5f Bluetooth: Add bt... |
91 |
#define MODULE_BRINGUP_REQ 0xF1 |
903c84377 Bluetooth: Decode... |
92 93 |
#define MODULE_BROUGHT_UP 0x00 #define MODULE_ALREADY_UP 0x0C |
132ff4e5f Bluetooth: Add bt... |
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
#define MODULE_SHUTDOWN_REQ 0xF2 #define BT_EVENT_POWER_STATE 0x20 /* Bluetooth Power States */ #define BT_PS_ENABLE 0x02 #define BT_PS_DISABLE 0x03 #define BT_PS_SLEEP 0x01 #define OGF 0x3F /* Host Sleep states */ #define HS_ACTIVATED 0x01 #define HS_DEACTIVATED 0x00 /* Power Save modes */ #define PS_SLEEP 0x01 #define PS_AWAKE 0x00 struct btmrvl_cmd { __le16 ocf_ogf; u8 length; u8 data[4]; |
81ca405ae Bluetooth: Use __... |
117 |
} __packed; |
132ff4e5f Bluetooth: Add bt... |
118 119 120 121 122 |
struct btmrvl_event { u8 ec; /* event counter */ u8 length; u8 data[4]; |
81ca405ae Bluetooth: Use __... |
123 |
} __packed; |
132ff4e5f Bluetooth: Add bt... |
124 125 |
/* Prototype of global function */ |
64061607e Bluetooth: Separa... |
126 |
int btmrvl_register_hdev(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
127 128 129 130 131 132 133 134 135 |
struct btmrvl_private *btmrvl_add_card(void *card); int btmrvl_remove_card(struct btmrvl_private *priv); void btmrvl_interrupt(struct btmrvl_private *priv); void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); |
32fd63981 Bluetooth: Enable... |
136 |
int btmrvl_enable_ps(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
137 |
int btmrvl_prepare_command(struct btmrvl_private *priv); |
fb784f050 Bluetooth: Add de... |
138 139 140 141 |
#ifdef CONFIG_DEBUG_FS void btmrvl_debugfs_init(struct hci_dev *hdev); void btmrvl_debugfs_remove(struct hci_dev *hdev); #endif |