linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: Apply Intel device configuration routine
@ 2015-05-08 10:59 Tedd Ho-Jeong An
  2015-05-09 11:17 ` Tedd Ho-Jeong An
  2015-05-12 15:05 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2015-05-08 10:59 UTC (permalink / raw)
  To: BlueZ development; +Cc: Johan Hedberg, Marcel Holtmann, tedd.an

From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch adds support to apply the device configuration parameters
(DDC) after firwmare downloading on Intel 8265 device.

This is optional configuration parameters and good to have.
So, even if it fails to apply it, it is not necessary to fail the
setup.

The file format is same as previous firmware patch (.bseq) and
this is only applicable to Intel 8265 device.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
---
 drivers/bluetooth/btusb.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index d21f3b4..27cd2bf 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2644,6 +2644,40 @@ done:
 
 	clear_bit(BTUSB_BOOTLOADER, &data->flags);
 
+	/* Once the device is running in operational mode, it needs to apply
+	 * the configuration parameters to the device.
+	 */
+	snprintf(fwname, sizeof(fwname), "intel/ibt-11.bseq");
+
+	/* Device can work without this configuration so even if it fails
+	 * to load the file, no need to fail the setup
+	 */
+	err = request_firmware_direct(&fw, fwname, &hdev->dev);
+	if (err < 0) {
+		BT_INFO("%s: WARNING: unable to load configuration file (%d)",
+			hdev->name, err);
+		return 0;
+	}
+
+	BT_INFO("%s: Found device configuration file: %s", hdev->name, fwname);
+
+	fw_ptr = fw->data;
+	while (fw->size > fw_ptr - fw->data) {
+		int ignore;
+
+		err = btusb_setup_intel_patching(hdev, fw, &fw_ptr,
+						 &ignore);
+		if (err < 0) {
+			BT_INFO("%s: WARNING: failed to send configuration(%d)",
+				hdev->name, err);
+			release_firmware(fw);
+			return 0;
+		}
+	}
+	release_firmware(fw);
+
+	BT_INFO("%s: Device configuration completed", hdev->name);
+
 	return 0;
 }
 
-- 
2.1.0


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

* Re: [PATCH] Bluetooth: btusb: Apply Intel device configuration routine
  2015-05-08 10:59 [PATCH] Bluetooth: btusb: Apply Intel device configuration routine Tedd Ho-Jeong An
@ 2015-05-09 11:17 ` Tedd Ho-Jeong An
  2015-05-12 15:05 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2015-05-09 11:17 UTC (permalink / raw)
  To: BlueZ development; +Cc: Johan Hedberg, Marcel Holtmann

Hi Marcel,

I just wonder if you had a chance to review this pacth.

Let me know if you have any comments.

Regards,
Tedd

On Fri, 8 May 2015 03:59:46 -0700
Tedd Ho-Jeong An <tedd.an@intel.com> wrote:

> From: Tedd Ho-Jeong An <tedd.an@intel.com>
> 
> This patch adds support to apply the device configuration parameters
> (DDC) after firwmare downloading on Intel 8265 device.
> 
> This is optional configuration parameters and good to have.
> So, even if it fails to apply it, it is not necessary to fail the
> setup.
> 
> The file format is same as previous firmware patch (.bseq) and
> this is only applicable to Intel 8265 device.
> 
> Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
> ---
>  drivers/bluetooth/btusb.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index d21f3b4..27cd2bf 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2644,6 +2644,40 @@ done:
>  
>  	clear_bit(BTUSB_BOOTLOADER, &data->flags);
>  
> +	/* Once the device is running in operational mode, it needs to apply
> +	 * the configuration parameters to the device.
> +	 */
> +	snprintf(fwname, sizeof(fwname), "intel/ibt-11.bseq");
> +
> +	/* Device can work without this configuration so even if it fails
> +	 * to load the file, no need to fail the setup
> +	 */
> +	err = request_firmware_direct(&fw, fwname, &hdev->dev);
> +	if (err < 0) {
> +		BT_INFO("%s: WARNING: unable to load configuration file (%d)",
> +			hdev->name, err);
> +		return 0;
> +	}
> +
> +	BT_INFO("%s: Found device configuration file: %s", hdev->name, fwname);
> +
> +	fw_ptr = fw->data;
> +	while (fw->size > fw_ptr - fw->data) {
> +		int ignore;
> +
> +		err = btusb_setup_intel_patching(hdev, fw, &fw_ptr,
> +						 &ignore);
> +		if (err < 0) {
> +			BT_INFO("%s: WARNING: failed to send configuration(%d)",
> +				hdev->name, err);
> +			release_firmware(fw);
> +			return 0;
> +		}
> +	}
> +	release_firmware(fw);
> +
> +	BT_INFO("%s: Device configuration completed", hdev->name);
> +
>  	return 0;
>  }
>  

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

* Re: [PATCH] Bluetooth: btusb: Apply Intel device configuration routine
  2015-05-12 15:05 ` Marcel Holtmann
@ 2015-05-09 13:50   ` Tedd Ho-Jeong An
  0 siblings, 0 replies; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2015-05-09 13:50 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ development, Johan Hedberg

Hi Marcel,

On Tue, 12 May 2015 17:05:21 +0200
Marcel Holtmann <marcel@holtmann.org> wrote:

> Hi Tedd,
> 
> > This patch adds support to apply the device configuration parameters
> > (DDC) after firwmare downloading on Intel 8265 device.
> > 
> > This is optional configuration parameters and good to have.
> > So, even if it fails to apply it, it is not necessary to fail the
> > setup.
> > 
> > The file format is same as previous firmware patch (.bseq) and
> > this is only applicable to Intel 8265 device.
> 
> my preference is actually to not use *.bseq files since they are generic HCI commands. We want to use a new *.ddc file format that just contains the parameters. I clearly prefer that over just sending HCI commands. What we have to do is to actually define a simple DDC file format that lets us include the key/param pairs.
> 

HCI command in .bseq is pretty simple to decode so extracting DDC contents (key/parmas) will not be a problem.
For DDC file, I think the simplest is [len] [key] [params] [len] [key] [params] ... in binary. So, the driver simpley read the full data and send with Intel_DDC_Write function.

Let me know if you have anything in your mind or any example in the other driver that I can refer.

> Regards
> 
> Marcel
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Bluetooth: btusb: Apply Intel device configuration routine
  2015-05-08 10:59 [PATCH] Bluetooth: btusb: Apply Intel device configuration routine Tedd Ho-Jeong An
  2015-05-09 11:17 ` Tedd Ho-Jeong An
@ 2015-05-12 15:05 ` Marcel Holtmann
  2015-05-09 13:50   ` Tedd Ho-Jeong An
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2015-05-12 15:05 UTC (permalink / raw)
  To: Tedd Ho-Jeong An; +Cc: BlueZ development, Johan Hedberg

Hi Tedd,

> This patch adds support to apply the device configuration parameters
> (DDC) after firwmare downloading on Intel 8265 device.
> 
> This is optional configuration parameters and good to have.
> So, even if it fails to apply it, it is not necessary to fail the
> setup.
> 
> The file format is same as previous firmware patch (.bseq) and
> this is only applicable to Intel 8265 device.

my preference is actually to not use *.bseq files since they are generic HCI commands. We want to use a new *.ddc file format that just contains the parameters. I clearly prefer that over just sending HCI commands. What we have to do is to actually define a simple DDC file format that lets us include the key/param pairs.

Regards

Marcel


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

end of thread, other threads:[~2015-05-12 15:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 10:59 [PATCH] Bluetooth: btusb: Apply Intel device configuration routine Tedd Ho-Jeong An
2015-05-09 11:17 ` Tedd Ho-Jeong An
2015-05-12 15:05 ` Marcel Holtmann
2015-05-09 13:50   ` Tedd Ho-Jeong An

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).