diff mbox series

[v3,2/2] Bluetooth : Config debug feature based on available support

Message ID 20200608122747.10714-2-kiran.k@intel.com (mailing list archive)
State New, archived
Delegated to: Marcel Holtmann
Headers show
Series [v3,1/2] Bluetooth: Add support to read Intel debug feature | expand

Commit Message

Kiran K June 8, 2020, 12:27 p.m. UTC
From: Chethan T N <chethan.tumkur.narayan@intel.com>

This patch shall enable the Intel telemetry exception format
based on the supported features

Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
Signed-off-by: Ps AyappadasX <AyappadasX.Ps@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel.c | 27 +++++++++++++++++++++++++++
 drivers/bluetooth/btintel.h |  9 +++++++--
 drivers/bluetooth/btusb.c   |  2 ++
 3 files changed, 36 insertions(+), 2 deletions(-)

Comments

Marcel Holtmann June 10, 2020, 8:07 a.m. UTC | #1
Hi Kiran,

> This patch shall enable the Intel telemetry exception format
> based on the supported features
> 
> Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
> Signed-off-by: Ps AyappadasX <AyappadasX.Ps@intel.com>
> Signed-off-by: Kiran K <kiran.k@intel.com>
> ---
> drivers/bluetooth/btintel.c | 27 +++++++++++++++++++++++++++
> drivers/bluetooth/btintel.h |  9 +++++++--
> drivers/bluetooth/btusb.c   |  2 ++
> 3 files changed, 36 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index cb7d62883b18..f9463f0c3ee2 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -787,6 +787,33 @@  int btintel_read_debug_features(struct hci_dev *hdev,
 }
 EXPORT_SYMBOL_GPL(btintel_read_debug_features);
 
+int btintel_config_debug_features(struct hci_dev *hdev,
+				  const struct intel_debug_features *features)
+{
+	struct sk_buff *skb;
+	u8 mask_ddc[11] = { 0x0a, 0x92, 0x02, 0x07, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00 };
+
+	if (!features)
+		return -EINVAL;
+
+	if (!(features->page1[0] & 0x3f)) {
+		bt_dev_info(hdev, "Telemety exception format not supported");
+		return 0;
+	}
+
+	skb = __hci_cmd_sync(hdev, 0xfc8b, 11, mask_ddc, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		bt_dev_err(hdev, "Setting Intel telemetry ddc write event mask failed (%ld)",
+			   PTR_ERR(skb));
+		return PTR_ERR(skb);
+	}
+
+	kfree_skb(skb);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(btintel_config_debug_features);
+
 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
 MODULE_VERSION(VERSION);
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index 7cd813fc5db4..63743b89dad9 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -92,10 +92,10 @@  int btintel_read_boot_params(struct hci_dev *hdev,
 int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
 			      u32 *boot_param);
 void btintel_reset_to_bootloader(struct hci_dev *hdev);
-
 int btintel_read_debug_features(struct hci_dev *hdev,
 				struct intel_debug_features *features);
-
+int btintel_config_debug_features(struct hci_dev *hdev,
+				  const struct intel_debug_features *features);
 #else
 
 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -201,4 +201,9 @@  static inline int btintel_read_debug_features(struct hci_dev *hdev,
 	return -EOPNOTSUPP;
 }
 
+static inline int btintel_config_debug_features(struct hci_dev *hdev,
+						const struct intel_debug_features *features)
+{
+	return -EOPNOTSUPP;
+}
 #endif
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 1d36141ebe65..b1573004ffac 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2547,6 +2547,8 @@  static int btusb_setup_intel_new(struct hci_dev *hdev)
 	 */
 	btintel_read_debug_features(hdev, &debug_features);
 
+	btintel_config_debug_features(hdev, &debug_features);
+
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version(hdev, &ver);
 	if (err)