Blame view
drivers/bluetooth/btmrvl_drv.h
5.13 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 |
#include <net/bluetooth/bluetooth.h> |
bb7f4f0bc btmrvl: add platf... |
25 26 27 28 29 30 31 32 33 |
#include <linux/err.h> #include <linux/gpio.h> #include <linux/gfp.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/of_gpio.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> |
bb7f4f0bc btmrvl: add platf... |
34 |
#include <linux/of_irq.h> |
132ff4e5f Bluetooth: Add bt... |
35 36 |
#define BTM_HEADER_LEN 4 |
132ff4e5f Bluetooth: Add bt... |
37 38 39 |
#define BTM_UPLD_SIZE 2312 /* Time to wait until Host Sleep state change in millisecond */ |
0333d6dd3 Bluetooth: btmrvl... |
40 |
#define WAIT_UNTIL_HS_STATE_CHANGED msecs_to_jiffies(5000) |
132ff4e5f Bluetooth: Add bt... |
41 |
/* Time to wait for command response in millisecond */ |
0333d6dd3 Bluetooth: btmrvl... |
42 |
#define WAIT_UNTIL_CMD_RESP msecs_to_jiffies(5000) |
132ff4e5f Bluetooth: Add bt... |
43 |
|
dc759613b Bluetooth: btmrvl... |
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
enum rdwr_status { RDWR_STATUS_SUCCESS = 0, RDWR_STATUS_FAILURE = 1, RDWR_STATUS_DONE = 2 }; #define FW_DUMP_MAX_NAME_LEN 8 #define FW_DUMP_HOST_READY 0xEE #define FW_DUMP_DONE 0xFF #define FW_DUMP_READ_DONE 0xFE struct memory_type_mapping { u8 mem_name[FW_DUMP_MAX_NAME_LEN]; u8 *mem_ptr; u32 mem_size; u8 done_flag; }; |
132ff4e5f Bluetooth: Add bt... |
61 62 63 64 65 66 67 |
struct btmrvl_thread { struct task_struct *task; wait_queue_head_t wait_q; void *priv; }; struct btmrvl_device { |
132ff4e5f Bluetooth: Add bt... |
68 69 |
void *card; struct hci_dev *hcidev; |
f120c6b63 Bluetooth: Set hd... |
70 |
u8 dev_type; |
132ff4e5f Bluetooth: Add bt... |
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
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 { |
0d3674084 Bluetooth: btmrvl... |
86 87 |
void *hw_regs_buf; u8 *hw_regs; |
132ff4e5f Bluetooth: Add bt... |
88 89 90 91 92 93 94 |
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; |
396e04f4b Bluetooth: btmrvl... |
95 |
wait_queue_head_t event_hs_wait_q; |
132ff4e5f Bluetooth: Add bt... |
96 |
u8 cmd_complete; |
ba54a16ff Bluetooth: btmrvl... |
97 |
bool is_suspended; |
8cf60cf23 Bluetooth: btmrvl... |
98 |
bool is_suspending; |
132ff4e5f Bluetooth: Add bt... |
99 100 101 102 103 104 |
}; struct btmrvl_private { struct btmrvl_device btmrvl_dev; struct btmrvl_adapter *adapter; struct btmrvl_thread main_thread; |
ba27b7ef4 Bluetooth: btmrvl... |
105 |
int (*hw_host_to_card)(struct btmrvl_private *priv, |
132ff4e5f Bluetooth: Add bt... |
106 |
u8 *payload, u16 nb); |
ba27b7ef4 Bluetooth: btmrvl... |
107 108 |
int (*hw_wakeup_firmware)(struct btmrvl_private *priv); int (*hw_process_int_status)(struct btmrvl_private *priv); |
dc759613b Bluetooth: btmrvl... |
109 |
void (*firmware_dump)(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
110 |
spinlock_t driver_lock; /* spinlock used by driver */ |
fb784f050 Bluetooth: Add de... |
111 112 113 |
#ifdef CONFIG_DEBUG_FS void *debugfs_data; #endif |
7b4b8740c Bluetooth: btmrvl... |
114 |
bool surprise_removed; |
132ff4e5f Bluetooth: Add bt... |
115 116 117 |
}; #define MRVL_VENDOR_PKT 0xFE |
3e4543abf Bluetooth: btmrvl... |
118 |
/* Vendor specific Bluetooth commands */ |
4df82b591 Bluetooth: btmrvl... |
119 |
#define BT_CMD_PSCAN_WIN_REPORT_ENABLE 0xFC03 |
a715d11e4 Bluetooth: btmrvl... |
120 |
#define BT_CMD_ROUTE_SCO_TO_HOST 0xFC1D |
27b869f59 Bluetooth: btmrvl... |
121 |
#define BT_CMD_SET_BDADDR 0xFC22 |
3e4543abf Bluetooth: btmrvl... |
122 123 124 125 126 |
#define BT_CMD_AUTO_SLEEP_MODE 0xFC23 #define BT_CMD_HOST_SLEEP_CONFIG 0xFC59 #define BT_CMD_HOST_SLEEP_ENABLE 0xFC5A #define BT_CMD_MODULE_CFG_REQ 0xFC5B #define BT_CMD_LOAD_CONFIG_DATA 0xFC61 |
132ff4e5f Bluetooth: Add bt... |
127 |
|
903c84377 Bluetooth: Decode... |
128 |
/* Sub-commands: Module Bringup/Shutdown Request/Response */ |
132ff4e5f Bluetooth: Add bt... |
129 |
#define MODULE_BRINGUP_REQ 0xF1 |
903c84377 Bluetooth: Decode... |
130 131 |
#define MODULE_BROUGHT_UP 0x00 #define MODULE_ALREADY_UP 0x0C |
132ff4e5f Bluetooth: Add bt... |
132 |
#define MODULE_SHUTDOWN_REQ 0xF2 |
3e4543abf Bluetooth: btmrvl... |
133 134 135 136 137 |
/* Vendor specific Bluetooth events */ #define BT_EVENT_AUTO_SLEEP_MODE 0x23 #define BT_EVENT_HOST_SLEEP_CONFIG 0x59 #define BT_EVENT_HOST_SLEEP_ENABLE 0x5A #define BT_EVENT_MODULE_CFG_REQ 0x5B |
132ff4e5f Bluetooth: Add bt... |
138 139 140 141 142 143 |
#define BT_EVENT_POWER_STATE 0x20 /* Bluetooth Power States */ #define BT_PS_ENABLE 0x02 #define BT_PS_DISABLE 0x03 #define BT_PS_SLEEP 0x01 |
132ff4e5f Bluetooth: Add bt... |
144 145 146 147 148 149 150 |
/* Host Sleep states */ #define HS_ACTIVATED 0x01 #define HS_DEACTIVATED 0x00 /* Power Save modes */ #define PS_SLEEP 0x01 #define PS_AWAKE 0x00 |
8a4934f1d Bluetooth: btmrvl... |
151 |
#define BT_CAL_HDR_LEN 4 |
2cc868902 Bluetooth: btmrvl... |
152 |
#define BT_CAL_DATA_SIZE 28 |
132ff4e5f Bluetooth: Add bt... |
153 154 155 156 |
struct btmrvl_event { u8 ec; /* event counter */ u8 length; u8 data[4]; |
81ca405ae Bluetooth: Use __... |
157 |
} __packed; |
132ff4e5f Bluetooth: Add bt... |
158 159 |
/* Prototype of global function */ |
64061607e Bluetooth: Separa... |
160 |
int btmrvl_register_hdev(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
161 162 163 164 |
struct btmrvl_private *btmrvl_add_card(void *card); int btmrvl_remove_card(struct btmrvl_private *priv); void btmrvl_interrupt(struct btmrvl_private *priv); |
ea1e76a3f Bluetooth: btmrvl... |
165 |
bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); |
132ff4e5f Bluetooth: Add bt... |
166 |
int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); |
7125df535 Bluetooth: btmrvl... |
167 |
int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, u8 subcmd); |
af9632431 Bluetooth: Fix sp... |
168 |
int btmrvl_pscan_window_reporting(struct btmrvl_private *priv, u8 subcmd); |
2a8ff6112 Bluetooth: btmrvl... |
169 |
int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv); |
32fd63981 Bluetooth: Enable... |
170 |
int btmrvl_enable_ps(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
171 |
int btmrvl_prepare_command(struct btmrvl_private *priv); |
ba54a16ff Bluetooth: btmrvl... |
172 |
int btmrvl_enable_hs(struct btmrvl_private *priv); |
dc759613b Bluetooth: btmrvl... |
173 |
void btmrvl_firmware_dump(struct btmrvl_private *priv); |
132ff4e5f Bluetooth: Add bt... |
174 |
|
fb784f050 Bluetooth: Add de... |
175 176 177 178 |
#ifdef CONFIG_DEBUG_FS void btmrvl_debugfs_init(struct hci_dev *hdev); void btmrvl_debugfs_remove(struct hci_dev *hdev); #endif |