linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@intel.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>, linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v4 1/2] Bluetooth: hci_intel: Add Intel baudrate configuration support
Date: Tue, 25 Aug 2015 17:21:15 +0200	[thread overview]
Message-ID: <55DC87EB.2050104@intel.com> (raw)
In-Reply-To: <FC07D45C-7D4E-466A-A16B-B7DE84CF01B3@holtmann.org>



On 25/08/2015 16:52, Marcel Holtmann wrote:
> Hi Loic,
>
>>>> +
>>>> +	set_bit(STATE_SPEED_CHANGING, &intel->flags);
>>>> +
>>>> +	skb = __hci_cmd_sync(hdev, 0xfc06, 1, &intel_speed, HCI_INIT_TIMEOUT);
>>>> +	if (IS_ERR(skb)) {
>>>> +		BT_ERR("%s: Changing Intel speed failed (%ld)",
>>>> +		       hdev->name, PTR_ERR(skb));
>>>> +		clear_bit(STATE_SPEED_CHANGING, &intel->flags);
>>>> +		return PTR_ERR(skb);
>>>> +	}
>>>
>>> I think this approach is wrong. It is not that the controller sends no HCI Command Complete. It is just that it sends it later and we have to change the baud rate in between.
>>>
>>> This is different from the case where the controller swallows the HCI Command Complete event altogether. So instead of trying to hack around this, why not just insert the HCI command into the queue like the QCA guys did. We have no chance of checking that it worked anyway.
>>
>> I sent the speed command with hci_cmd_sync so that it pass through the hci core and can be monitored (btmon/hcidump). But I'm ok for directly enqueueing the packet.
>
> lets enqueue in manually first. And then we need to add a __hci_cmd_send that just sends a packet without waiting for its command status/complete. Then we fix the Intel driver and the Qualcomm driver.
>
>>>> +
>>>> +	kfree_skb(skb);
>>>> +
>>>> +	/* wait 100ms to change baudrate on controller side */
>>>> +	msleep(100);
>>>> +
>>>> +	clear_bit(STATE_SPEED_CHANGING, &intel->flags);
>>>
>>> If we just inject the command into the local queue and wakeup the processing, then the speed change state tracking for sending should go away. However we could keep it for waiting for the HCI Command Complete that indicates the success. And then continue. The msleep would then not be needed.
>>
>> I also use this flag to ignore incoming data during speed transition.
>> It avoids to retrieve unexpected/corrupted data.
>> I agree that we should manage the response, however it requires some play with CTS/RTS and hci_uart_set_baudrate. I will keep it simple for now, having the same solution as QCA.
>
> We are required to change UART settings anyway. At least that is what I remember from the vendor specification here. If we get corrupted data, then that is pretty bad.

Sure, but the question is how do you know that command has been fully 
transmitted on the UART PHY (from hci_intel)?

-- 
Intel Open Source Technology Center
http://oss.intel.com/

  reply	other threads:[~2015-08-25 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 13:59 [PATCH v4 1/2] Bluetooth: hci_intel: Add Intel baudrate configuration support Loic Poulain
2015-08-21 13:59 ` [PATCH v4 2/2] Bluetooth: hci_intel: Add platform driver Loic Poulain
2015-08-24 18:43   ` Marcel Holtmann
2015-08-24 18:31 ` [PATCH v4 1/2] Bluetooth: hci_intel: Add Intel baudrate configuration support Marcel Holtmann
2015-08-25  8:43   ` Loic Poulain
2015-08-25 14:52     ` Marcel Holtmann
2015-08-25 15:21       ` Loic Poulain [this message]
2015-08-25 15:39         ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55DC87EB.2050104@intel.com \
    --to=loic.poulain@intel.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).