Skip to content

Commit d74abe2

Browse files
chethantnholtmann
authored andcommitted
Bluetooth: btusb: Add support to read Intel debug feature
The command shall read the Intel controller supported debug feature. Based on the supported features additional debug configuration shall be enabled. Signed-off-by: Chethan T N <[email protected]> Signed-off-by: Ps AyappadasX <[email protected]> Signed-off-by: Kiran K <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent f98aa80 commit d74abe2

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

drivers/bluetooth/btintel.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,38 @@ void btintel_reset_to_bootloader(struct hci_dev *hdev)
754754
}
755755
EXPORT_SYMBOL_GPL(btintel_reset_to_bootloader);
756756

757+
int btintel_read_debug_features(struct hci_dev *hdev,
758+
struct intel_debug_features *features)
759+
{
760+
struct sk_buff *skb;
761+
u8 page_no = 1;
762+
763+
/* Intel controller supports two pages, each page is of 128-bit
764+
* feature bit mask. And each bit defines specific feature support
765+
*/
766+
skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no,
767+
HCI_INIT_TIMEOUT);
768+
if (IS_ERR(skb)) {
769+
bt_dev_err(hdev, "Reading supported features failed (%ld)",
770+
PTR_ERR(skb));
771+
return PTR_ERR(skb);
772+
}
773+
774+
if (skb->len != (sizeof(features->page1) + 3)) {
775+
bt_dev_err(hdev, "Supported features event size mismatch");
776+
kfree_skb(skb);
777+
return -EILSEQ;
778+
}
779+
780+
memcpy(features->page1, skb->data + 3, sizeof(features->page1));
781+
782+
/* Read the supported features page2 if required in future.
783+
*/
784+
kfree_skb(skb);
785+
return 0;
786+
}
787+
EXPORT_SYMBOL_GPL(btintel_read_debug_features);
788+
757789
MODULE_AUTHOR("Marcel Holtmann <[email protected]>");
758790
MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
759791
MODULE_VERSION(VERSION);

drivers/bluetooth/btintel.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ struct intel_reset {
6262
__le32 boot_param;
6363
} __packed;
6464

65+
struct intel_debug_features {
66+
__u8 page1[16];
67+
} __packed;
68+
6569
#if IS_ENABLED(CONFIG_BT_INTEL)
6670

6771
int btintel_check_bdaddr(struct hci_dev *hdev);
@@ -88,6 +92,10 @@ int btintel_read_boot_params(struct hci_dev *hdev,
8892
int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
8993
u32 *boot_param);
9094
void btintel_reset_to_bootloader(struct hci_dev *hdev);
95+
96+
int btintel_read_debug_features(struct hci_dev *hdev,
97+
struct intel_debug_features *features);
98+
9199
#else
92100

93101
static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -186,4 +194,11 @@ static inline int btintel_download_firmware(struct hci_dev *dev,
186194
static inline void btintel_reset_to_bootloader(struct hci_dev *hdev)
187195
{
188196
}
197+
198+
static inline int btintel_read_debug_features(struct hci_dev *hdev,
199+
struct intel_debug_features *features)
200+
{
201+
return -EOPNOTSUPP;
202+
}
203+
189204
#endif

drivers/bluetooth/btusb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
22672267
struct btusb_data *data = hci_get_drvdata(hdev);
22682268
struct intel_version ver;
22692269
struct intel_boot_params params;
2270+
struct intel_debug_features features;
22702271
const struct firmware *fw;
22712272
u32 boot_param;
22722273
char fwname[64];
@@ -2542,6 +2543,11 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
25422543
*/
25432544
btintel_load_ddc_config(hdev, fwname);
25442545

2546+
/* Read the Intel supported features and if new exception formats
2547+
* supported, need to load the additional DDC config to enable.
2548+
*/
2549+
btintel_read_debug_features(hdev, &features);
2550+
25452551
/* Read the Intel version information after loading the FW */
25462552
err = btintel_read_version(hdev, &ver);
25472553
if (err)

0 commit comments

Comments
 (0)