All of lore.kernel.org
 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 10:43:42 +0200	[thread overview]
Message-ID: <55DC2ABE.7090107@intel.com> (raw)
In-Reply-To: <5D898BFA-B6C2-47DC-9DC4-DB3EDECA2E23@holtmann.org>

Hi Marcel,

>> +
>> +	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.

>> +
>> +	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.

Regards,
Loic

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

  reply	other threads:[~2015-08-25  8:43 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 [this message]
2015-08-25 14:52     ` Marcel Holtmann
2015-08-25 15:21       ` Loic Poulain
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=55DC2ABE.7090107@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.