diff options
Diffstat (limited to 'drivers/bluetooth/btmrvl_main.c')
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index d1209adc882d..681ca9d18e12 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -200,6 +200,36 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd) | |||
200 | } | 200 | } |
201 | EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); | 201 | EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); |
202 | 202 | ||
203 | int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv) | ||
204 | { | ||
205 | struct sk_buff *skb; | ||
206 | struct btmrvl_cmd *cmd; | ||
207 | |||
208 | skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); | ||
209 | if (!skb) { | ||
210 | BT_ERR("No free skb"); | ||
211 | return -ENOMEM; | ||
212 | } | ||
213 | |||
214 | cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); | ||
215 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, | ||
216 | BT_CMD_HOST_SLEEP_CONFIG)); | ||
217 | cmd->length = 2; | ||
218 | cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; | ||
219 | cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); | ||
220 | |||
221 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | ||
222 | |||
223 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | ||
224 | skb_queue_head(&priv->adapter->tx_queue, skb); | ||
225 | |||
226 | BT_DBG("Queue HSCFG Command, gpio=0x%x, gap=0x%x", cmd->data[0], | ||
227 | cmd->data[1]); | ||
228 | |||
229 | return 0; | ||
230 | } | ||
231 | EXPORT_SYMBOL_GPL(btmrvl_send_hscfg_cmd); | ||
232 | |||
203 | int btmrvl_enable_ps(struct btmrvl_private *priv) | 233 | int btmrvl_enable_ps(struct btmrvl_private *priv) |
204 | { | 234 | { |
205 | struct sk_buff *skb; | 235 | struct sk_buff *skb; |
@@ -232,7 +262,7 @@ int btmrvl_enable_ps(struct btmrvl_private *priv) | |||
232 | } | 262 | } |
233 | EXPORT_SYMBOL_GPL(btmrvl_enable_ps); | 263 | EXPORT_SYMBOL_GPL(btmrvl_enable_ps); |
234 | 264 | ||
235 | static int btmrvl_enable_hs(struct btmrvl_private *priv) | 265 | int btmrvl_enable_hs(struct btmrvl_private *priv) |
236 | { | 266 | { |
237 | struct sk_buff *skb; | 267 | struct sk_buff *skb; |
238 | struct btmrvl_cmd *cmd; | 268 | struct btmrvl_cmd *cmd; |
@@ -268,35 +298,15 @@ static int btmrvl_enable_hs(struct btmrvl_private *priv) | |||
268 | 298 | ||
269 | return ret; | 299 | return ret; |
270 | } | 300 | } |
301 | EXPORT_SYMBOL_GPL(btmrvl_enable_hs); | ||
271 | 302 | ||
272 | int btmrvl_prepare_command(struct btmrvl_private *priv) | 303 | int btmrvl_prepare_command(struct btmrvl_private *priv) |
273 | { | 304 | { |
274 | struct sk_buff *skb = NULL; | ||
275 | struct btmrvl_cmd *cmd; | ||
276 | int ret = 0; | 305 | int ret = 0; |
277 | 306 | ||
278 | if (priv->btmrvl_dev.hscfgcmd) { | 307 | if (priv->btmrvl_dev.hscfgcmd) { |
279 | priv->btmrvl_dev.hscfgcmd = 0; | 308 | priv->btmrvl_dev.hscfgcmd = 0; |
280 | 309 | btmrvl_send_hscfg_cmd(priv); | |
281 | skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); | ||
282 | if (skb == NULL) { | ||
283 | BT_ERR("No free skb"); | ||
284 | return -ENOMEM; | ||
285 | } | ||
286 | |||
287 | cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); | ||
288 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_HOST_SLEEP_CONFIG)); | ||
289 | cmd->length = 2; | ||
290 | cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; | ||
291 | cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); | ||
292 | |||
293 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | ||
294 | |||
295 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | ||
296 | skb_queue_head(&priv->adapter->tx_queue, skb); | ||
297 | |||
298 | BT_DBG("Queue HSCFG Command, gpio=0x%x, gap=0x%x", | ||
299 | cmd->data[0], cmd->data[1]); | ||
300 | } | 310 | } |
301 | 311 | ||
302 | if (priv->btmrvl_dev.pscmd) { | 312 | if (priv->btmrvl_dev.pscmd) { |