Linux-Bluetooth Archive on lore.kernel.org
 help / Atom feed
* [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029
@ 2018-11-27 11:09 raghuram.hegde
  2018-12-18 23:41 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: raghuram.hegde @ 2018-11-27 11:09 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Raghuram Hegde, Chethan T N

From: Raghuram Hegde <raghuram.hegde@intel.com>

Include the new USB product ID for Intel Bluetooth device 22260
family(CcPeak)

The /sys/kernel/debug/usb/devices portion for this device is:

T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=8087 ProdID=0029 Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms

Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
---
 drivers/bluetooth/btusb.c | 83 +++++++++++++++++++++++++++--------------------
 1 file changed, 48 insertions(+), 35 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7439a7eb50ac..14931cf7afd4 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -344,6 +344,7 @@ static const struct usb_device_id blacklist_table[] = {
 	/* Intel Bluetooth devices */
 	{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW },
 	{ USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW },
+	{ USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW },
 	{ USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
 	{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
 	{ USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL },
@@ -2055,6 +2056,46 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
 	return -EILSEQ;
 }
 
+static int btusb_setup_intel_new_get_fw_name(struct intel_version *ver,
+					     struct intel_boot_params *params,
+					     char *fw_name, size_t len,
+					     bool is_sfi)
+{
+	switch (ver->hw_variant) {
+	case 0x0b:	/* SfP */
+	case 0x0c:	/* WsP */
+		if (is_sfi) {
+			snprintf(fw_name, len, "intel/ibt-%u-%u.sfi",
+				le16_to_cpu(ver->hw_variant),
+				le16_to_cpu(params->dev_revid));
+		} else {
+			snprintf(fw_name, len, "intel/ibt-%u-%u.ddc",
+				le16_to_cpu(ver->hw_variant),
+				le16_to_cpu(params->dev_revid));
+		}
+		break;
+	case 0x11:	/* JfP */
+	case 0x12:	/* ThP */
+	case 0x13:	/* HrP */
+	case 0x14:	/* CcP */
+		if (is_sfi) {
+			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.sfi",
+				le16_to_cpu(ver->hw_variant),
+				le16_to_cpu(ver->hw_revision),
+				le16_to_cpu(ver->fw_revision));
+		} else {
+			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.ddc",
+				le16_to_cpu(ver->hw_variant),
+				le16_to_cpu(ver->hw_revision),
+				le16_to_cpu(ver->fw_revision));
+		}
+		break;
+	default:
+		return -1;
+	}
+	return 0;
+}
+
 static int btusb_setup_intel_new(struct hci_dev *hdev)
 {
 	struct btusb_data *data = hci_get_drvdata(hdev);
@@ -2106,7 +2147,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	case 0x11:	/* JfP */
 	case 0x12:	/* ThP */
 	case 0x13:	/* HrP */
-	case 0x14:	/* QnJ, IcP */
+	case 0x14:	/* CcP */
 		break;
 	default:
 		bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
@@ -2190,23 +2231,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
 	 *
 	 */
-	switch (ver.hw_variant) {
-	case 0x0b:	/* SfP */
-	case 0x0c:	/* WsP */
-		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",
-			 le16_to_cpu(ver.hw_variant),
-			 le16_to_cpu(params.dev_revid));
-		break;
-	case 0x11:	/* JfP */
-	case 0x12:	/* ThP */
-	case 0x13:	/* HrP */
-	case 0x14:	/* QnJ, IcP */
-		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi",
-			 le16_to_cpu(ver.hw_variant),
-			 le16_to_cpu(ver.hw_revision),
-			 le16_to_cpu(ver.fw_revision));
-		break;
-	default:
+	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
+						sizeof(fwname), true);
+	if (err < 0) {
 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
 		return -EINVAL;
 	}
@@ -2222,23 +2249,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	/* Save the DDC file name for later use to apply once the firmware
 	 * downloading is done.
 	 */
-	switch (ver.hw_variant) {
-	case 0x0b:	/* SfP */
-	case 0x0c:	/* WsP */
-		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",
-			 le16_to_cpu(ver.hw_variant),
-			 le16_to_cpu(params.dev_revid));
-		break;
-	case 0x11:	/* JfP */
-	case 0x12:	/* ThP */
-	case 0x13:	/* HrP */
-	case 0x14:	/* QnJ, IcP */
-		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc",
-			 le16_to_cpu(ver.hw_variant),
-			 le16_to_cpu(ver.hw_revision),
-			 le16_to_cpu(ver.fw_revision));
-		break;
-	default:
+	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
+						sizeof(fwname), false);
+	if (err < 0) {
 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
 		return -EINVAL;
 	}
-- 
2.7.4


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

