From: 'Emeltchenko Andrei' <Andrei.Emeltchenko.news@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Peter Krystad <pkrystad@codeaurora.org>, linux-bluetooth@vger.kernel.org
Subject: Re: [RFC 3/3] Bluetooth: Add AMP initialization
Date: Mon, 21 Nov 2011 12:13:33 +0200 [thread overview]
Message-ID: <20111121101331.GE32261@aemeltch-MOBL1> (raw)
In-Reply-To: <1321633382.15441.618.camel@aeonflux>
Hi Marcel,
On Fri, Nov 18, 2011 at 05:23:01PM +0100, Marcel Holtmann wrote:
> > >
> > > However since we are talking about controller init. Can someone please
> > > first propose a list of how we init AMP vs BR/EDR/LE controllers instead
> > > of just dumping code here. I think it needs some clear strategy on how
> > > to do it.
> >
> > AMP controller is initialized following way in Code Aurora code:
> >
> > Common part:
> >
> > <------8<--------------------------------------------------
> > | /* Mandatory initialization */
> > |
> > | /* Reset */
> > | if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
> > | set_bit(HCI_RESET, &hdev->flags);
> > | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
> > | }
>
> this check for QUIRK_NO_RESET is pointless. That is just there for old
> Bluetooth 1.0b controllers. Or broken hardware. Let's assume the AMP
> controllers are fine and just issue OP_RESET.
>
> > | /* Read Local Version */
> > | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
> > |
> > | /* Read HCI Flow Control Mode */
> > | hci_send_cmd(hdev, HCI_OP_READ_FLOW_CONTROL_MODE, 0, NULL);
> > |
> > | /* Read Buffer Size (ACL mtu, max pkt, etc.) */
> > | hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
> > |
> > | /* Read Data Block Size (ACL mtu, max pkt, etc.) */
> > | hci_send_cmd(hdev, HCI_OP_READ_DATA_BLOCK_SIZE, 0, NULL);
> > <------8<------------------------------------------------------
>
> This is not a generic sequence. We will not be reading flow control or
> data block size commands. It will heavily fail on older controllers.
What about following code (basically BR/EDR initialization is the same as
now and only amp_init is new). I use now virtual AMP device so any init is
good, I need Read Version and Read AMP info commands.
static void bredr_init(struct hci_dev *hdev)
{
struct hci_cp_delete_stored_link_key cp;
__le16 param;
__u8 flt_type;
/* Mandatory initialization */
/* Reset */
if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
set_bit(HCI_RESET, &hdev->flags);
hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
}
/* Read Local Supported Features */
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
/* Read Local Version */
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
/* Read Buffer Size (ACL mtu, max pkt, etc.) */
hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
/* Read BD Address */
hci_send_cmd(hdev, HCI_OP_READ_BD_ADDR, 0, NULL);
/* Read Class of Device */
hci_send_cmd(hdev, HCI_OP_READ_CLASS_OF_DEV, 0, NULL);
/* Read Local Name */
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL);
/* Read Voice Setting */
hci_send_cmd(hdev, HCI_OP_READ_VOICE_SETTING, 0, NULL);
/* Optional initialization */
/* Clear Event Filters */
flt_type = HCI_FLT_CLEAR_ALL;
hci_send_cmd(hdev, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
/* Connection accept timeout ~20 secs */
param = cpu_to_le16(0x7d00);
hci_send_cmd(hdev, HCI_OP_WRITE_CA_TIMEOUT, 2, ¶m);
bacpy(&cp.bdaddr, BDADDR_ANY);
cp.delete_all = 1;
hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp);
}
static void amp_init(struct hci_dev *hdev)
{
/* Mandatory initialization */
/* Reset */
hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
/* Read Local Version */
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
/* Read Buffer Size (ACL mtu, max pkt, etc.) */
hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
/* Read AMP Info */
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
}
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2011-11-21 10:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 15:30 [RFC 1/3] Bluetooth: Use queue in the device list Emeltchenko Andrei
2011-11-16 15:30 ` [RFC 2/3] Bluetooth: remove old code Emeltchenko Andrei
2011-11-16 20:44 ` Gustavo Padovan
2011-11-16 21:47 ` Marcel Holtmann
2011-11-16 15:30 ` [RFC 3/3] Bluetooth: Add AMP initialization Emeltchenko Andrei
2011-11-16 21:49 ` Marcel Holtmann
2011-11-17 13:20 ` Emeltchenko Andrei
2011-11-17 15:45 ` Marcel Holtmann
2011-11-17 18:17 ` Peter Krystad
2011-11-18 5:14 ` Marcel Holtmann
2011-11-18 13:54 ` 'Emeltchenko Andrei'
2011-11-18 16:23 ` Marcel Holtmann
2011-11-21 10:13 ` 'Emeltchenko Andrei' [this message]
2011-11-21 13:00 ` Marcel Holtmann
2011-11-16 21:48 ` [RFC 1/3] Bluetooth: Use queue in the device list Marcel Holtmann
2011-11-21 16:46 ` Gustavo Padovan
-- strict thread matches above, loose matches on Subject: below --
2011-11-21 16:23 [RFC 3/3] Bluetooth: Add AMP initialization james.steele
2011-11-21 16:53 ` Marcel Holtmann
2011-11-23 10:04 ` Andrei Emeltchenko
2011-11-23 14:51 ` 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=20111121101331.GE32261@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=pkrystad@codeaurora.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