diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-11-12 00:02:15 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-04 12:28:10 -0400 |
commit | 936009976497e1e123f3223bedca25312ee20f08 (patch) | |
tree | d98744b01d0caf3dfdde4135d2da8e5d325fb844 /drivers/bluetooth/btusb.c | |
parent | f41c70c4d5e3f6c2a7f9e5dfc10af452591a2484 (diff) |
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>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r-- | drivers/bluetooth/btusb.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index b82c0964dc54..35c967f5b9fc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -246,6 +246,7 @@ struct btusb_data { | |||
246 | struct usb_endpoint_descriptor *isoc_rx_ep; | 246 | struct usb_endpoint_descriptor *isoc_rx_ep; |
247 | 247 | ||
248 | __u8 cmdreq_type; | 248 | __u8 cmdreq_type; |
249 | unsigned long driver_info; | ||
249 | 250 | ||
250 | unsigned int sco_num; | 251 | unsigned int sco_num; |
251 | int isoc_altsetting; | 252 | int isoc_altsetting; |
@@ -699,6 +700,26 @@ static int btusb_flush(struct hci_dev *hdev) | |||
699 | return 0; | 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 | static int btusb_send_frame(struct sk_buff *skb) | 723 | static int btusb_send_frame(struct sk_buff *skb) |
703 | { | 724 | { |
704 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 725 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
@@ -996,6 +1017,7 @@ static int btusb_probe(struct usb_interface *intf, | |||
996 | return -ENODEV; | 1017 | return -ENODEV; |
997 | 1018 | ||
998 | data->cmdreq_type = USB_TYPE_CLASS; | 1019 | data->cmdreq_type = USB_TYPE_CLASS; |
1020 | data->driver_info = id->driver_info; | ||
999 | 1021 | ||
1000 | data->udev = interface_to_usbdev(intf); | 1022 | data->udev = interface_to_usbdev(intf); |
1001 | data->intf = intf; | 1023 | data->intf = intf; |
@@ -1026,6 +1048,7 @@ static int btusb_probe(struct usb_interface *intf, | |||
1026 | hdev->open = btusb_open; | 1048 | hdev->open = btusb_open; |
1027 | hdev->close = btusb_close; | 1049 | hdev->close = btusb_close; |
1028 | hdev->flush = btusb_flush; | 1050 | hdev->flush = btusb_flush; |
1051 | hdev->setup = btusb_setup; | ||
1029 | hdev->send = btusb_send_frame; | 1052 | hdev->send = btusb_send_frame; |
1030 | hdev->notify = btusb_notify; | 1053 | hdev->notify = btusb_notify; |
1031 | 1054 | ||
@@ -1066,17 +1089,6 @@ static int btusb_probe(struct usb_interface *intf, | |||
1066 | data->isoc = NULL; | 1089 | data->isoc = NULL; |
1067 | } | 1090 | } |
1068 | 1091 | ||
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 | } | ||
1079 | |||
1080 | if (data->isoc) { | 1092 | if (data->isoc) { |
1081 | err = usb_driver_claim_interface(&btusb_driver, | 1093 | err = usb_driver_claim_interface(&btusb_driver, |
1082 | data->isoc, data); | 1094 | data->isoc, data); |