]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: hci_sync: Add support for HCI_LE_Set_Host_Feature [v2]
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 26 May 2026 16:43:42 +0000 (12:43 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 11 Jun 2026 18:24:39 +0000 (14:24 -0400)
This adds support for using HCI_LE_Set_Host_Feature [v2] instead of v1
if LL Extented Features is supported and the controller supports the
command.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_sync.c

index 572b1c620c5d653a1fe10b26c1b0ba33e8f4968f..5462f14ea0c607fe23242e3749783ae578ccdf97 100644 (file)
@@ -2486,6 +2486,12 @@ struct hci_rp_le_cs_test {
 
 #define HCI_OP_LE_CS_TEST_END                  0x2096
 
+#define HCI_OP_LE_SET_HOST_FEATURE_V2          0x2097
+struct hci_cp_le_set_host_feature_v2 {
+       __le16  bit_number;
+       __u8    bit_value;
+} __packed;
+
 /* ---- HCI Events ---- */
 struct hci_ev_status {
        __u8    status;
index df23245d6ccdaf64f1cdf26043359cd851517c37..3be8c3581c6caadeeea56e14e09d4123deb4ec03 100644 (file)
@@ -4588,11 +4588,33 @@ static int hci_set_le_support_sync(struct hci_dev *hdev)
                                     sizeof(cp), &cp, HCI_CMD_TIMEOUT);
 }
 
+/* LE Set Host Feature V2 */
+static int hci_le_set_host_feature_v2_sync(struct hci_dev *hdev, u16 bit,
+                                          u8 value)
+{
+       struct hci_cp_le_set_host_feature_v2 cp;
+
+       memset(&cp, 0, sizeof(cp));
+
+       /* Connected Isochronous Channels (Host Support) */
+       cp.bit_number = cpu_to_le16(bit);
+       cp.bit_value = value;
+
+       return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_HOST_FEATURE_V2,
+                                    sizeof(cp), &cp, HCI_CMD_TIMEOUT);
+}
+
 /* LE Set Host Feature */
-static int hci_le_set_host_feature_sync(struct hci_dev *hdev, u8 bit, u8 value)
+static int hci_le_set_host_feature_sync(struct hci_dev *hdev, u16 bit, u8 value)
 {
        struct hci_cp_le_set_host_feature cp;
 
+       if (ll_ext_feature_capable(hdev) && hdev->commands[47] & BIT(4))
+               return hci_le_set_host_feature_v2_sync(hdev, bit, value);
+
+       if (bit > 255)
+               return 0;
+
        memset(&cp, 0, sizeof(cp));
 
        /* Connected Isochronous Channels (Host Support) */