Commit 936009976497e1e123f3223bedca25312ee20f08
Committed by
Johan Hedberg
1 parent
f41c70c4d5
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
Bluetooth: Convert BCM92035 support to driver setup callback
With the early init stage during setup, this quirk can be simplified and kept fully inside the driver. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Showing 1 changed file with 23 additions and 11 deletions Side-by-side Diff
drivers/bluetooth/btusb.c
... | ... | @@ -246,6 +246,7 @@ |
246 | 246 | struct usb_endpoint_descriptor *isoc_rx_ep; |
247 | 247 | |
248 | 248 | __u8 cmdreq_type; |
249 | + unsigned long driver_info; | |
249 | 250 | |
250 | 251 | unsigned int sco_num; |
251 | 252 | int isoc_altsetting; |
... | ... | @@ -699,6 +700,26 @@ |
699 | 700 | return 0; |
700 | 701 | } |
701 | 702 | |
703 | +static int btusb_setup(struct hci_dev *hdev) | |
704 | +{ | |
705 | + struct btusb_data *data = hci_get_drvdata(hdev); | |
706 | + | |
707 | + BT_DBG("%s", hdev->name); | |
708 | + | |
709 | + if (data->driver_info & BTUSB_BCM92035) { | |
710 | + struct sk_buff *skb; | |
711 | + __u8 val = 0x00; | |
712 | + | |
713 | + skb = __hci_cmd_sync(hdev, 0xfc3b, 1, &val, HCI_INIT_TIMEOUT); | |
714 | + if (IS_ERR(skb)) | |
715 | + BT_ERR("BCM92035 command failed (%ld)", -PTR_ERR(skb)); | |
716 | + else | |
717 | + kfree_skb(skb); | |
718 | + } | |
719 | + | |
720 | + return 0; | |
721 | +} | |
722 | + | |
702 | 723 | static int btusb_send_frame(struct sk_buff *skb) |
703 | 724 | { |
704 | 725 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
... | ... | @@ -996,6 +1017,7 @@ |
996 | 1017 | return -ENODEV; |
997 | 1018 | |
998 | 1019 | data->cmdreq_type = USB_TYPE_CLASS; |
1020 | + data->driver_info = id->driver_info; | |
999 | 1021 | |
1000 | 1022 | data->udev = interface_to_usbdev(intf); |
1001 | 1023 | data->intf = intf; |
... | ... | @@ -1026,6 +1048,7 @@ |
1026 | 1048 | hdev->open = btusb_open; |
1027 | 1049 | hdev->close = btusb_close; |
1028 | 1050 | hdev->flush = btusb_flush; |
1051 | + hdev->setup = btusb_setup; | |
1029 | 1052 | hdev->send = btusb_send_frame; |
1030 | 1053 | hdev->notify = btusb_notify; |
1031 | 1054 | |
... | ... | @@ -1064,17 +1087,6 @@ |
1064 | 1087 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); |
1065 | 1088 | |
1066 | 1089 | data->isoc = NULL; |
1067 | - } | |
1068 | - | |
1069 | - if (id->driver_info & BTUSB_BCM92035) { | |
1070 | - unsigned char cmd[] = { 0x3b, 0xfc, 0x01, 0x00 }; | |
1071 | - struct sk_buff *skb; | |
1072 | - | |
1073 | - skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL); | |
1074 | - if (skb) { | |
1075 | - memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); | |
1076 | - skb_queue_tail(&hdev->driver_init, skb); | |
1077 | - } | |
1078 | 1090 | } |
1079 | 1091 | |
1080 | 1092 | if (data->isoc) { |