Commit 5f04ed74 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'for-upstream' of...

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2019-11-24

Here's one last bluetooth-next pull request for the 5.5 kernel:

 - Fix BDADDR_PROPERTY & INVALID_BDADDR quirk handling
 - Added support for BCM4334B0 and BCM4335A0 controllers
 - A few other smaller fixes related to locking and memory leaks
====================
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parents dc83ef22 a4f95f31
...@@ -15,6 +15,7 @@ Required properties: ...@@ -15,6 +15,7 @@ Required properties:
* "brcm,bcm43438-bt" * "brcm,bcm43438-bt"
* "brcm,bcm4345c5" * "brcm,bcm4345c5"
* "brcm,bcm43540-bt" * "brcm,bcm43540-bt"
* "brcm,bcm4335a0"
Optional properties: Optional properties:
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define BDADDR_BCM43430A0 (&(bdaddr_t) {{0xac, 0x1f, 0x12, 0xa0, 0x43, 0x43}}) #define BDADDR_BCM43430A0 (&(bdaddr_t) {{0xac, 0x1f, 0x12, 0xa0, 0x43, 0x43}})
#define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}}) #define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}})
#define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}}) #define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}})
#define BDADDR_BCM4334B0 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb0, 0x34, 0x43}})
#define BDADDR_BCM4345C5 (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0xc5, 0x45, 0x43}}) #define BDADDR_BCM4345C5 (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0xc5, 0x45, 0x43}})
#define BDADDR_BCM43341B (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0x1b, 0x34, 0x43}}) #define BDADDR_BCM43341B (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0x1b, 0x34, 0x43}})
...@@ -74,6 +75,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev) ...@@ -74,6 +75,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
!bacmp(&bda->bdaddr, BDADDR_BCM2076B1) || !bacmp(&bda->bdaddr, BDADDR_BCM2076B1) ||
!bacmp(&bda->bdaddr, BDADDR_BCM4324B3) || !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) ||
!bacmp(&bda->bdaddr, BDADDR_BCM4330B1) || !bacmp(&bda->bdaddr, BDADDR_BCM4330B1) ||
!bacmp(&bda->bdaddr, BDADDR_BCM4334B0) ||
!bacmp(&bda->bdaddr, BDADDR_BCM4345C5) || !bacmp(&bda->bdaddr, BDADDR_BCM4345C5) ||
!bacmp(&bda->bdaddr, BDADDR_BCM43430A0) || !bacmp(&bda->bdaddr, BDADDR_BCM43430A0) ||
!bacmp(&bda->bdaddr, BDADDR_BCM43341B)) { !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
...@@ -326,6 +328,7 @@ struct bcm_subver_table { ...@@ -326,6 +328,7 @@ struct bcm_subver_table {
static const struct bcm_subver_table bcm_uart_subver_table[] = { static const struct bcm_subver_table bcm_uart_subver_table[] = {
{ 0x4103, "BCM4330B1" }, /* 002.001.003 */ { 0x4103, "BCM4330B1" }, /* 002.001.003 */
{ 0x410d, "BCM4334B0" }, /* 002.001.013 */
{ 0x410e, "BCM43341B0" }, /* 002.001.014 */ { 0x410e, "BCM43341B0" }, /* 002.001.014 */
{ 0x4204, "BCM2076B1" }, /* 002.002.004 */ { 0x4204, "BCM2076B1" }, /* 002.002.004 */
{ 0x4406, "BCM4324B3" }, /* 002.004.006 */ { 0x4406, "BCM4324B3" }, /* 002.004.006 */
...@@ -339,6 +342,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = { ...@@ -339,6 +342,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = {
{ 0x220e, "BCM20702A1" }, /* 001.002.014 */ { 0x220e, "BCM20702A1" }, /* 001.002.014 */
{ 0x4217, "BCM4329B1" }, /* 002.002.023 */ { 0x4217, "BCM4329B1" }, /* 002.002.023 */
{ 0x6106, "BCM4359C0" }, /* 003.001.006 */ { 0x6106, "BCM4359C0" }, /* 003.001.006 */
{ 0x4106, "BCM4335A0" }, /* 002.001.006 */
{ } { }
}; };
...@@ -440,6 +444,12 @@ int btbcm_finalize(struct hci_dev *hdev) ...@@ -440,6 +444,12 @@ int btbcm_finalize(struct hci_dev *hdev)
set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
/* Some devices ship with the controller default address.
* Allow the bootloader to set a valid address through the
* device tree.
*/
set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(btbcm_finalize); EXPORT_SYMBOL_GPL(btbcm_finalize);
......
...@@ -1200,7 +1200,7 @@ static int btusb_open(struct hci_dev *hdev) ...@@ -1200,7 +1200,7 @@ static int btusb_open(struct hci_dev *hdev)
if (data->setup_on_usb) { if (data->setup_on_usb) {
err = data->setup_on_usb(hdev); err = data->setup_on_usb(hdev);
if (err < 0) if (err < 0)
return err; goto setup_fail;
} }
data->intf->needs_remote_wakeup = 1; data->intf->needs_remote_wakeup = 1;
...@@ -1239,6 +1239,7 @@ static int btusb_open(struct hci_dev *hdev) ...@@ -1239,6 +1239,7 @@ static int btusb_open(struct hci_dev *hdev)
failed: failed:
clear_bit(BTUSB_INTR_RUNNING, &data->flags); clear_bit(BTUSB_INTR_RUNNING, &data->flags);
setup_fail:
usb_autopm_put_interface(data->intf); usb_autopm_put_interface(data->intf);
return err; return err;
} }
......
...@@ -1425,6 +1425,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = { ...@@ -1425,6 +1425,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = {
{ .compatible = "brcm,bcm4330-bt" }, { .compatible = "brcm,bcm4330-bt" },
{ .compatible = "brcm,bcm43438-bt" }, { .compatible = "brcm,bcm43438-bt" },
{ .compatible = "brcm,bcm43540-bt" }, { .compatible = "brcm,bcm43540-bt" },
{ .compatible = "brcm,bcm4335a0" },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match); MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match);
......
...@@ -1176,8 +1176,10 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, ...@@ -1176,8 +1176,10 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst,
if (!conn) if (!conn)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) {
hci_conn_del(conn);
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
}
conn->state = BT_CONNECT; conn->state = BT_CONNECT;
set_bit(HCI_CONN_SCANNING, &conn->flags); set_bit(HCI_CONN_SCANNING, &conn->flags);
......
...@@ -1444,11 +1444,20 @@ static int hci_dev_do_open(struct hci_dev *hdev) ...@@ -1444,11 +1444,20 @@ static int hci_dev_do_open(struct hci_dev *hdev)
if (hci_dev_test_flag(hdev, HCI_SETUP) || if (hci_dev_test_flag(hdev, HCI_SETUP) ||
test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) { test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
bool invalid_bdaddr;
hci_sock_dev_event(hdev, HCI_DEV_SETUP); hci_sock_dev_event(hdev, HCI_DEV_SETUP);
if (hdev->setup) if (hdev->setup)
ret = hdev->setup(hdev); ret = hdev->setup(hdev);
/* The transport driver can set the quirk to mark the
* BD_ADDR invalid before creating the HCI device or in
* its setup callback.
*/
invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR,
&hdev->quirks);
if (ret) if (ret)
goto setup_failed; goto setup_failed;
...@@ -1457,20 +1466,33 @@ static int hci_dev_do_open(struct hci_dev *hdev) ...@@ -1457,20 +1466,33 @@ static int hci_dev_do_open(struct hci_dev *hdev)
hci_dev_get_bd_addr_from_property(hdev); hci_dev_get_bd_addr_from_property(hdev);
if (bacmp(&hdev->public_addr, BDADDR_ANY) && if (bacmp(&hdev->public_addr, BDADDR_ANY) &&
hdev->set_bdaddr) hdev->set_bdaddr) {
ret = hdev->set_bdaddr(hdev, ret = hdev->set_bdaddr(hdev,
&hdev->public_addr); &hdev->public_addr);
/* If setting of the BD_ADDR from the device
* property succeeds, then treat the address
* as valid even if the invalid BD_ADDR
* quirk indicates otherwise.
*/
if (!ret)
invalid_bdaddr = false;
}
} }
setup_failed: setup_failed:
/* The transport driver can set these quirks before /* The transport driver can set these quirks before
* creating the HCI device or in its setup callback. * creating the HCI device or in its setup callback.
* *
* For the invalid BD_ADDR quirk it is possible that
* it becomes a valid address if the bootloader does
* provide it (see above).
*
* In case any of them is set, the controller has to * In case any of them is set, the controller has to
* start up as unconfigured. * start up as unconfigured.
*/ */
if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) ||
test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks)) invalid_bdaddr)
hci_dev_set_flag(hdev, HCI_UNCONFIGURED); hci_dev_set_flag(hdev, HCI_UNCONFIGURED);
/* For an unconfigured controller it is required to /* For an unconfigured controller it is required to
......
...@@ -4936,10 +4936,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result) ...@@ -4936,10 +4936,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result)
BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d",
chan, result, local_amp_id, remote_amp_id); chan, result, local_amp_id, remote_amp_id);
if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { if (chan->state == BT_DISCONN || chan->state == BT_CLOSED)
l2cap_chan_unlock(chan);
return; return;
}
if (chan->state != BT_CONNECTED) { if (chan->state != BT_CONNECTED) {
l2cap_do_create(chan, result, local_amp_id, remote_amp_id); l2cap_do_create(chan, result, local_amp_id, remote_amp_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment