Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v5 1/2] Bluetooth: btusb: use usb vid/pid for initializing hal callbacks
@ 2020-10-03  8:02 Kiran K
  2020-10-03  8:02 ` [PATCH v5 2/2] Bluetooth: btintel: Add *setup* function for new generation Intel controllers Kiran K
  2020-10-03  8:27 ` [PATCH v5 1/2] Bluetooth: btusb: use usb vid/pid for initializing hal callbacks Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Kiran K @ 2020-10-03  8:02 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: sathish.narasimman, chethan.tumkur.narayan, ravishankar.srivatsa,
	kiraank, Kiran K

For Intel controllers, use vid/pid for initalizing hardware abstraction
layer callbacks to avoid defining new quirk flags for new products.

Signed-off-by: Kiran K <kiran.k@intel.com>
---
Changes in v5:
* Use usb vid/pid combination to identify controller type istead of using flags

Changes in previous versions:
None. This is a new patch created part of v5

 drivers/bluetooth/btusb.c | 79 ++++++++++++++++++++++++++++-------------------
 1 file changed, 48 insertions(+), 31 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 1005b6e..e2cd78d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3969,13 +3969,21 @@ static int btusb_probe(struct usb_interface *intf,
 	init_usb_anchor(&data->ctrl_anchor);
 	spin_lock_init(&data->rxlock);
 
-	if (id->driver_info & BTUSB_INTEL_NEW) {
-		data->recv_event = btusb_recv_event_intel;
-		data->recv_bulk = btusb_recv_bulk_intel;
-		set_bit(BTUSB_BOOTLOADER, &data->flags);
-	} else {
-		data->recv_event = hci_recv_frame;
-		data->recv_bulk = btusb_recv_bulk;
+	data->recv_event = hci_recv_frame;
+	data->recv_bulk = btusb_recv_bulk;
+
+	if (id->idVendor == 0x8087) {
+		switch (id->idProduct) {
+		case 0x0025:
+		case 0x0026:
+		case 0x0029:
+		case 0x0a2b:
+		case 0x0aaa:
+			data->recv_event = btusb_recv_event_intel;
+			data->recv_bulk = btusb_recv_bulk_intel;
+			set_bit(BTUSB_BOOTLOADER, &data->flags);
+			break;
+		}
 	}
 
 	hdev = hci_alloc_dev();
@@ -4052,30 +4060,39 @@ static int btusb_probe(struct usb_interface *intf,
 		data->diag = usb_ifnum_to_if(data->udev, ifnum_base + 2);
 	}
 
-	if (id->driver_info & BTUSB_INTEL) {
-		hdev->manufacturer = 2;
-		hdev->setup = btusb_setup_intel;
-		hdev->shutdown = btusb_shutdown_intel;
-		hdev->set_diag = btintel_set_diag_mfg;
-		hdev->set_bdaddr = btintel_set_bdaddr;
-		hdev->cmd_timeout = btusb_intel_cmd_timeout;
-		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
-		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
-		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
-	}
-
-	if (id->driver_info & BTUSB_INTEL_NEW) {
-		hdev->manufacturer = 2;
-		hdev->send = btusb_send_frame_intel;
-		hdev->setup = btusb_setup_intel_new;
-		hdev->shutdown = btusb_shutdown_intel_new;
-		hdev->hw_error = btintel_hw_error;
-		hdev->set_diag = btintel_set_diag;
-		hdev->set_bdaddr = btintel_set_bdaddr;
-		hdev->cmd_timeout = btusb_intel_cmd_timeout;
-		set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
-		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
-		set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
+	if (id->idVendor == 0x8087) {
+		switch (id->idProduct) {
+		case 0x07dc:
+		case 0x0a2a:
+		case 0x0aa7:
+			hdev->manufacturer = 2;
+			hdev->setup = btusb_setup_intel;
+			hdev->shutdown = btusb_shutdown_intel;
+			hdev->set_diag = btintel_set_diag_mfg;
+			hdev->set_bdaddr = btintel_set_bdaddr;
+			hdev->cmd_timeout = btusb_intel_cmd_timeout;
+			set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
+			set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
+			set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
+			break;
+		case 0x0025:
+		case 0x0026:
+		case 0x0029:
+		case 0x0a2b:
+		case 0x0aaa:
+			hdev->manufacturer = 2;
+			hdev->send = btusb_send_frame_intel;
+			hdev->setup = btusb_setup_intel_new;
+			hdev->shutdown = btusb_shutdown_intel_new;
+			hdev->hw_error = btintel_hw_error;
+			hdev->set_diag = btintel_set_diag;
+			hdev->set_bdaddr = btintel_set_bdaddr;
+			hdev->cmd_timeout = btusb_intel_cmd_timeout;
+			set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
+			set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
+			set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
+			break;
+		}
 	}
 
 	if (id->driver_info & BTUSB_MARVELL)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-03 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-03  8:02 [PATCH v5 1/2] Bluetooth: btusb: use usb vid/pid for initializing hal callbacks Kiran K
2020-10-03  8:02 ` [PATCH v5 2/2] Bluetooth: btintel: Add *setup* function for new generation Intel controllers Kiran K
2020-10-03  8:27 ` [PATCH v5 1/2] Bluetooth: btusb: use usb vid/pid for initializing hal callbacks Marcel Holtmann
2020-10-03 13:17   ` K, Kiran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox