2015-11-27 18:55:59

by Loic Poulain

[permalink] [raw]
Subject: [PATCH 1/5] Bluetooth: hci_intel: Use shorter timeout for HCI commands

Use the standard HCI_CMD_TIMEOUT(1s) for HCI command instead of
HCI_INIT_TIMEOUT(10s) which is not justified in these cases.

Signed-off-by: Loic Poulain <[email protected]>
---
drivers/bluetooth/hci_intel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 69760e2..3c28c4a 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -502,7 +502,7 @@ static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed)
/* Device will not accept speed change if Intel version has not been
* previously requested.
*/
- skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT);
+ skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_CMD_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
PTR_ERR(skb));
@@ -590,7 +590,7 @@ static int intel_setup(struct hci_uart *hu)
* is in bootloader mode or if it already has operational firmware
* loaded.
*/
- skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT);
+ skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_CMD_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
PTR_ERR(skb));
@@ -671,7 +671,7 @@ static int intel_setup(struct hci_uart *hu)
/* Read the secure boot parameters to identify the operating
* details of the bootloader.
*/
- skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_INIT_TIMEOUT);
+ skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_CMD_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Reading Intel boot parameters failed (%ld)",
PTR_ERR(skb));
@@ -881,7 +881,7 @@ done:
set_bit(STATE_BOOTING, &intel->flags);

skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param,
- HCI_INIT_TIMEOUT);
+ HCI_CMD_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);

--
1.9.1


2015-11-27 18:56:03

by Loic Poulain

[permalink] [raw]
Subject: [PATCH 5/5] bluetooth: hci_intel: Add LhP support

Add Support for LhP(IBT-2.1) Intel controller.
This controller requests bddata configuration before being able to
work properly. The setup is done in manufacturing mode.

Signed-off-by: Loic Poulain <[email protected]>
---
drivers/bluetooth/hci_intel.c | 70 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 95bc57c..7314d37 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -888,6 +888,64 @@ no_lpm:
return 0;
}

+static int intel_setup_lhp(struct hci_uart *hu, struct intel_version *ver)
+{
+ static const u8 mfg_enable[] = { 0x01, 0x00 };
+ static const u8 mfg_reset_deactivate[] = { 0x00, 0x01 };
+ const struct firmware *fw;
+ char fwname[32];
+ const u8 *fw_ptr;
+ struct hci_dev *hdev = hu->hdev;
+ struct sk_buff *skb;
+ int err;
+
+ skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_enable), mfg_enable,
+ HCI_CMD_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Enabling manufacturer mode failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+ kfree_skb(skb);
+
+ bt_dev_info(hdev, "Applying bddata");
+
+ snprintf(fwname, sizeof(fwname), "intel/ibt-10-%u.bddata",
+ ver->hw_revision);
+
+ err = request_firmware(&fw, fwname, &hdev->dev);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to load Intel bddata file %s (%d)",
+ fwname, err);
+ return PTR_ERR(skb);
+ }
+
+ fw_ptr = fw->data;
+
+ skb = __hci_cmd_sync(hdev, 0xfc2f, fw->size, fw->data, HCI_CMD_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Applying bddata failed (%ld)", PTR_ERR(skb));
+ release_firmware(fw);
+ return PTR_ERR(skb);
+ }
+ kfree_skb(skb);
+
+ release_firmware(fw);
+
+ /* Disable the manufacturer mode, reset, deactivate fw patched version.
+ */
+ skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_reset_deactivate),
+ mfg_reset_deactivate, HCI_CMD_TIMEOUT);
+ if (IS_ERR(skb)) {
+ BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
+ hdev->name, PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+ kfree_skb(skb);
+
+ return 0;
+}
+
static int intel_setup(struct hci_uart *hu)
{
static const u8 mfg_enable[] = { 0x01, 0x00 };
@@ -975,6 +1033,9 @@ setup:
case 0x0b:
err = intel_setup_lnp(hu, ver);
break;
+ case 0x0a:
+ err = intel_setup_lhp(hu, ver);
+ break;
default:
bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
ver->hw_variant);
@@ -1040,6 +1101,15 @@ static int intel_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
bt_dev_err(hdev, "Controller requests manufacturing");
set_bit(STATE_REQ_MANUFACTURING, &intel->flags);
inject_cmd_complete(hdev, 0xfc05, 0x01);
+
+ /* Instead of responding to bddata command with a command complete event
+ * LhP controller returns a command status event. In order to complete
+ * the ongoing bddata command generate a command complete event from
+ * the command status one.
+ */
+ } else if (skb->len >= 6 && hdr->evt == 0x0f && skb->data[4] == 0x2f &&
+ skb->data[5] == 0xfc) {
+ inject_cmd_complete(hdev, 0xfc2f, skb->data[2]);
}
recv:
return hci_recv_frame(hdev, skb);
--
1.9.1

