Skip to content

Commit

Permalink
fix spreadtrum (sprd) broken bluetooth park link status
Browse files Browse the repository at this point in the history
  • Loading branch information
paolosabatino authored and rpardini committed Sep 4, 2023
1 parent 9886485 commit 350d41b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions drivers/bluetooth/hci_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,12 @@ static int hci_uart_register_dev(struct hci_uart *hu)
hdev->setup = hci_uart_setup;
SET_HCIDEV_DEV(hdev, hu->tty->dev);

// Set the broken Park link status quirk, specific for spreadtrum (sprd)
// bluetooth devices
if (hdev->manufacturer == 0xffff && hu->tty->driver &&
strncmp(hu->tty->driver->name, "ttyBT", 5) == 0)
set_bit(HCI_QUIRK_BROKEN_PARK_LINK_STATUS, &hdev->quirks);

if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);

Expand Down
6 changes: 6 additions & 0 deletions include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ enum {
* HCI after resume.
*/
HCI_QUIRK_NO_SUSPEND_NOTIFIER,

/*
* Device declares that support Park link status, but it really
* does not support it and fails to initialize
*/
HCI_QUIRK_BROKEN_PARK_LINK_STATUS,
};

/* HCI device flags */
Expand Down
2 changes: 1 addition & 1 deletion net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void hci_setup_link_policy(struct hci_request *req)
link_policy |= HCI_LP_HOLD;
if (lmp_sniff_capable(hdev))
link_policy |= HCI_LP_SNIFF;
if (lmp_park_capable(hdev))
if (lmp_park_capable(hdev) && !test_bit(HCI_QUIRK_BROKEN_PARK_LINK_STATUS, &hdev->quirks))
link_policy |= HCI_LP_PARK;

cp.policy = cpu_to_le16(link_policy);
Expand Down

0 comments on commit 350d41b

Please sign in to comment.