| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Bluetooth support for Realtek devices |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2015 Endless Mobile, Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | 6 | */ |
|---|
| 17 | 7 | |
|---|
| 18 | 8 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 31 | 21 | #define RTL_ROM_LMP_3499 0x3499 |
|---|
| 32 | 22 | #define RTL_ROM_LMP_8723A 0x1200 |
|---|
| 33 | 23 | #define RTL_ROM_LMP_8723B 0x8723 |
|---|
| 24 | +#define RTL_ROM_LMP_8723D 0x8873 |
|---|
| 34 | 25 | #define RTL_ROM_LMP_8821A 0x8821 |
|---|
| 35 | 26 | #define RTL_ROM_LMP_8761A 0x8761 |
|---|
| 36 | 27 | #define RTL_ROM_LMP_8822B 0x8822 |
|---|
| .. | .. |
|---|
| 117 | 108 | .fw_name = "rtl_bt/rtl8723ds_fw.bin", |
|---|
| 118 | 109 | .cfg_name = "rtl_bt/rtl8723ds_config" }, |
|---|
| 119 | 110 | |
|---|
| 111 | + /* 8723DU */ |
|---|
| 112 | + { IC_INFO(RTL_ROM_LMP_8723D, 0x826C), |
|---|
| 113 | + .config_needed = true, |
|---|
| 114 | + .has_rom_version = true, |
|---|
| 115 | + .fw_name = "rtl_bt/rtl8723d_fw.bin", |
|---|
| 116 | + .cfg_name = "rtl_bt/rtl8723d_config" }, |
|---|
| 117 | + |
|---|
| 120 | 118 | /* 8821A */ |
|---|
| 121 | 119 | { IC_INFO(RTL_ROM_LMP_8821A, 0xa), |
|---|
| 122 | 120 | .config_needed = false, |
|---|
| .. | .. |
|---|
| 132 | 130 | .cfg_name = "rtl_bt/rtl8821c_config" }, |
|---|
| 133 | 131 | |
|---|
| 134 | 132 | /* 8761A */ |
|---|
| 135 | | - { IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0, |
|---|
| 133 | + { IC_INFO(RTL_ROM_LMP_8761A, 0xa), |
|---|
| 136 | 134 | .config_needed = false, |
|---|
| 137 | 135 | .has_rom_version = true, |
|---|
| 138 | 136 | .fw_name = "rtl_bt/rtl8761a_fw.bin", |
|---|
| 139 | 137 | .cfg_name = "rtl_bt/rtl8761a_config" }, |
|---|
| 138 | + |
|---|
| 139 | + /* 8761B */ |
|---|
| 140 | + { IC_INFO(RTL_ROM_LMP_8761A, 0xb), |
|---|
| 141 | + .config_needed = false, |
|---|
| 142 | + .has_rom_version = true, |
|---|
| 143 | + .fw_name = "rtl_bt/rtl8761b_fw.bin", |
|---|
| 144 | + .cfg_name = "rtl_bt/rtl8761b_config" }, |
|---|
| 145 | + |
|---|
| 146 | + /* 8822C with UART interface */ |
|---|
| 147 | + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | |
|---|
| 148 | + IC_MATCH_FL_HCIBUS, |
|---|
| 149 | + .lmp_subver = RTL_ROM_LMP_8822B, |
|---|
| 150 | + .hci_rev = 0x000c, |
|---|
| 151 | + .hci_ver = 0x0a, |
|---|
| 152 | + .hci_bus = HCI_UART, |
|---|
| 153 | + .config_needed = true, |
|---|
| 154 | + .has_rom_version = true, |
|---|
| 155 | + .fw_name = "rtl_bt/rtl8822cs_fw.bin", |
|---|
| 156 | + .cfg_name = "rtl_bt/rtl8822cs_config" }, |
|---|
| 157 | + |
|---|
| 158 | + /* 8822C with USB interface */ |
|---|
| 159 | + { IC_INFO(RTL_ROM_LMP_8822B, 0xc), |
|---|
| 160 | + .config_needed = false, |
|---|
| 161 | + .has_rom_version = true, |
|---|
| 162 | + .fw_name = "rtl_bt/rtl8822cu_fw.bin", |
|---|
| 163 | + .cfg_name = "rtl_bt/rtl8822cu_config" }, |
|---|
| 140 | 164 | |
|---|
| 141 | 165 | /* 8822B */ |
|---|
| 142 | 166 | { IC_INFO(RTL_ROM_LMP_8822B, 0xb), |
|---|
| .. | .. |
|---|
| 173 | 197 | return &ic_id_table[i]; |
|---|
| 174 | 198 | } |
|---|
| 175 | 199 | |
|---|
| 200 | +static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev) |
|---|
| 201 | +{ |
|---|
| 202 | + struct sk_buff *skb; |
|---|
| 203 | + |
|---|
| 204 | + skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, |
|---|
| 205 | + HCI_INIT_TIMEOUT); |
|---|
| 206 | + if (IS_ERR(skb)) { |
|---|
| 207 | + rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)", |
|---|
| 208 | + PTR_ERR(skb)); |
|---|
| 209 | + return skb; |
|---|
| 210 | + } |
|---|
| 211 | + |
|---|
| 212 | + if (skb->len != sizeof(struct hci_rp_read_local_version)) { |
|---|
| 213 | + rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch"); |
|---|
| 214 | + kfree_skb(skb); |
|---|
| 215 | + return ERR_PTR(-EIO); |
|---|
| 216 | + } |
|---|
| 217 | + |
|---|
| 218 | + return skb; |
|---|
| 219 | +} |
|---|
| 220 | + |
|---|
| 176 | 221 | static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version) |
|---|
| 177 | 222 | { |
|---|
| 178 | 223 | struct rtl_rom_version_evt *rom_version; |
|---|
| .. | .. |
|---|
| 181 | 226 | /* Read RTL ROM version command */ |
|---|
| 182 | 227 | skb = __hci_cmd_sync(hdev, 0xfc6d, 0, NULL, HCI_INIT_TIMEOUT); |
|---|
| 183 | 228 | if (IS_ERR(skb)) { |
|---|
| 184 | | - rtl_dev_err(hdev, "Read ROM version failed (%ld)\n", |
|---|
| 229 | + rtl_dev_err(hdev, "Read ROM version failed (%ld)", |
|---|
| 185 | 230 | PTR_ERR(skb)); |
|---|
| 186 | 231 | return PTR_ERR(skb); |
|---|
| 187 | 232 | } |
|---|
| 188 | 233 | |
|---|
| 189 | 234 | if (skb->len != sizeof(*rom_version)) { |
|---|
| 190 | | - rtl_dev_err(hdev, "RTL version event length mismatch\n"); |
|---|
| 235 | + rtl_dev_err(hdev, "version event length mismatch"); |
|---|
| 191 | 236 | kfree_skb(skb); |
|---|
| 192 | 237 | return -EIO; |
|---|
| 193 | 238 | } |
|---|
| 194 | 239 | |
|---|
| 195 | 240 | rom_version = (struct rtl_rom_version_evt *)skb->data; |
|---|
| 196 | | - rtl_dev_info(hdev, "rom_version status=%x version=%x\n", |
|---|
| 241 | + rtl_dev_info(hdev, "rom_version status=%x version=%x", |
|---|
| 197 | 242 | rom_version->status, rom_version->version); |
|---|
| 198 | 243 | |
|---|
| 199 | 244 | *version = rom_version->version; |
|---|
| .. | .. |
|---|
| 206 | 251 | struct btrtl_device_info *btrtl_dev, |
|---|
| 207 | 252 | unsigned char **_buf) |
|---|
| 208 | 253 | { |
|---|
| 209 | | - const u8 extension_sig[] = { 0x51, 0x04, 0xfd, 0x77 }; |
|---|
| 254 | + static const u8 extension_sig[] = { 0x51, 0x04, 0xfd, 0x77 }; |
|---|
| 210 | 255 | struct rtl_epatch_header *epatch_info; |
|---|
| 211 | 256 | unsigned char *buf; |
|---|
| 212 | 257 | int i, len; |
|---|
| .. | .. |
|---|
| 228 | 273 | { RTL_ROM_LMP_8822B, 8 }, |
|---|
| 229 | 274 | { RTL_ROM_LMP_8723B, 9 }, /* 8723D */ |
|---|
| 230 | 275 | { RTL_ROM_LMP_8821A, 10 }, /* 8821C */ |
|---|
| 276 | + { RTL_ROM_LMP_8822B, 13 }, /* 8822C */ |
|---|
| 277 | + { RTL_ROM_LMP_8761A, 14 }, /* 8761B */ |
|---|
| 231 | 278 | }; |
|---|
| 232 | 279 | |
|---|
| 233 | 280 | min_size = sizeof(struct rtl_epatch_header) + sizeof(extension_sig) + 3; |
|---|
| .. | .. |
|---|
| 236 | 283 | |
|---|
| 237 | 284 | fwptr = btrtl_dev->fw_data + btrtl_dev->fw_len - sizeof(extension_sig); |
|---|
| 238 | 285 | if (memcmp(fwptr, extension_sig, sizeof(extension_sig)) != 0) { |
|---|
| 239 | | - rtl_dev_err(hdev, "extension section signature mismatch\n"); |
|---|
| 286 | + rtl_dev_err(hdev, "extension section signature mismatch"); |
|---|
| 240 | 287 | return -EINVAL; |
|---|
| 241 | 288 | } |
|---|
| 242 | 289 | |
|---|
| .. | .. |
|---|
| 257 | 304 | break; |
|---|
| 258 | 305 | |
|---|
| 259 | 306 | if (length == 0) { |
|---|
| 260 | | - rtl_dev_err(hdev, "found instruction with length 0\n"); |
|---|
| 307 | + rtl_dev_err(hdev, "found instruction with length 0"); |
|---|
| 261 | 308 | return -EINVAL; |
|---|
| 262 | 309 | } |
|---|
| 263 | 310 | |
|---|
| .. | .. |
|---|
| 270 | 317 | } |
|---|
| 271 | 318 | |
|---|
| 272 | 319 | if (project_id < 0) { |
|---|
| 273 | | - rtl_dev_err(hdev, "failed to find version instruction\n"); |
|---|
| 320 | + rtl_dev_err(hdev, "failed to find version instruction"); |
|---|
| 274 | 321 | return -EINVAL; |
|---|
| 275 | 322 | } |
|---|
| 276 | 323 | |
|---|
| .. | .. |
|---|
| 281 | 328 | } |
|---|
| 282 | 329 | |
|---|
| 283 | 330 | if (i >= ARRAY_SIZE(project_id_to_lmp_subver)) { |
|---|
| 284 | | - rtl_dev_err(hdev, "unknown project id %d\n", project_id); |
|---|
| 331 | + rtl_dev_err(hdev, "unknown project id %d", project_id); |
|---|
| 285 | 332 | return -EINVAL; |
|---|
| 286 | 333 | } |
|---|
| 287 | 334 | |
|---|
| 288 | 335 | if (btrtl_dev->ic_info->lmp_subver != |
|---|
| 289 | 336 | project_id_to_lmp_subver[i].lmp_subver) { |
|---|
| 290 | | - rtl_dev_err(hdev, "firmware is for %x but this is a %x\n", |
|---|
| 337 | + rtl_dev_err(hdev, "firmware is for %x but this is a %x", |
|---|
| 291 | 338 | project_id_to_lmp_subver[i].lmp_subver, |
|---|
| 292 | 339 | btrtl_dev->ic_info->lmp_subver); |
|---|
| 293 | 340 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 295 | 342 | |
|---|
| 296 | 343 | epatch_info = (struct rtl_epatch_header *)btrtl_dev->fw_data; |
|---|
| 297 | 344 | if (memcmp(epatch_info->signature, RTL_EPATCH_SIGNATURE, 8) != 0) { |
|---|
| 298 | | - rtl_dev_err(hdev, "bad EPATCH signature\n"); |
|---|
| 345 | + rtl_dev_err(hdev, "bad EPATCH signature"); |
|---|
| 299 | 346 | return -EINVAL; |
|---|
| 300 | 347 | } |
|---|
| 301 | 348 | |
|---|
| .. | .. |
|---|
| 362 | 409 | int frag_len = RTL_FRAG_LEN; |
|---|
| 363 | 410 | int ret = 0; |
|---|
| 364 | 411 | int i; |
|---|
| 412 | + struct sk_buff *skb; |
|---|
| 413 | + struct hci_rp_read_local_version *rp; |
|---|
| 365 | 414 | |
|---|
| 366 | 415 | dl_cmd = kmalloc(sizeof(struct rtl_download_cmd), GFP_KERNEL); |
|---|
| 367 | 416 | if (!dl_cmd) |
|---|
| .. | .. |
|---|
| 372 | 421 | |
|---|
| 373 | 422 | BT_DBG("download fw (%d/%d)", i, frag_num); |
|---|
| 374 | 423 | |
|---|
| 375 | | - dl_cmd->index = i; |
|---|
| 424 | + if (i > 0x7f) |
|---|
| 425 | + dl_cmd->index = (i & 0x7f) + 1; |
|---|
| 426 | + else |
|---|
| 427 | + dl_cmd->index = i; |
|---|
| 428 | + |
|---|
| 376 | 429 | if (i == (frag_num - 1)) { |
|---|
| 377 | 430 | dl_cmd->index |= 0x80; /* data end */ |
|---|
| 378 | 431 | frag_len = fw_len % RTL_FRAG_LEN; |
|---|
| .. | .. |
|---|
| 383 | 436 | skb = __hci_cmd_sync(hdev, 0xfc20, frag_len + 1, dl_cmd, |
|---|
| 384 | 437 | HCI_INIT_TIMEOUT); |
|---|
| 385 | 438 | if (IS_ERR(skb)) { |
|---|
| 386 | | - rtl_dev_err(hdev, "download fw command failed (%ld)\n", |
|---|
| 439 | + rtl_dev_err(hdev, "download fw command failed (%ld)", |
|---|
| 387 | 440 | PTR_ERR(skb)); |
|---|
| 388 | | - ret = -PTR_ERR(skb); |
|---|
| 441 | + ret = PTR_ERR(skb); |
|---|
| 389 | 442 | goto out; |
|---|
| 390 | 443 | } |
|---|
| 391 | 444 | |
|---|
| 392 | 445 | if (skb->len != sizeof(struct rtl_download_response)) { |
|---|
| 393 | | - rtl_dev_err(hdev, "download fw event length mismatch\n"); |
|---|
| 446 | + rtl_dev_err(hdev, "download fw event length mismatch"); |
|---|
| 394 | 447 | kfree_skb(skb); |
|---|
| 395 | 448 | ret = -EIO; |
|---|
| 396 | 449 | goto out; |
|---|
| .. | .. |
|---|
| 399 | 452 | kfree_skb(skb); |
|---|
| 400 | 453 | data += RTL_FRAG_LEN; |
|---|
| 401 | 454 | } |
|---|
| 455 | + |
|---|
| 456 | + skb = btrtl_read_local_version(hdev); |
|---|
| 457 | + if (IS_ERR(skb)) { |
|---|
| 458 | + ret = PTR_ERR(skb); |
|---|
| 459 | + rtl_dev_err(hdev, "read local version failed"); |
|---|
| 460 | + goto out; |
|---|
| 461 | + } |
|---|
| 462 | + |
|---|
| 463 | + rp = (struct hci_rp_read_local_version *)skb->data; |
|---|
| 464 | + rtl_dev_info(hdev, "fw version 0x%04x%04x", |
|---|
| 465 | + __le16_to_cpu(rp->hci_rev), __le16_to_cpu(rp->lmp_subver)); |
|---|
| 466 | + kfree_skb(skb); |
|---|
| 402 | 467 | |
|---|
| 403 | 468 | out: |
|---|
| 404 | 469 | kfree(dl_cmd); |
|---|
| .. | .. |
|---|
| 410 | 475 | const struct firmware *fw; |
|---|
| 411 | 476 | int ret; |
|---|
| 412 | 477 | |
|---|
| 413 | | - rtl_dev_info(hdev, "rtl: loading %s\n", name); |
|---|
| 478 | + rtl_dev_info(hdev, "loading %s", name); |
|---|
| 414 | 479 | ret = request_firmware(&fw, name, &hdev->dev); |
|---|
| 415 | 480 | if (ret < 0) |
|---|
| 416 | 481 | return ret; |
|---|
| .. | .. |
|---|
| 436 | 501 | * (which is only for RTL8723B and newer). |
|---|
| 437 | 502 | */ |
|---|
| 438 | 503 | if (!memcmp(btrtl_dev->fw_data, RTL_EPATCH_SIGNATURE, 8)) { |
|---|
| 439 | | - rtl_dev_err(hdev, "unexpected EPATCH signature!\n"); |
|---|
| 504 | + rtl_dev_err(hdev, "unexpected EPATCH signature!"); |
|---|
| 440 | 505 | return -EINVAL; |
|---|
| 441 | 506 | } |
|---|
| 442 | 507 | |
|---|
| .. | .. |
|---|
| 471 | 536 | fw_data = tbuff; |
|---|
| 472 | 537 | } |
|---|
| 473 | 538 | |
|---|
| 474 | | - rtl_dev_info(hdev, "cfg_sz %d, total sz %d\n", btrtl_dev->cfg_len, ret); |
|---|
| 539 | + rtl_dev_info(hdev, "cfg_sz %d, total sz %d", btrtl_dev->cfg_len, ret); |
|---|
| 475 | 540 | |
|---|
| 476 | 541 | ret = rtl_download_firmware(hdev, fw_data, ret); |
|---|
| 477 | 542 | |
|---|
| 478 | 543 | out: |
|---|
| 479 | 544 | kvfree(fw_data); |
|---|
| 480 | 545 | return ret; |
|---|
| 481 | | -} |
|---|
| 482 | | - |
|---|
| 483 | | -static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev) |
|---|
| 484 | | -{ |
|---|
| 485 | | - struct sk_buff *skb; |
|---|
| 486 | | - |
|---|
| 487 | | - skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL, |
|---|
| 488 | | - HCI_INIT_TIMEOUT); |
|---|
| 489 | | - if (IS_ERR(skb)) { |
|---|
| 490 | | - rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION failed (%ld)\n", |
|---|
| 491 | | - PTR_ERR(skb)); |
|---|
| 492 | | - return skb; |
|---|
| 493 | | - } |
|---|
| 494 | | - |
|---|
| 495 | | - if (skb->len != sizeof(struct hci_rp_read_local_version)) { |
|---|
| 496 | | - rtl_dev_err(hdev, "HCI_OP_READ_LOCAL_VERSION event length mismatch\n"); |
|---|
| 497 | | - kfree_skb(skb); |
|---|
| 498 | | - return ERR_PTR(-EIO); |
|---|
| 499 | | - } |
|---|
| 500 | | - |
|---|
| 501 | | - return skb; |
|---|
| 502 | 546 | } |
|---|
| 503 | 547 | |
|---|
| 504 | 548 | void btrtl_free(struct btrtl_device_info *btrtl_dev) |
|---|
| .. | .. |
|---|
| 533 | 577 | } |
|---|
| 534 | 578 | |
|---|
| 535 | 579 | resp = (struct hci_rp_read_local_version *)skb->data; |
|---|
| 536 | | - rtl_dev_info(hdev, "rtl: examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x\n", |
|---|
| 580 | + rtl_dev_info(hdev, "examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x lmp_subver=%04x", |
|---|
| 537 | 581 | resp->hci_ver, resp->hci_rev, |
|---|
| 538 | 582 | resp->lmp_ver, resp->lmp_subver); |
|---|
| 539 | 583 | |
|---|
| .. | .. |
|---|
| 546 | 590 | hdev->bus); |
|---|
| 547 | 591 | |
|---|
| 548 | 592 | if (!btrtl_dev->ic_info) { |
|---|
| 549 | | - rtl_dev_info(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x", |
|---|
| 593 | + rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x", |
|---|
| 550 | 594 | lmp_subver, hci_rev, hci_ver); |
|---|
| 551 | 595 | return btrtl_dev; |
|---|
| 552 | 596 | } |
|---|
| .. | .. |
|---|
| 560 | 604 | btrtl_dev->fw_len = rtl_load_file(hdev, btrtl_dev->ic_info->fw_name, |
|---|
| 561 | 605 | &btrtl_dev->fw_data); |
|---|
| 562 | 606 | if (btrtl_dev->fw_len < 0) { |
|---|
| 563 | | - rtl_dev_err(hdev, "firmware file %s not found\n", |
|---|
| 607 | + rtl_dev_err(hdev, "firmware file %s not found", |
|---|
| 564 | 608 | btrtl_dev->ic_info->fw_name); |
|---|
| 565 | 609 | ret = btrtl_dev->fw_len; |
|---|
| 566 | 610 | goto err_free; |
|---|
| .. | .. |
|---|
| 578 | 622 | &btrtl_dev->cfg_data); |
|---|
| 579 | 623 | if (btrtl_dev->ic_info->config_needed && |
|---|
| 580 | 624 | btrtl_dev->cfg_len <= 0) { |
|---|
| 581 | | - rtl_dev_err(hdev, "mandatory config file %s not found\n", |
|---|
| 625 | + rtl_dev_err(hdev, "mandatory config file %s not found", |
|---|
| 582 | 626 | btrtl_dev->ic_info->cfg_name); |
|---|
| 583 | 627 | ret = btrtl_dev->cfg_len; |
|---|
| 584 | 628 | goto err_free; |
|---|
| .. | .. |
|---|
| 604 | 648 | * to a different value. |
|---|
| 605 | 649 | */ |
|---|
| 606 | 650 | if (!btrtl_dev->ic_info) { |
|---|
| 607 | | - rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n"); |
|---|
| 651 | + rtl_dev_info(hdev, "assuming no firmware upload needed"); |
|---|
| 608 | 652 | return 0; |
|---|
| 609 | 653 | } |
|---|
| 610 | 654 | |
|---|
| .. | .. |
|---|
| 618 | 662 | case RTL_ROM_LMP_8822B: |
|---|
| 619 | 663 | return btrtl_setup_rtl8723b(hdev, btrtl_dev); |
|---|
| 620 | 664 | default: |
|---|
| 621 | | - rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n"); |
|---|
| 665 | + rtl_dev_info(hdev, "assuming no firmware upload needed"); |
|---|
| 622 | 666 | return 0; |
|---|
| 623 | 667 | } |
|---|
| 624 | 668 | } |
|---|
| .. | .. |
|---|
| 636 | 680 | ret = btrtl_download_firmware(hdev, btrtl_dev); |
|---|
| 637 | 681 | |
|---|
| 638 | 682 | btrtl_free(btrtl_dev); |
|---|
| 683 | + |
|---|
| 684 | + /* Enable controller to do both LE scan and BR/EDR inquiry |
|---|
| 685 | + * simultaneously. |
|---|
| 686 | + */ |
|---|
| 687 | + set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); |
|---|
| 639 | 688 | |
|---|
| 640 | 689 | return ret; |
|---|
| 641 | 690 | } |
|---|
| .. | .. |
|---|
| 710 | 759 | |
|---|
| 711 | 760 | total_data_len = btrtl_dev->cfg_len - sizeof(*config); |
|---|
| 712 | 761 | if (total_data_len <= 0) { |
|---|
| 713 | | - rtl_dev_warn(hdev, "no config loaded\n"); |
|---|
| 762 | + rtl_dev_warn(hdev, "no config loaded"); |
|---|
| 714 | 763 | return -EINVAL; |
|---|
| 715 | 764 | } |
|---|
| 716 | 765 | |
|---|
| 717 | 766 | config = (struct rtl_vendor_config *)btrtl_dev->cfg_data; |
|---|
| 718 | 767 | if (le32_to_cpu(config->signature) != RTL_CONFIG_MAGIC) { |
|---|
| 719 | | - rtl_dev_err(hdev, "invalid config magic\n"); |
|---|
| 768 | + rtl_dev_err(hdev, "invalid config magic"); |
|---|
| 720 | 769 | return -EINVAL; |
|---|
| 721 | 770 | } |
|---|
| 722 | 771 | |
|---|
| 723 | 772 | if (total_data_len < le16_to_cpu(config->total_len)) { |
|---|
| 724 | | - rtl_dev_err(hdev, "config is too short\n"); |
|---|
| 773 | + rtl_dev_err(hdev, "config is too short"); |
|---|
| 725 | 774 | return -EINVAL; |
|---|
| 726 | 775 | } |
|---|
| 727 | 776 | |
|---|
| .. | .. |
|---|
| 731 | 780 | switch (le16_to_cpu(entry->offset)) { |
|---|
| 732 | 781 | case 0xc: |
|---|
| 733 | 782 | if (entry->len < sizeof(*device_baudrate)) { |
|---|
| 734 | | - rtl_dev_err(hdev, "invalid UART config entry\n"); |
|---|
| 783 | + rtl_dev_err(hdev, "invalid UART config entry"); |
|---|
| 735 | 784 | return -EINVAL; |
|---|
| 736 | 785 | } |
|---|
| 737 | 786 | |
|---|
| .. | .. |
|---|
| 748 | 797 | break; |
|---|
| 749 | 798 | |
|---|
| 750 | 799 | default: |
|---|
| 751 | | - rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)\n", |
|---|
| 800 | + rtl_dev_dbg(hdev, "skipping config entry 0x%x (len %u)", |
|---|
| 752 | 801 | le16_to_cpu(entry->offset), entry->len); |
|---|
| 753 | 802 | break; |
|---|
| 754 | | - }; |
|---|
| 803 | + } |
|---|
| 755 | 804 | |
|---|
| 756 | 805 | i += sizeof(*entry) + entry->len; |
|---|
| 757 | 806 | } |
|---|
| 758 | 807 | |
|---|
| 759 | 808 | if (!found) { |
|---|
| 760 | | - rtl_dev_err(hdev, "no UART config entry found\n"); |
|---|
| 809 | + rtl_dev_err(hdev, "no UART config entry found"); |
|---|
| 761 | 810 | return -ENOENT; |
|---|
| 762 | 811 | } |
|---|
| 763 | 812 | |
|---|
| 764 | | - rtl_dev_dbg(hdev, "device baudrate = 0x%08x\n", *device_baudrate); |
|---|
| 765 | | - rtl_dev_dbg(hdev, "controller baudrate = %u\n", *controller_baudrate); |
|---|
| 766 | | - rtl_dev_dbg(hdev, "flow control %d\n", *flow_control); |
|---|
| 813 | + rtl_dev_dbg(hdev, "device baudrate = 0x%08x", *device_baudrate); |
|---|
| 814 | + rtl_dev_dbg(hdev, "controller baudrate = %u", *controller_baudrate); |
|---|
| 815 | + rtl_dev_dbg(hdev, "flow control %d", *flow_control); |
|---|
| 767 | 816 | |
|---|
| 768 | 817 | return 0; |
|---|
| 769 | 818 | } |
|---|