2015-11-27 18:56:02

by Loic Poulain

[permalink] [raw]
Subject: [PATCH 4/5] Bluetooth: hci_intel: Enter manufacturing mode if requested

LhP controller only sends manufacturing error if not correctly
configured (after first boot), nothing else.
In order to avoid a read intel version command timeout due to missing
command complete event, inject the event with an error status.

Signed-off-by: Loic Poulain <[email protected]>
---
drivers/bluetooth/hci_intel.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 98beacb..95bc57c 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -49,6 +49,7 @@
#define STATE_TX_ACTIVE 6
#define STATE_SUSPENDED 7
#define STATE_LPM_TRANSACTION 8
+#define STATE_REQ_MANUFACTURING 9

#define HCI_LPM_WAKE_PKT 0xf0
#define HCI_LPM_PKT 0xf1
@@ -889,6 +890,7 @@ no_lpm:

static int intel_setup(struct hci_uart *hu)
{
+ static const u8 mfg_enable[] = { 0x01, 0x00 };
struct intel_data *intel = hu->priv;
struct hci_dev *hdev = hu->hdev;
struct sk_buff *skb;
@@ -911,6 +913,7 @@ static int intel_setup(struct hci_uart *hu)

set_bit(STATE_BOOTLOADER, &intel->flags);

+setup:
/* Read the Intel version information to determine if the device
* is in bootloader mode or if it already has operational firmware
* loaded.
@@ -919,6 +922,21 @@ static int intel_setup(struct hci_uart *hu)
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
PTR_ERR(skb));
+
+ /* Command has failed because controller requests manufacturing.
+ * Enable manufacturing mode and try again.
+ */
+ if (test_and_clear_bit(STATE_REQ_MANUFACTURING, &intel->flags)) {
+ bt_dev_info(hdev, "Enable Manufacturing and try again");
+
+ skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_enable),
+ mfg_enable, HCI_CMD_TIMEOUT);
+ if (!IS_ERR(skb)) {
+ kfree_skb(skb);
+ goto setup;
+ }
+ }
+
return PTR_ERR(skb);
}

@@ -1009,6 +1027,19 @@ static int intel_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
smp_mb__after_atomic();
wake_up_bit(&intel->flags, STATE_BOOTING);
}
+
+ /* After booting, the LhP controller requests manufacturing and does
+ * not respond to HCI command with a HCI command complete event but with
+ * a Intel manufacturing error event. In that case, inject the command
+ * complete event with manufacturing error as status. This should only
+ * happens with the read intel version cmd (0xfc05) which is always the
+ * first command sent to the controller.
+ */
+ } else if (skb->len >= 4 && hdr->evt == 0xff && hdr->plen >= 2 &&
+ skb->data[2] == 0x05 && skb->data[3] == 0x02) {
+ bt_dev_err(hdev, "Controller requests manufacturing");
+ set_bit(STATE_REQ_MANUFACTURING, &intel->flags);
+ inject_cmd_complete(hdev, 0xfc05, 0x01);
}
recv:
return hci_recv_frame(hdev, skb);
--
1.9.1

2015-11-27 18:56:01

by Loic Poulain

[permalink] [raw]
Subject: [PATCH 3/5] Bluetooth: hci_intel: Add status parameter to inject_cmd_complete

Add possibility to pass a status/error code to the injected command
complete event.

Signed-off-by: Loic Poulain <[email protected]>
---
drivers/bluetooth/hci_intel.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 2dcf9b0..98beacb 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -447,7 +447,7 @@ static int intel_flush(struct hci_uart *hu)
return 0;
}

-static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
+static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode, __u8 status)
{
struct sk_buff *skb;
struct hci_event_hdr *hdr;
@@ -465,7 +465,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
evt->ncmd = 0x01;
evt->opcode = cpu_to_le16(opcode);

- *skb_put(skb, 1) = 0x00;
+ *skb_put(skb, 1) = status;

hci_skb_pkt_type(skb) = HCI_EVENT_PKT;

@@ -1150,7 +1150,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
* control working inject that event here.
*/
if (opcode == 0xfc01)
- inject_cmd_complete(hu->hdev, opcode);
+ inject_cmd_complete(hu->hdev, opcode, 0x00);
}

/* Prepend skb with frame type */
--
1.9.1

2015-11-27 18:56:00

by Loic Poulain

[permalink] [raw]
Subject: [PATCH 2/5] Bluetooth: hci_intel: Split Intel setup procedure

In order to prepare support for other Intel controller variants, split
the Intel setup procedure into a generic init and a LnP(iBT 3.0)
specific one. The generic part consists mostly of reading the Intel
version and calling the specific setup accordingly.

Signed-off-by: Loic Poulain <[email protected]>
---
drivers/bluetooth/hci_intel.c | 154 +++++++++++++++++++++++-------------------
1 file changed, 84 insertions(+), 70 deletions(-)

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 3c28c4a..2dcf9b0 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -533,7 +533,7 @@ static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed)
return 0;
}

-static int intel_setup(struct hci_uart *hu)
+static int intel_setup_lnp(struct hci_uart *hu, struct intel_version *ver)
{
static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
0x00, 0x08, 0x04, 0x00 };
@@ -542,7 +542,6 @@ static int intel_setup(struct hci_uart *hu)
struct intel_device *idev = NULL;
struct hci_dev *hdev = hu->hdev;
struct sk_buff *skb;
- struct intel_version *ver;
struct intel_boot_params *params;
struct list_head *p;
const struct firmware *fw;
@@ -575,67 +574,6 @@ static int intel_setup(struct hci_uart *hu)
if (oper_speed && init_speed && oper_speed != init_speed)
speed_change = 1;

- /* Check that the controller is ready */
- err = intel_wait_booting(hu);
-
- clear_bit(STATE_BOOTING, &intel->flags);
-
- /* In case of timeout, try to continue anyway */
- if (err && err != ETIMEDOUT)
- return err;
-
- set_bit(STATE_BOOTLOADER, &intel->flags);
-
- /* Read the Intel version information to determine if the device
- * is in bootloader mode or if it already has operational firmware
- * loaded.
- */
- skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_CMD_TIMEOUT);
- if (IS_ERR(skb)) {
- bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
- PTR_ERR(skb));
- return PTR_ERR(skb);
- }
-
- if (skb->len != sizeof(*ver)) {
- bt_dev_err(hdev, "Intel version event size mismatch");
- kfree_skb(skb);
- return -EILSEQ;
- }
-
- ver = (struct intel_version *)skb->data;
- if (ver->status) {
- bt_dev_err(hdev, "Intel version command failure (%02x)",
- ver->status);
- err = -bt_to_errno(ver->status);
- kfree_skb(skb);
- return err;
- }
-
- /* The hardware platform number has a fixed value of 0x37 and
- * for now only accept this single value.
- */
- if (ver->hw_platform != 0x37) {
- bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)",
- ver->hw_platform);
- kfree_skb(skb);
- return -EINVAL;
- }
-
- /* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is
- * supported by this firmware loading method. This check has been
- * put in place to ensure correct forward compatibility options
- * when newer hardware variants come along.
- */
- if (ver->hw_variant != 0x0b) {
- bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
- ver->hw_variant);
- kfree_skb(skb);
- return -EINVAL;
- }
-
- btintel_version_info(hdev, ver);
-
/* The firmware variant determines if the device is in bootloader
* mode or is running operational firmware. The value 0x06 identifies
* the bootloader and the value 0x23 identifies the operational
@@ -650,8 +588,6 @@ static int intel_setup(struct hci_uart *hu)
* case since that command is only available in bootloader mode.
*/
if (ver->fw_variant == 0x23) {
- kfree_skb(skb);
- clear_bit(STATE_BOOTLOADER, &intel->flags);
btintel_check_bdaddr(hdev);
return 0;
}
@@ -662,12 +598,9 @@ static int intel_setup(struct hci_uart *hu)
if (ver->fw_variant != 0x06) {
bt_dev_err(hdev, "Unsupported Intel firmware variant (%u)",
ver->fw_variant);
- kfree_skb(skb);
return -ENODEV;
}

- kfree_skb(skb);
-
/* Read the secure boot parameters to identify the operating
* details of the bootloader.
*/
@@ -951,11 +884,92 @@ no_lpm:
return err;
}

- bt_dev_info(hdev, "Setup complete");
+ return 0;
+}

+static int intel_setup(struct hci_uart *hu)
+{
+ struct intel_data *intel = hu->priv;
+ struct hci_dev *hdev = hu->hdev;
+ struct sk_buff *skb;
+ struct intel_version *ver;
+ int err;
+
+ bt_dev_dbg(hdev, "start intel_setup");
+
+ hu->hdev->set_diag = btintel_set_diag;
+ hu->hdev->set_bdaddr = btintel_set_bdaddr;
+
+ /* Check that the controller is ready */
+ err = intel_wait_booting(hu);
+
+ clear_bit(STATE_BOOTING, &intel->flags);
+
+ /* In case of timeout, try to continue anyway */
+ if (err && err != ETIMEDOUT)
+ return err;
+
+ set_bit(STATE_BOOTLOADER, &intel->flags);
+
+ /* Read the Intel version information to determine if the device
+ * is in bootloader mode or if it already has operational firmware
+ * loaded.
+ */
+ skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_CMD_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+
+ if (skb->len != sizeof(*ver)) {
+ bt_dev_err(hdev, "Intel version event size mismatch");
+ err = -EILSEQ;
+ goto done;
+ }
+
+ ver = (struct intel_version *)skb->data;
+ if (ver->status) {
+ bt_dev_err(hdev, "Intel version command failure (%02x)",
+ ver->status);
+ err = -bt_to_errno(ver->status);
+ goto done;
+ }
+
+ /* The hardware platform number has a fixed value of 0x37 and
+ * for now only accept this single value.
+ */
+ if (ver->hw_platform != 0x37) {
+ bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)",
+ ver->hw_platform);
+ err = -EINVAL;
+ goto done;
+ }
+
+ btintel_version_info(hdev, ver);
+
+ /* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is
+ * supported by this firmware loading method. This check has been
+ * put in place to ensure correct forward compatibility options
+ * when newer hardware variants come along.
+ */
+ switch (ver->hw_variant) {
+ case 0x0b:
+ err = intel_setup_lnp(hu, ver);
+ break;
+ default:
+ bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
+ ver->hw_variant);
+ err = -EINVAL;
+ break;
+ }
+
+done:
+ kfree_skb(skb);
clear_bit(STATE_BOOTLOADER, &intel->flags);
+ bt_dev_info(hdev, "Setup complete (%d)", err);

- return 0;
+ return err;
}

static int intel_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
--
1.9.1

2015-12-02 07:59:00

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 5/5] bluetooth: hci_intel: Add LhP support

Hi Loic,

> Add Support for LhP(IBT-2.1) Intel controller.
> This controller requests bddata configuration before being able to
> work properly. The setup is done in manufacturing mode.
>
> Signed-off-by: Loic Poulain <[email protected]>
> ---
> drivers/bluetooth/hci_intel.c | 70 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
> index 95bc57c..7314d37 100644
> --- a/drivers/bluetooth/hci_intel.c
> +++ b/drivers/bluetooth/hci_intel.c
> @@ -888,6 +888,64 @@ no_lpm:
> return 0;
> }
>
> +static int intel_setup_lhp(struct hci_uart *hu, struct intel_version *ver)
> +{
> + static const u8 mfg_enable[] = { 0x01, 0x00 };
> + static const u8 mfg_reset_deactivate[] = { 0x00, 0x01 };
> + const struct firmware *fw;
> + char fwname[32];
> + const u8 *fw_ptr;
> + struct hci_dev *hdev = hu->hdev;
> + struct sk_buff *skb;
> + int err;
> +
> + skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_enable), mfg_enable,
> + HCI_CMD_TIMEOUT);
> + if (IS_ERR(skb)) {
> + bt_dev_err(hdev, "Enabling manufacturer mode failed (%ld)",
> + PTR_ERR(skb));
> + return PTR_ERR(skb);
> + }
> + kfree_skb(skb);
> +
> + bt_dev_info(hdev, "Applying bddata");
> +
> + snprintf(fwname, sizeof(fwname), "intel/ibt-10-%u.bddata",
> + ver->hw_revision);

I think we need to use a more detailed versioning name. It is a ROM chip and depending on its version, this might differ. This simple firmware names only work for LnP which are RAM chips.

> +
> + err = request_firmware(&fw, fwname, &hdev->dev);
> + if (err < 0) {
> + bt_dev_err(hdev, "Failed to load Intel bddata file %s (%d)",
> + fwname, err);
> + return PTR_ERR(skb);
> + }
> +
> + fw_ptr = fw->data;
> +
> + skb = __hci_cmd_sync(hdev, 0xfc2f, fw->size, fw->data, HCI_CMD_TIMEOUT);
> + if (IS_ERR(skb)) {
> + bt_dev_err(hdev, "Applying bddata failed (%ld)", PTR_ERR(skb));
> + release_firmware(fw);
> + return PTR_ERR(skb);
> + }
> + kfree_skb(skb);
> +
> + release_firmware(fw);
> +
> + /* Disable the manufacturer mode, reset, deactivate fw patched version.
> + */
> + skb = __hci_cmd_sync(hdev, 0xfc11, sizeof(mfg_reset_deactivate),
> + mfg_reset_deactivate, HCI_CMD_TIMEOUT);
> + if (IS_ERR(skb)) {
> + BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
> + hdev->name, PTR_ERR(skb));
> + return PTR_ERR(skb);
> + }
> + kfree_skb(skb);
> +
> + return 0;
> +}
> +
> static int intel_setup(struct hci_uart *hu)
> {
> static const u8 mfg_enable[] = { 0x01, 0x00 };
> @@ -975,6 +1033,9 @@ setup:
> case 0x0b:
> err = intel_setup_lnp(hu, ver);
> break;
> + case 0x0a:
> + err = intel_setup_lhp(hu, ver);
> + break;
> default:
> bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
> ver->hw_variant);
> @@ -1040,6 +1101,15 @@ static int intel_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
> bt_dev_err(hdev, "Controller requests manufacturing");
> set_bit(STATE_REQ_MANUFACTURING, &intel->flags);
> inject_cmd_complete(hdev, 0xfc05, 0x01);
> +
> + /* Instead of responding to bddata command with a command complete event
> + * LhP controller returns a command status event. In order to complete
> + * the ongoing bddata command generate a command complete event from
> + * the command status one.
> + */

What is wrong with using __hci_cmd_sync_ev for these cases?


> + } else if (skb->len >= 6 && hdr->evt == 0x0f && skb->data[4] == 0x2f &&
> + skb->data[5] == 0xfc) {
> + inject_cmd_complete(hdev, 0xfc2f, skb->data[2]);
> }
> recv:
> return hci_recv_frame(hdev, skb);

Regards

Marcel


2015-12-02 07:56:34

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 4/5] Bluetooth: hci_intel: Enter manufacturing mode if requested

Hi Loic,

> LhP controller only sends manufacturing error if not correctly
> configured (after first boot), nothing else.
> In order to avoid a read intel version command timeout due to missing
> command complete event, inject the event with an error status.

can we actually get the events that the controller sends. I think we either get a manufacturing error or a bootup event. Both can be taken as indicator that this is LhP and not LnP.

If this turns into something too complicated, we might just create a hci_ag6xx.c and treat this as a separate driver for yet another part of Intel hardware. Or another alternative is to add a HCIUARTSETOPTS or HCIUARTSETVNDFLAGS or similar to allow for driver specific flags.

Entering manufacturer mode is suppose to be no op for LnP for backwards compatible reasons. Leaving the manufacturer mode will fail on LnP. So we could just send that command no matter what. However I remember that LnP really wants a Intel Read Version command first. At least with some bootloader versions.

Regards

Marcel


2015-12-02 07:48:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH 1/5] Bluetooth: hci_intel: Use shorter timeout for HCI commands

Hi Loic,

> Use the standard HCI_CMD_TIMEOUT(1s) for HCI command instead of
> HCI_INIT_TIMEOUT(10s) which is not justified in these cases.
>
> Signed-off-by: Loic Poulain <[email protected]>
> ---
> drivers/bluetooth/hci_intel.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel