-
Notifications
You must be signed in to change notification settings - Fork 7.6k
drivers: bluetooth: hci: add support for bt_disable() function call #86645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: bluetooth: hci: add support for bt_disable() function call #86645
Conversation
1a3a575
to
3ac826f
Compare
3ac826f
to
c221ccf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this duplicate or supercede #86424 ?
subsys/bluetooth/host/hci_core.c
Outdated
struct net_buf *rsp; | ||
err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, &rsp); | ||
if (err) { | ||
LOG_ERR("Failed to reset BLE controller"); | ||
return err; | ||
} | ||
hci_reset_complete(rsp); | ||
net_buf_unref(rsp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct net_buf *rsp; | |
err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, &rsp); | |
if (err) { | |
LOG_ERR("Failed to reset BLE controller"); | |
return err; | |
} | |
hci_reset_complete(rsp); | |
net_buf_unref(rsp); | |
struct net_buf *rsp; | |
err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, &rsp); | |
if (err) { | |
LOG_ERR("Failed to reset BLE controller"); | |
return err; | |
} | |
hci_reset_complete(rsp); | |
net_buf_unref(rsp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cvinayak, I did not notice that the PR is already raised for this requirement. I have checked the PR you mentioned. It has some partial change and might need some more work for other HCI driver to work with bt init & bt disable flow.
I have updated my current PR and removed changes made for H4 driver which is already done under #86424 PR. Rest all other changes are required to work bt_disable() correctly. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cvinayak , suggestion amended. thank you.
c221ccf
to
4ff3eb4
Compare
4ff3eb4
to
7652d9c
Compare
4feb752
to
028f284
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok with the change, just remember this will conflict with #86462 and will need sequencing
- added HCI command to send hci-reset in bt_disable() func, and remove its call from the driver close() call. - remove rsp buf pass to 'hci_reset_complete()' func as status is already checked under 'bt_hci_cmd_send_sync()'. Signed-off-by: Nirav Agrawal <[email protected]>
028f284
to
4952520
Compare
drivers/bluetooth/hci/h4.c
Outdated
LOG_DBG("Calling bt_recv(%p)", buf); | ||
h4->recv(dev, buf); | ||
if (h4->recv != NULL) { | ||
LOG_DBG("Calling bt_recv(%p)", buf); | ||
h4->recv(dev, buf); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h4_close()
calls k_thread_abort(cfg->rx_thread);
before setting h4->recv = NULL;
. I'm not sure how thread aborting works in practice, but I'd assume that the right thing to do here in case recv
is NULL is to just return from the function, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this change to h4.c
seems independent of any NXP-related changes, so I'd keep it in its own commit (in fact, it seems like a bug fix to the h4_close()
PR that was already merged).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jhedberg, Yes your point is valid. if we abort the thread then no need to put such condition. I will revert those change and update this PR. thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jhedberg, the changes in h4.c is reverted. please check. thank you.
- added flag in nxp setup driver to perform HCI controller firmware- load and configuration only once. This avoid loading/setting-up controller fw on successive bt_init() after bt_disable() call. Signed-off-by: Nirav Agrawal <[email protected]>
4952520
to
4608b11
Compare
Hi @cvinayak, can you please review again and approve this PR. thank you |
Hi @nirav-agrawal! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
bt_disable()
function and remove its call from hci-driver close() call.hci_reset_complete()
function as status is already checked under 'bt_hci_cmd_send_sync()' func.For HCI H4 driver, close() call is added in this PR: #86424.
one more PR to be merged before current PR, https://github.com/zephyrproject-rtos/zephyr/pull/86462/files