Linux bluetooth development
 help / color / mirror / Atom feed
From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com,
	Chethan T N <chethan.tumkur.narayan@intel.com>,
	Ps@vger.kernel.org, AyappadasX <AyappadasX.Ps@intel.com>,
	Kiran K <kiran.k@intel.com>
Subject: [PATCH 2/2] Bluetooth : Load debug config based on the debug support
Date: Tue,  2 Jun 2020 10:37:52 +0530	[thread overview]
Message-ID: <20200602050752.7470-2-kiran.k@intel.com> (raw)
In-Reply-To: <20200602050752.7470-1-kiran.k@intel.com>

From: Chethan T N <chethan.tumkur.narayan@intel.com>

This patch shall enables 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 | 28 ++++++++++++++++++++++++++++
 drivers/bluetooth/btintel.h |  9 ++++++++-
 drivers/bluetooth/btusb.c   |  3 +++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 09e697b92426..5ef83e9ad19c 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -788,6 +788,34 @@ int btintel_read_supported_features(struct hci_dev *hdev,
 }
 EXPORT_SYMBOL_GPL(btintel_read_supported_features);
 
+int btintel_load_debug_config_based_on_supported_features(struct hci_dev *hdev,
+	const struct intel_supported_features *supported_features)
+{
+	struct sk_buff *skb;
+	u8 mask_ddc[11] = { 0x0a, 0x92, 0x02, 0x07, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00 };
+
+	if (!supported_features)
+		return -EINVAL;
+
+	if (!(supported_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_load_debug_config_based_on_supported_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 f3892c0233f4..043d76c0e7cd 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -95,7 +95,8 @@ int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
 void btintel_reset_to_bootloader(struct hci_dev *hdev);
 int btintel_read_supported_features(struct hci_dev *hdev,
 			struct intel_supported_features *supported_features);
-
+int btintel_load_debug_config_based_on_supported_features(struct hci_dev *hdev,
+	const struct intel_supported_features *supported_features);
 #else
 
 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -199,5 +200,11 @@ static int btintel_read_supported_features(struct hci_dev *hdev,
 {
 	return -EOPNOTSUPP;
 }
+static int btintel_load_debug_config_based_on_supported_features(
+	struct hci_dev *hdev,
+	const struct intel_supported_features *supported_features);
+{
+	return -EOPNOTSUPP;
+}
 
 #endif
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a5a971e7025b..510e3c1c23dc 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2547,6 +2547,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	 */
 	btintel_read_supported_features(hdev, &supported_features);
 
+	btintel_load_debug_config_based_on_supported_features(hdev,
+		&supported_features);
+
 
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version(hdev, &ver);
-- 
2.17.1


  reply	other threads:[~2020-06-02  5:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  5:07 [PATCH 1/2] Bluetooth: Add support to Intel read supported feature Kiran K
2020-06-02  5:07 ` Kiran K [this message]
2020-06-02 13:03   ` [PATCH 2/2] Bluetooth : Load debug config based on the debug support kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200602050752.7470-2-kiran.k@intel.com \
    --to=kiran.k@intel.com \
    --cc=AyappadasX.Ps@intel.com \
    --cc=Ps@vger.kernel.org \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ravishankar.srivatsa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox