Skip to content

Commit 9a0bb57

Browse files
committed
Bluetooth: btbcm: Add firmware table for UART based devices
The Broadcom UART based devices seem to use a little bit different firmare naming prefix. So add a separate table for these devices. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent bdd8818 commit 9a0bb57

1 file changed

Lines changed: 41 additions & 15 deletions

File tree

‎drivers/bluetooth/btbcm.c‎

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,15 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
174174
static const struct {
175175
u16 subver;
176176
const char *name;
177-
} bcm_subver_table[] = {
177+
} bcm_uart_subver_table[] = {
178+
{ 0x410e, "BCM43341B0" }, /* 002.001.014 */
179+
{ }
180+
};
181+
182+
static const struct {
183+
u16 subver;
184+
const char *name;
185+
} bcm_usb_subver_table[] = {
178186
{ 0x210b, "BCM43142A0" }, /* 001.001.011 */
179187
{ 0x2112, "BCM4314A0" }, /* 001.001.018 */
180188
{ 0x2118, "BCM20702A0" }, /* 001.001.024 */
@@ -224,29 +232,47 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
224232
BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
225233
kfree_skb(skb);
226234

227-
/* Read USB Product Info */
228-
skb = btbcm_read_usb_product(hdev);
229-
if (IS_ERR(skb))
230-
return PTR_ERR(skb);
235+
switch ((rev & 0xf000) >> 12) {
236+
case 0:
237+
for (i = 0; bcm_uart_subver_table[i].name; i++) {
238+
if (subver == bcm_uart_subver_table[i].subver) {
239+
hw_name = bcm_uart_subver_table[i].name;
240+
break;
241+
}
242+
}
231243

232-
vid = get_unaligned_le16(skb->data + 1);
233-
pid = get_unaligned_le16(skb->data + 3);
234-
kfree_skb(skb);
244+
snprintf(fw_name, sizeof(fw_name), "brcm/%s.hcd",
245+
hw_name ? : "BCM");
246+
break;
247+
case 1:
248+
case 2:
249+
/* Read USB Product Info */
250+
skb = btbcm_read_usb_product(hdev);
251+
if (IS_ERR(skb))
252+
return PTR_ERR(skb);
253+
254+
vid = get_unaligned_le16(skb->data + 1);
255+
pid = get_unaligned_le16(skb->data + 3);
256+
kfree_skb(skb);
235257

236-
for (i = 0; bcm_subver_table[i].name; i++) {
237-
if (subver == bcm_subver_table[i].subver) {
238-
hw_name = bcm_subver_table[i].name;
239-
break;
258+
for (i = 0; bcm_usb_subver_table[i].name; i++) {
259+
if (subver == bcm_usb_subver_table[i].subver) {
260+
hw_name = bcm_usb_subver_table[i].name;
261+
break;
262+
}
240263
}
264+
265+
snprintf(fw_name, sizeof(fw_name), "brcm/%s-%4.4x-%4.4x.hcd",
266+
hw_name ? : "BCM", vid, pid);
267+
break;
268+
default:
269+
return 0;
241270
}
242271

243272
BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
244273
hw_name ? : "BCM", (subver & 0x7000) >> 13,
245274
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
246275

247-
snprintf(fw_name, sizeof(fw_name), "brcm/%s-%4.4x-%4.4x.hcd",
248-
hw_name ? : "BCM", vid, pid);
249-
250276
err = request_firmware(&fw, fw_name, &hdev->dev);
251277
if (err < 0) {
252278
BT_INFO("%s: BCM: patch %s not found", hdev->name, fw_name);

0 commit comments

Comments
 (0)