Skip to content

Commit de2ba30

Browse files
committed
Bluetooth: Set LE Default PHY preferences
If the LE Set Default PHY command is supported, the indicate to the controller that the host has no preferences for transmitter PHY or receiver PHY selection. Issuing this command gives the controller a clear indication that other PHY can be selected if available. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Johan Hedberg <[email protected]>
1 parent 27bbca4 commit de2ba30

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

include/net/bluetooth/hci.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,13 @@ struct hci_rp_le_read_max_data_len {
14991499
__le16 rx_time;
15001500
} __packed;
15011501

1502+
#define HCI_OP_LE_SET_DEFAULT_PHY 0x2031
1503+
struct hci_cp_le_set_default_phy {
1504+
__u8 all_phys;
1505+
__u8 tx_phys;
1506+
__u8 rx_phys;
1507+
} __packed;
1508+
15021509
/* ---- HCI Events ---- */
15031510
#define HCI_EV_INQUIRY_COMPLETE 0x01
15041511

net/bluetooth/hci_core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,18 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt)
794794
hci_req_add(req, HCI_OP_LE_WRITE_DEF_DATA_LEN, sizeof(cp), &cp);
795795
}
796796

797+
/* Set Default PHY parameters if command is supported */
798+
if (hdev->commands[35] & 0x20) {
799+
struct hci_cp_le_set_default_phy cp;
800+
801+
/* No transmitter PHY or receiver PHY preferences */
802+
cp.all_phys = 0x03;
803+
cp.tx_phys = 0;
804+
cp.rx_phys = 0;
805+
806+
hci_req_add(req, HCI_OP_LE_SET_DEFAULT_PHY, sizeof(cp), &cp);
807+
}
808+
797809
return 0;
798810
}
799811

0 commit comments

Comments
 (0)