* Re: [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029
  2018-11-27 11:09 [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029 raghuram.hegde
@ 2018-12-18 23:41 ` Marcel Holtmann
  2018-12-19  6:08   ` Hegde, Raghuram
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2018-12-18 23:41 UTC (permalink / raw)
  To: Raghuram Hegde; +Cc: linux-bluetooth, Chethan T N

Hi Raghuram,

> Include the new USB product ID for Intel Bluetooth device 22260
> family(CcPeak)
> 
> The /sys/kernel/debug/usb/devices portion for this device is:
> 
> T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  2 Spd=12   MxCh= 0
> D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
> P:  Vendor=8087 ProdID=0029 Rev= 0.01
> C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
> I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
> I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
> I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
> I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
> I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
> I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
> 
> Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
> Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
> ---
> drivers/bluetooth/btusb.c | 83 +++++++++++++++++++++++++++--------------------
> 1 file changed, 48 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 7439a7eb50ac..14931cf7afd4 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -344,6 +344,7 @@ static const struct usb_device_id blacklist_table[] = {
> 	/* Intel Bluetooth devices */
> 	{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW },
> 	{ USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW },
> +	{ USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW },
> 	{ USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
> 	{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
> 	{ USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL },
> @@ -2055,6 +2056,46 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
> 	return -EILSEQ;
> }
> 
> +static int btusb_setup_intel_new_get_fw_name(struct intel_version *ver,
> +					     struct intel_boot_params *params,
> +					     char *fw_name, size_t len,
> +					     bool is_sfi)
> +{
> +	switch (ver->hw_variant) {
> +	case 0x0b:	/* SfP */
> +	case 0x0c:	/* WsP */
> +		if (is_sfi) {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u.sfi",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(params->dev_revid));
> +		} else {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u.ddc",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(params->dev_revid));
> +		}
> +		break;
> +	case 0x11:	/* JfP */
> +	case 0x12:	/* ThP */
> +	case 0x13:	/* HrP */
> +	case 0x14:	/* CcP */
> +		if (is_sfi) {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.sfi",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(ver->hw_revision),
> +				le16_to_cpu(ver->fw_revision));
> +		} else {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.ddc",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(ver->hw_revision),
> +				le16_to_cpu(ver->fw_revision));
> +		}
> +		break;
> +	default:
> +		return -1;
> +	}
> +	return 0;
> +}

can we just make this bool and return either false or true.

The is_sfi part is useless to me. Just allow providing the suffix as const char *suffix into this function.

> +
> static int btusb_setup_intel_new(struct hci_dev *hdev)
> {
> 	struct btusb_data *data = hci_get_drvdata(hdev);
> @@ -2106,7 +2147,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	case 0x11:	/* JfP */
> 	case 0x12:	/* ThP */
> 	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> +	case 0x14:	/* CcP */
> 		break;
> 	default:
> 		bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
> @@ -2190,23 +2231,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
> 	 *
> 	 */
> -	switch (ver.hw_variant) {
> -	case 0x0b:	/* SfP */
> -	case 0x0c:	/* WsP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(params.dev_revid));
> -		break;
> -	case 0x11:	/* JfP */
> -	case 0x12:	/* ThP */
> -	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(ver.hw_revision),
> -			 le16_to_cpu(ver.fw_revision));
> -		break;
> -	default:
> +	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
> +						sizeof(fwname), true);
> +	if (err < 0) {
> 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
> 		return -EINVAL;
> 	}
> @@ -2222,23 +2249,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	/* Save the DDC file name for later use to apply once the firmware
> 	 * downloading is done.
> 	 */
> -	switch (ver.hw_variant) {
> -	case 0x0b:	/* SfP */
> -	case 0x0c:	/* WsP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(params.dev_revid));
> -		break;
> -	case 0x11:	/* JfP */
> -	case 0x12:	/* ThP */
> -	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(ver.hw_revision),
> -			 le16_to_cpu(ver.fw_revision));
> -		break;
> -	default:
> +	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
> +						sizeof(fwname), false);
> +	if (err < 0) {
> 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
> 		return -EINVAL;
> 	}

Regards

Marcel


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

* RE: [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029
  2018-12-18 23:41 ` Marcel Holtmann
@ 2018-12-19  6:08   ` Hegde, Raghuram
  0 siblings, 0 replies; 3+ messages in thread
From: Hegde, Raghuram @ 2018-12-19  6:08 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth, Tumkur Narayan, Chethan

Ack.
Will do the changes and submit new patch

Thanks
Raghuram

-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org] 
Sent: Wednesday, December 19, 2018 5:11 AM
To: Hegde, Raghuram <raghuram.hegde@intel.com>
Cc: linux-bluetooth@vger.kernel.org; Tumkur Narayan, Chethan <chethan.tumkur.narayan@intel.com>
Subject: Re: [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029

Hi Raghuram,

> Include the new USB product ID for Intel Bluetooth device 22260
> family(CcPeak)
> 
> The /sys/kernel/debug/usb/devices portion for this device is:
> 
> T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  2 Spd=12   MxCh= 0
> D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
> P:  Vendor=8087 ProdID=0029 Rev= 0.01
> C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
> I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
> E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
> I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
> I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
> I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
> I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
> I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
> I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
> I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
> E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
> E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
> 
> Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
> Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
> ---
> drivers/bluetooth/btusb.c | 83 
> +++++++++++++++++++++++++++--------------------
> 1 file changed, 48 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c 
> index 7439a7eb50ac..14931cf7afd4 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -344,6 +344,7 @@ static const struct usb_device_id blacklist_table[] = {
> 	/* Intel Bluetooth devices */
> 	{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW },
> 	{ USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_NEW },
> +	{ USB_DEVICE(0x8087, 0x0029), .driver_info = BTUSB_INTEL_NEW },
> 	{ USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
> 	{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL },
> 	{ USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, @@ 
> -2055,6 +2056,46 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
> 	return -EILSEQ;
> }
> 
> +static int btusb_setup_intel_new_get_fw_name(struct intel_version *ver,
> +					     struct intel_boot_params *params,
> +					     char *fw_name, size_t len,
> +					     bool is_sfi)
> +{
> +	switch (ver->hw_variant) {
> +	case 0x0b:	/* SfP */
> +	case 0x0c:	/* WsP */
> +		if (is_sfi) {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u.sfi",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(params->dev_revid));
> +		} else {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u.ddc",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(params->dev_revid));
> +		}
> +		break;
> +	case 0x11:	/* JfP */
> +	case 0x12:	/* ThP */
> +	case 0x13:	/* HrP */
> +	case 0x14:	/* CcP */
> +		if (is_sfi) {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.sfi",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(ver->hw_revision),
> +				le16_to_cpu(ver->fw_revision));
> +		} else {
> +			snprintf(fw_name, len, "intel/ibt-%u-%u-%u.ddc",
> +				le16_to_cpu(ver->hw_variant),
> +				le16_to_cpu(ver->hw_revision),
> +				le16_to_cpu(ver->fw_revision));
> +		}
> +		break;
> +	default:
> +		return -1;
> +	}
> +	return 0;
> +}

can we just make this bool and return either false or true.

The is_sfi part is useless to me. Just allow providing the suffix as const char *suffix into this function.

> +
> static int btusb_setup_intel_new(struct hci_dev *hdev) {
> 	struct btusb_data *data = hci_get_drvdata(hdev); @@ -2106,7 +2147,7 
> @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	case 0x11:	/* JfP */
> 	case 0x12:	/* ThP */
> 	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> +	case 0x14:	/* CcP */
> 		break;
> 	default:
> 		bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", @@ 
> -2190,23 +2231,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
> 	 *
> 	 */
> -	switch (ver.hw_variant) {
> -	case 0x0b:	/* SfP */
> -	case 0x0c:	/* WsP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.sfi",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(params.dev_revid));
> -		break;
> -	case 0x11:	/* JfP */
> -	case 0x12:	/* ThP */
> -	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.sfi",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(ver.hw_revision),
> -			 le16_to_cpu(ver.fw_revision));
> -		break;
> -	default:
> +	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
> +						sizeof(fwname), true);
> +	if (err < 0) {
> 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
> 		return -EINVAL;
> 	}
> @@ -2222,23 +2249,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
> 	/* Save the DDC file name for later use to apply once the firmware
> 	 * downloading is done.
> 	 */
> -	switch (ver.hw_variant) {
> -	case 0x0b:	/* SfP */
> -	case 0x0c:	/* WsP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u.ddc",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(params.dev_revid));
> -		break;
> -	case 0x11:	/* JfP */
> -	case 0x12:	/* ThP */
> -	case 0x13:	/* HrP */
> -	case 0x14:	/* QnJ, IcP */
> -		snprintf(fwname, sizeof(fwname), "intel/ibt-%u-%u-%u.ddc",
> -			 le16_to_cpu(ver.hw_variant),
> -			 le16_to_cpu(ver.hw_revision),
> -			 le16_to_cpu(ver.fw_revision));
> -		break;
> -	default:
> +	err = btusb_setup_intel_new_get_fw_name(&ver, &params, fwname,
> +						sizeof(fwname), false);
> +	if (err < 0) {
> 		bt_dev_err(hdev, "Unsupported Intel firmware naming");
> 		return -EINVAL;
> 	}

Regards

Marcel


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 11:09 [Patch v1] Bluetooth: btusb: Add support for Intel bluetooth device 8087:0029 raghuram.hegde
2018-12-18 23:41 ` Marcel Holtmann
2018-12-19  6:08   ` Hegde, Raghuram

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox