linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature
@ 2020-06-03 10:15 Kiran K
  2020-06-03 10:15 ` [PATCH v2 2/2] Bluetooth : Load debug config based on the debug support Kiran K
  2020-06-03 17:42 ` [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Kiran K @ 2020-06-03 10:15 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: ravishankar.srivatsa, Chethan T N, Ps, AyappadasX, Kiran K

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

The command shall read the Intel controller supported
feature. Based on the supported features addtional debug
configuration shall be enabled.

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 | 34 ++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btintel.h | 14 ++++++++++++++
 drivers/bluetooth/btusb.c   |  8 +++++++-
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 6a0e2c5a8beb..09e697b92426 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -754,6 +754,40 @@ void btintel_reset_to_bootloader(struct hci_dev *hdev)
 }
 EXPORT_SYMBOL_GPL(btintel_reset_to_bootloader);
 
+int btintel_read_supported_features(struct hci_dev *hdev,
+	struct intel_supported_features *supported_features)
+{
+	struct sk_buff *skb;
+	u8 page_no = 1;
+
+	/* Intel controller supports two pages, each page is of 128-bit
+	 * feature bit mask. And each bit defines specific feature support
+	 */
+	skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no,
+		HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		BT_ERR("Reading supported features(page1) failed (%ld)",
+			PTR_ERR(skb));
+		return PTR_ERR(skb);
+	}
+
+	if (skb->len != (sizeof(supported_features->page1) + 3)) {
+		bt_dev_err(hdev,
+			"Supported feature(page1) event size mismatch");
+		kfree_skb(skb);
+		return -EILSEQ;
+	}
+
+	memcpy(supported_features->page1, skb->data + 3,
+		sizeof(supported_features->page1));
+
+	/* Read the supported features page2 if required in future.
+	 */
+	kfree_skb(skb);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(btintel_read_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 a69ea8a87b9b..f3892c0233f4 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -62,6 +62,11 @@ struct intel_reset {
 	__le32   boot_param;
 } __packed;
 
+
+struct intel_supported_features {
+	__u8    page1[16];
+} __packed;
+
 #if IS_ENABLED(CONFIG_BT_INTEL)
 
 int btintel_check_bdaddr(struct hci_dev *hdev);
@@ -88,6 +93,9 @@ 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_supported_features(struct hci_dev *hdev,
+			struct intel_supported_features *supported_features);
+
 #else
 
 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -186,4 +194,10 @@ static inline int btintel_download_firmware(struct hci_dev *dev,
 static inline void btintel_reset_to_bootloader(struct hci_dev *hdev)
 {
 }
+static int btintel_read_supported_features(struct hci_dev *hdev,
+		struct intel_supported_features *supported_features)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 5f022e9cf667..a5a971e7025b 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -5,7 +5,6 @@
  *
  *  Copyright (C) 2005-2008  Marcel Holtmann <marcel@holtmann.org>
  */
-
 #include <linux/dmi.h>
 #include <linux/module.h>
 #include <linux/usb.h>
@@ -2273,6 +2272,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	ktime_t calltime, delta, rettime;
 	unsigned long long duration;
 	int err;
+	struct intel_supported_features supported_features;
 
 	BT_DBG("%s", hdev->name);
 
@@ -2542,6 +2542,12 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
 	 */
 	btintel_load_ddc_config(hdev, fwname);
 
+	/* Read the Intel supported features and if new exception formats
+	 * supported, need to load the additional DDC config to enable.
+	 */
+	btintel_read_supported_features(hdev, &supported_features);
+
+
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version(hdev, &ver);
 	if (err)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] Bluetooth : Load debug config based on the debug support
  2020-06-03 10:15 [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Kiran K
@ 2020-06-03 10:15 ` Kiran K
  2020-06-03 17:42 ` [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Kiran K @ 2020-06-03 10:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: ravishankar.srivatsa, Chethan T N, Ps AyappadasX, Kiran K

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..c4e3c57c08ff 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature
  2020-06-03 10:15 [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Kiran K
  2020-06-03 10:15 ` [PATCH v2 2/2] Bluetooth : Load debug config based on the debug support Kiran K
@ 2020-06-03 17:42 ` Marcel Holtmann
  2020-06-08 12:38   ` K, Kiran
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2020-06-03 17:42 UTC (permalink / raw)
  To: Kiran K
  Cc: Bluez mailing list, ravishankar.srivatsa, Chethan T N, Ps, AyappadasX

Hi Kiran,

> The command shall read the Intel controller supported
> feature. Based on the supported features addtional debug
> configuration shall be enabled.
> 
> 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 | 34 ++++++++++++++++++++++++++++++++++
> drivers/bluetooth/btintel.h | 14 ++++++++++++++
> drivers/bluetooth/btusb.c   |  8 +++++++-
> 3 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> index 6a0e2c5a8beb..09e697b92426 100644
> --- a/drivers/bluetooth/btintel.c
> +++ b/drivers/bluetooth/btintel.c
> @@ -754,6 +754,40 @@ void btintel_reset_to_bootloader(struct hci_dev *hdev)
> }
> EXPORT_SYMBOL_GPL(btintel_reset_to_bootloader);
> 
> +int btintel_read_supported_features(struct hci_dev *hdev,
> +	struct intel_supported_features *supported_features)
> +{
> +	struct sk_buff *skb;
> +	u8 page_no = 1;
> +
> +	/* Intel controller supports two pages, each page is of 128-bit
> +	 * feature bit mask. And each bit defines specific feature support
> +	 */
> +	skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no,
> +		HCI_INIT_TIMEOUT);

Please get the coding style right first. We have plenty of examples in the same file on how to do this.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature
  2020-06-03 17:42 ` [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Marcel Holtmann
@ 2020-06-08 12:38   ` K, Kiran
  0 siblings, 0 replies; 4+ messages in thread
From: K, Kiran @ 2020-06-08 12:38 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Bluez mailing list, Srivatsa, Ravishankar, Tumkur Narayan,
	Chethan, Ps, AyappadasX

Hi Marcel,

> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org <linux-bluetooth-
> owner@vger.kernel.org> On Behalf Of Marcel Holtmann
> Sent: Wednesday, June 3, 2020 11:12 PM
> To: K, Kiran <kiran.k@intel.com>
> Cc: Bluez mailing list <linux-bluetooth@vger.kernel.org>; Srivatsa, Ravishankar
> <ravishankar.srivatsa@intel.com>; Tumkur Narayan, Chethan
> <chethan.tumkur.narayan@intel.com>; Ps@vger.kernel.org; Ps, AyappadasX
> <ayappadasx.ps@intel.com>
> Subject: Re: [PATCH v2 1/2] Bluetooth: Add support to Intel read supported
> feature
> 
> Hi Kiran,
> 
> > The command shall read the Intel controller supported feature. Based
> > on the supported features addtional debug configuration shall be
> > enabled.
> >
> > 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 | 34 ++++++++++++++++++++++++++++++++++
> > drivers/bluetooth/btintel.h | 14 ++++++++++++++
> > drivers/bluetooth/btusb.c   |  8 +++++++-
> > 3 files changed, 55 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> > index 6a0e2c5a8beb..09e697b92426 100644
> > --- a/drivers/bluetooth/btintel.c
> > +++ b/drivers/bluetooth/btintel.c
> > @@ -754,6 +754,40 @@ void btintel_reset_to_bootloader(struct hci_dev
> > *hdev) } EXPORT_SYMBOL_GPL(btintel_reset_to_bootloader);
> >
> > +int btintel_read_supported_features(struct hci_dev *hdev,
> > +	struct intel_supported_features *supported_features) {
> > +	struct sk_buff *skb;
> > +	u8 page_no = 1;
> > +
> > +	/* Intel controller supports two pages, each page is of 128-bit
> > +	 * feature bit mask. And each bit defines specific feature support
> > +	 */
> > +	skb = __hci_cmd_sync(hdev, 0xfca6, sizeof(page_no), &page_no,
> > +		HCI_INIT_TIMEOUT);
> 
> Please get the coding style right first. We have plenty of examples in the same
> file on how to do this.

I have addressed all the issues reported  by 'checkpatch.pl  --strict' and sent updated patches.  Thanks.

> 
> Regards
> 
> Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-08 12:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 10:15 [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Kiran K
2020-06-03 10:15 ` [PATCH v2 2/2] Bluetooth : Load debug config based on the debug support Kiran K
2020-06-03 17:42 ` [PATCH v2 1/2] Bluetooth: Add support to Intel read supported feature Marcel Holtmann
2020-06-08 12:38   ` K, Kiran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).