aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-02-15 15:43:49 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-15 15:43:49 -0500
commit35ed663f5f4f70dd750ea3e0166c5b90db9feea3 (patch)
tree2cc217538ab719f62195181a7e67155605ed8e61
parentddd0010392d9cbcb95b53d11b7cafc67b373ab56 (diff)
parent907f84990924bf3a8d248c040dabeb5127ae6938 (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2018-02-15 Here's the first bluetooth-next pull request targetting the 4.17 kernel release. - Fixes & cleanups to Atheros and Marvell drivers - Support for two new Realtek controllers - Support for new Intel Bluetooth controller - Fix for supporting multiple slave-role Bluetooth LE connections ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/bluetooth/ath3k.c28
-rw-r--r--drivers/bluetooth/btmrvl_main.c2
-rw-r--r--drivers/bluetooth/btrtl.c119
-rw-r--r--drivers/bluetooth/btusb.c10
-rw-r--r--drivers/bluetooth/hci_ath.c4
-rw-r--r--drivers/bluetooth/hci_ll.c2
-rw-r--r--net/bluetooth/hci_request.c6
7 files changed, 118 insertions, 53 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 204afe66de92..3d7a5c149af3 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -203,6 +203,12 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
203 { } /* Terminating entry */ 203 { } /* Terminating entry */
204}; 204};
205 205
206static inline void ath3k_log_failed_loading(int err, int len, int size)
207{
208 BT_ERR("Error in firmware loading err = %d, len = %d, size = %d",
209 err, len, size);
210}
211
206#define USB_REQ_DFU_DNLOAD 1 212#define USB_REQ_DFU_DNLOAD 1
207#define BULK_SIZE 4096 213#define BULK_SIZE 4096
208#define FW_HDR_SIZE 20 214#define FW_HDR_SIZE 20
@@ -227,15 +233,16 @@ static int ath3k_load_firmware(struct usb_device *udev,
227 return -ENOMEM; 233 return -ENOMEM;
228 } 234 }
229 235
230 memcpy(send_buf, firmware->data, 20); 236 memcpy(send_buf, firmware->data, FW_HDR_SIZE);
231 err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR, 237 err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
232 0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT); 238 0, 0, send_buf, FW_HDR_SIZE,
239 USB_CTRL_SET_TIMEOUT);
233 if (err < 0) { 240 if (err < 0) {
234 BT_ERR("Can't change to loading configuration err"); 241 BT_ERR("Can't change to loading configuration err");
235 goto error; 242 goto error;
236 } 243 }
237 sent += 20; 244 sent += FW_HDR_SIZE;
238 count -= 20; 245 count -= FW_HDR_SIZE;
239 246
240 pipe = usb_sndbulkpipe(udev, 0x02); 247 pipe = usb_sndbulkpipe(udev, 0x02);
241 248
@@ -250,8 +257,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
250 &len, 3000); 257 &len, 3000);
251 258
252 if (err || (len != size)) { 259 if (err || (len != size)) {
253 BT_ERR("Error in firmware loading err = %d," 260 ath3k_log_failed_loading(err, len, size);
254 "len = %d, size = %d", err, len, size);
255 goto error; 261 goto error;
256 } 262 }
257 263
@@ -350,8 +356,7 @@ static int ath3k_load_fwfile(struct usb_device *udev,
350 err = usb_bulk_msg(udev, pipe, send_buf, size, 356 err = usb_bulk_msg(udev, pipe, send_buf, size,
351 &len, 3000); 357 &len, 3000);
352 if (err || (len != size)) { 358 if (err || (len != size)) {
353 BT_ERR("Error in firmware loading err = %d," 359 ath3k_log_failed_loading(err, len, size);
354 "len = %d, size = %d", err, len, size);
355 kfree(send_buf); 360 kfree(send_buf);
356 return err; 361 return err;
357 } 362 }
@@ -398,7 +403,7 @@ static int ath3k_set_normal_mode(struct usb_device *udev)
398static int ath3k_load_patch(struct usb_device *udev) 403static int ath3k_load_patch(struct usb_device *udev)
399{ 404{
400 unsigned char fw_state; 405 unsigned char fw_state;
401 char filename[ATH3K_NAME_LEN] = {0}; 406 char filename[ATH3K_NAME_LEN];
402 const struct firmware *firmware; 407 const struct firmware *firmware;
403 struct ath3k_version fw_version; 408 struct ath3k_version fw_version;
404 __u32 pt_rom_version, pt_build_version; 409 __u32 pt_rom_version, pt_build_version;
@@ -451,7 +456,7 @@ static int ath3k_load_patch(struct usb_device *udev)
451static int ath3k_load_syscfg(struct usb_device *udev) 456static int ath3k_load_syscfg(struct usb_device *udev)
452{ 457{
453 unsigned char fw_state; 458 unsigned char fw_state;
454 char filename[ATH3K_NAME_LEN] = {0}; 459 char filename[ATH3K_NAME_LEN];
455 const struct firmware *firmware; 460 const struct firmware *firmware;
456 struct ath3k_version fw_version; 461 struct ath3k_version fw_version;
457 int clk_value, ret; 462 int clk_value, ret;
@@ -522,7 +527,6 @@ static int ath3k_probe(struct usb_interface *intf,
522 527
523 /* load patch and sysconfig files for AR3012 */ 528 /* load patch and sysconfig files for AR3012 */
524 if (id->driver_info & BTUSB_ATH3012) { 529 if (id->driver_info & BTUSB_ATH3012) {
525
526 /* New firmware with patch and sysconfig files already loaded */ 530 /* New firmware with patch and sysconfig files already loaded */
527 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001) 531 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001)
528 return -ENODEV; 532 return -ENODEV;
@@ -565,7 +569,7 @@ static int ath3k_probe(struct usb_interface *intf,
565 569
566static void ath3k_disconnect(struct usb_interface *intf) 570static void ath3k_disconnect(struct usb_interface *intf)
567{ 571{
568 BT_DBG("ath3k_disconnect intf %p", intf); 572 BT_DBG("%s intf %p", __func__, intf);
569} 573}
570 574
571static struct usb_driver ath3k_driver = { 575static struct usb_driver ath3k_driver = {
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index b280d466f05b..f6c694a1b9b0 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -183,7 +183,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode,
183 return -EFAULT; 183 return -EFAULT;
184 } 184 }
185 185
186 skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC); 186 skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_KERNEL);
187 if (!skb) { 187 if (!skb) {
188 BT_ERR("No free skb"); 188 BT_ERR("No free skb");
189 return -ENOMEM; 189 return -ENOMEM;
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 6e2ad748abba..437f080deaab 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -35,6 +35,60 @@
35#define RTL_ROM_LMP_8761A 0x8761 35#define RTL_ROM_LMP_8761A 0x8761
36#define RTL_ROM_LMP_8822B 0x8822 36#define RTL_ROM_LMP_8822B 0x8822
37 37
38#define IC_MATCH_FL_LMPSUBV (1 << 0)
39#define IC_MATCH_FL_HCIREV (1 << 1)
40#define IC_INFO(lmps, hcir) \
41 .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV, \
42 .lmp_subver = (lmps), \
43 .hci_rev = (hcir)
44
45struct id_table {
46 __u16 match_flags;
47 __u16 lmp_subver;
48 __u16 hci_rev;
49 bool config_needed;
50 char *fw_name;
51 char *cfg_name;
52};
53
54static const struct id_table ic_id_table[] = {
55 /* 8723B */
56 { IC_INFO(RTL_ROM_LMP_8723B, 0xb),
57 .config_needed = false,
58 .fw_name = "rtl_bt/rtl8723b_fw.bin",
59 .cfg_name = "rtl_bt/rtl8723b_config.bin" },
60
61 /* 8723D */
62 { IC_INFO(RTL_ROM_LMP_8723B, 0xd),
63 .config_needed = true,
64 .fw_name = "rtl_bt/rtl8723d_fw.bin",
65 .cfg_name = "rtl_bt/rtl8723d_config.bin" },
66
67 /* 8821A */
68 { IC_INFO(RTL_ROM_LMP_8821A, 0xa),
69 .config_needed = false,
70 .fw_name = "rtl_bt/rtl8821a_fw.bin",
71 .cfg_name = "rtl_bt/rtl8821a_config.bin" },
72
73 /* 8821C */
74 { IC_INFO(RTL_ROM_LMP_8821A, 0xc),
75 .config_needed = false,
76 .fw_name = "rtl_bt/rtl8821c_fw.bin",
77 .cfg_name = "rtl_bt/rtl8821c_config.bin" },
78
79 /* 8761A */
80 { IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0,
81 .config_needed = false,
82 .fw_name = "rtl_bt/rtl8761a_fw.bin",
83 .cfg_name = "rtl_bt/rtl8761a_config.bin" },
84
85 /* 8822B */
86 { IC_INFO(RTL_ROM_LMP_8822B, 0xb),
87 .config_needed = true,
88 .fw_name = "rtl_bt/rtl8822b_fw.bin",
89 .cfg_name = "rtl_bt/rtl8822b_config.bin" },
90 };
91
38static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version) 92static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
39{ 93{
40 struct rtl_rom_version_evt *rom_version; 94 struct rtl_rom_version_evt *rom_version;
@@ -64,9 +118,9 @@ static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
64 return 0; 118 return 0;
65} 119}
66 120
67static int rtl8723b_parse_firmware(struct hci_dev *hdev, u16 lmp_subver, 121static int rtlbt_parse_firmware(struct hci_dev *hdev, u16 lmp_subver,
68 const struct firmware *fw, 122 const struct firmware *fw,
69 unsigned char **_buf) 123 unsigned char **_buf)
70{ 124{
71 const u8 extension_sig[] = { 0x51, 0x04, 0xfd, 0x77 }; 125 const u8 extension_sig[] = { 0x51, 0x04, 0xfd, 0x77 };
72 struct rtl_epatch_header *epatch_info; 126 struct rtl_epatch_header *epatch_info;
@@ -88,6 +142,8 @@ static int rtl8723b_parse_firmware(struct hci_dev *hdev, u16 lmp_subver,
88 { RTL_ROM_LMP_8821A, 2 }, 142 { RTL_ROM_LMP_8821A, 2 },
89 { RTL_ROM_LMP_8761A, 3 }, 143 { RTL_ROM_LMP_8761A, 3 },
90 { RTL_ROM_LMP_8822B, 8 }, 144 { RTL_ROM_LMP_8822B, 8 },
145 { RTL_ROM_LMP_8723B, 9 }, /* 8723D */
146 { RTL_ROM_LMP_8821A, 10 }, /* 8821C */
91 }; 147 };
92 148
93 ret = rtl_read_rom_version(hdev, &rom_version); 149 ret = rtl_read_rom_version(hdev, &rom_version);
@@ -320,8 +376,8 @@ out:
320 return ret; 376 return ret;
321} 377}
322 378
323static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver, 379static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 hci_rev,
324 const char *fw_name) 380 u16 lmp_subver)
325{ 381{
326 unsigned char *fw_data = NULL; 382 unsigned char *fw_data = NULL;
327 const struct firmware *fw; 383 const struct firmware *fw;
@@ -330,39 +386,40 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver,
330 u8 *cfg_buff = NULL; 386 u8 *cfg_buff = NULL;
331 u8 *tbuff; 387 u8 *tbuff;
332 char *cfg_name = NULL; 388 char *cfg_name = NULL;
333 bool config_needed = false; 389 char *fw_name = NULL;
390 int i;
391
392 for (i = 0; i < ARRAY_SIZE(ic_id_table); i++) {
393 if ((ic_id_table[i].match_flags & IC_MATCH_FL_LMPSUBV) &&
394 (ic_id_table[i].lmp_subver != lmp_subver))
395 continue;
396 if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIREV) &&
397 (ic_id_table[i].hci_rev != hci_rev))
398 continue;
334 399
335 switch (lmp_subver) {
336 case RTL_ROM_LMP_8723B:
337 cfg_name = "rtl_bt/rtl8723b_config.bin";
338 break;
339 case RTL_ROM_LMP_8821A:
340 cfg_name = "rtl_bt/rtl8821a_config.bin";
341 break;
342 case RTL_ROM_LMP_8761A:
343 cfg_name = "rtl_bt/rtl8761a_config.bin";
344 break;
345 case RTL_ROM_LMP_8822B:
346 cfg_name = "rtl_bt/rtl8822b_config.bin";
347 config_needed = true;
348 break;
349 default:
350 BT_ERR("%s: rtl: no config according to lmp_subver %04x",
351 hdev->name, lmp_subver);
352 break; 400 break;
353 } 401 }
354 402
403 if (i >= ARRAY_SIZE(ic_id_table)) {
404 BT_ERR("%s: unknown IC info, lmp subver %04x, hci rev %04x",
405 hdev->name, lmp_subver, hci_rev);
406 return -EINVAL;
407 }
408
409 cfg_name = ic_id_table[i].cfg_name;
410
355 if (cfg_name) { 411 if (cfg_name) {
356 cfg_sz = rtl_load_config(hdev, cfg_name, &cfg_buff); 412 cfg_sz = rtl_load_config(hdev, cfg_name, &cfg_buff);
357 if (cfg_sz < 0) { 413 if (cfg_sz < 0) {
358 cfg_sz = 0; 414 cfg_sz = 0;
359 if (config_needed) 415 if (ic_id_table[i].config_needed)
360 BT_ERR("Necessary config file %s not found\n", 416 BT_ERR("Necessary config file %s not found\n",
361 cfg_name); 417 cfg_name);
362 } 418 }
363 } else 419 } else
364 cfg_sz = 0; 420 cfg_sz = 0;
365 421
422 fw_name = ic_id_table[i].fw_name;
366 bt_dev_info(hdev, "rtl: loading %s", fw_name); 423 bt_dev_info(hdev, "rtl: loading %s", fw_name);
367 ret = request_firmware(&fw, fw_name, &hdev->dev); 424 ret = request_firmware(&fw, fw_name, &hdev->dev);
368 if (ret < 0) { 425 if (ret < 0) {
@@ -370,7 +427,7 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver,
370 goto err_req_fw; 427 goto err_req_fw;
371 } 428 }
372 429
373 ret = rtl8723b_parse_firmware(hdev, lmp_subver, fw, &fw_data); 430 ret = rtlbt_parse_firmware(hdev, lmp_subver, fw, &fw_data);
374 if (ret < 0) 431 if (ret < 0)
375 goto out; 432 goto out;
376 433
@@ -429,7 +486,7 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
429{ 486{
430 struct sk_buff *skb; 487 struct sk_buff *skb;
431 struct hci_rp_read_local_version *resp; 488 struct hci_rp_read_local_version *resp;
432 u16 lmp_subver; 489 u16 hci_rev, lmp_subver;
433 490
434 skb = btrtl_read_local_version(hdev); 491 skb = btrtl_read_local_version(hdev);
435 if (IS_ERR(skb)) 492 if (IS_ERR(skb))
@@ -441,6 +498,7 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
441 resp->hci_ver, resp->hci_rev, 498 resp->hci_ver, resp->hci_rev,
442 resp->lmp_ver, resp->lmp_subver); 499 resp->lmp_ver, resp->lmp_subver);
443 500
501 hci_rev = le16_to_cpu(resp->hci_rev);
444 lmp_subver = le16_to_cpu(resp->lmp_subver); 502 lmp_subver = le16_to_cpu(resp->lmp_subver);
445 kfree_skb(skb); 503 kfree_skb(skb);
446 504
@@ -455,17 +513,10 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
455 case RTL_ROM_LMP_3499: 513 case RTL_ROM_LMP_3499:
456 return btrtl_setup_rtl8723a(hdev); 514 return btrtl_setup_rtl8723a(hdev);
457 case RTL_ROM_LMP_8723B: 515 case RTL_ROM_LMP_8723B:
458 return btrtl_setup_rtl8723b(hdev, lmp_subver,
459 "rtl_bt/rtl8723b_fw.bin");
460 case RTL_ROM_LMP_8821A: 516 case RTL_ROM_LMP_8821A:
461 return btrtl_setup_rtl8723b(hdev, lmp_subver,
462 "rtl_bt/rtl8821a_fw.bin");
463 case RTL_ROM_LMP_8761A: 517 case RTL_ROM_LMP_8761A:
464 return btrtl_setup_rtl8723b(hdev, lmp_subver,
465 "rtl_bt/rtl8761a_fw.bin");
466 case RTL_ROM_LMP_8822B: 518 case RTL_ROM_LMP_8822B:
467 return btrtl_setup_rtl8723b(hdev, lmp_subver, 519 return btrtl_setup_rtl8723b(hdev, hci_rev, lmp_subver);
468 "rtl_bt/rtl8822b_fw.bin");
469 default: 520 default:
470 bt_dev_info(hdev, "rtl: assuming no firmware upload needed"); 521 bt_dev_info(hdev, "rtl: assuming no firmware upload needed");
471 return 0; 522 return 0;
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 2a55380ad730..c8e9ae6b99e1 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -339,6 +339,7 @@ static const struct usb_device_id blacklist_table[] = {
339 339
340 /* Intel Bluetooth devices */ 340 /* Intel Bluetooth devices */
341 { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW }, 341 { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW },
342 { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW },
342 { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, 343 { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
343 { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, 344 { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
344 { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, 345 { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL },
@@ -373,6 +374,9 @@ static const struct usb_device_id blacklist_table[] = {
373 { USB_DEVICE(0x13d3, 0x3461), .driver_info = BTUSB_REALTEK }, 374 { USB_DEVICE(0x13d3, 0x3461), .driver_info = BTUSB_REALTEK },
374 { USB_DEVICE(0x13d3, 0x3462), .driver_info = BTUSB_REALTEK }, 375 { USB_DEVICE(0x13d3, 0x3462), .driver_info = BTUSB_REALTEK },
375 376
377 /* Additional Realtek 8822BE Bluetooth devices */
378 { USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
379
376 /* Silicon Wave based devices */ 380 /* Silicon Wave based devices */
377 { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE }, 381 { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
378 382
@@ -2057,6 +2061,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2057 case 0x0c: /* WsP */ 2061 case 0x0c: /* WsP */
2058 case 0x11: /* JfP */ 2062 case 0x11: /* JfP */
2059 case 0x12: /* ThP */ 2063 case 0x12: /* ThP */
2064 case 0x13: /* HrP */
2065 case 0x14: /* QnJ, IcP */
2060 break; 2066 break;
2061 default: 2067 default:
2062 BT_ERR("%s: Unsupported Intel hardware variant (%u)", 2068 BT_ERR("%s: Unsupported Intel hardware variant (%u)",
@@ -2149,6 +2155,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2149 break; 2155 break;
2150 case 0x11: /* JfP */ 2156 case 0x11: /* JfP */
2151 case 0x12: /* ThP */ 2157 case 0x12: /* ThP */
2158 case 0x13: /* HrP */
2159 case 0x14: /* QnJ, IcP */
2152 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi", 2160 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi",
2153 le16_to_cpu(ver.hw_variant), 2161 le16_to_cpu(ver.hw_variant),
2154 le16_to_cpu(ver.hw_revision), 2162 le16_to_cpu(ver.hw_revision),
@@ -2180,6 +2188,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2180 break; 2188 break;
2181 case 0x11: /* JfP */ 2189 case 0x11: /* JfP */
2182 case 0x12: /* ThP */ 2190 case 0x12: /* ThP */
2191 case 0x13: /* HrP */
2192 case 0x14: /* QnJ, IcP */
2183 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc", 2193 snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc",
2184 le16_to_cpu(ver.hw_variant), 2194 le16_to_cpu(ver.hw_variant),
2185 le16_to_cpu(ver.hw_revision), 2195 le16_to_cpu(ver.hw_revision),
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c
index 14ae7ee88acb..d568fbd94d6c 100644
--- a/drivers/bluetooth/hci_ath.c
+++ b/drivers/bluetooth/hci_ath.c
@@ -71,12 +71,12 @@ static int ath_wakeup_ar3k(struct tty_struct *tty)
71 /* Clear RTS first */ 71 /* Clear RTS first */
72 tty->driver->ops->tiocmget(tty); 72 tty->driver->ops->tiocmget(tty);
73 tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS); 73 tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS);
74 mdelay(20); 74 msleep(20);
75 75
76 /* Set RTS, wake up board */ 76 /* Set RTS, wake up board */
77 tty->driver->ops->tiocmget(tty); 77 tty->driver->ops->tiocmget(tty);
78 tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00); 78 tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00);
79 mdelay(20); 79 msleep(20);
80 80
81 status = tty->driver->ops->tiocmget(tty); 81 status = tty->driver->ops->tiocmget(tty);
82 return status; 82 return status;
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 1b4417a623a4..2f30dcad96bd 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -650,7 +650,7 @@ static int download_firmware(struct ll_device *lldev)
650 break; 650 break;
651 case ACTION_DELAY: /* sleep */ 651 case ACTION_DELAY: /* sleep */
652 bt_dev_info(lldev->hu.hdev, "sleep command in scr"); 652 bt_dev_info(lldev->hu.hdev, "sleep command in scr");
653 mdelay(((struct bts_action_delay *)action_ptr)->msec); 653 msleep(((struct bts_action_delay *)action_ptr)->msec);
654 break; 654 break;
655 } 655 }
656 len -= (sizeof(struct bts_action) + 656 len -= (sizeof(struct bts_action) +
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 3394e6791673..66c0781773df 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -934,8 +934,8 @@ static bool is_advertising_allowed(struct hci_dev *hdev, bool connectable)
934 /* Slave connection state and connectable mode bit 38 934 /* Slave connection state and connectable mode bit 38
935 * and scannable bit 21. 935 * and scannable bit 21.
936 */ 936 */
937 if (connectable && (!(hdev->le_states[4] & 0x01) || 937 if (connectable && (!(hdev->le_states[4] & 0x40) ||
938 !(hdev->le_states[2] & 0x40))) 938 !(hdev->le_states[2] & 0x20)))
939 return false; 939 return false;
940 } 940 }
941 941
@@ -948,7 +948,7 @@ static bool is_advertising_allowed(struct hci_dev *hdev, bool connectable)
948 /* Master connection state and connectable mode bit 35 and 948 /* Master connection state and connectable mode bit 35 and
949 * scannable 19. 949 * scannable 19.
950 */ 950 */
951 if (connectable && (!(hdev->le_states[4] & 0x10) || 951 if (connectable && (!(hdev->le_states[4] & 0x08) ||
952 !(hdev->le_states[2] & 0x08))) 952 !(hdev->le_states[2] & 0x08)))
953 return false; 953 return false;
954 } 954 }