From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
Kiran K <kiran.k@intel.com>
Subject: [PATCH v8 3/9] Bluetooth: btintel: Add a quirk for hfp offload usecase
Date: Tue, 18 May 2021 16:12:26 +0530 [thread overview]
Message-ID: <20210518104232.5431-3-kiran.k@intel.com> (raw)
In-Reply-To: <20210518104232.5431-1-kiran.k@intel.com>
Define a quirk to identify if intel controllers supports offload for
HFP. In *setup* function, driver sends vendor specific command to
check if controller supports offload. If offload is supports then
quirk flag is set
Signed-off-by: Kiran K <kiran.k@intel.com>
Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
---
drivers/bluetooth/btintel.c | 28 ++++++++++++++++++++++++++++
drivers/bluetooth/btintel.h | 5 +++++
drivers/bluetooth/btusb.c | 2 ++
include/net/bluetooth/hci.h | 7 +++++++
4 files changed, 42 insertions(+)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index e44b6993cf91..e3ad19244054 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -32,6 +32,11 @@ struct cmd_write_boot_params {
u8 fw_build_yy;
} __packed;
+struct intel_offload_usecases {
+ __u8 status;
+ __u8 preset[8];
+} __packed;
+
int btintel_check_bdaddr(struct hci_dev *hdev)
{
struct hci_rp_read_bd_addr *bda;
@@ -1272,6 +1277,29 @@ int btintel_set_debug_features(struct hci_dev *hdev,
}
EXPORT_SYMBOL_GPL(btintel_set_debug_features);
+int btintel_read_offload_usecases(struct hci_dev *hdev)
+{
+ struct sk_buff *skb;
+ struct intel_offload_usecases *usecases;
+
+ skb = __hci_cmd_sync(hdev, 0xfc86, 0, NULL, HCI_INIT_TIMEOUT);
+ if (IS_ERR(skb)) {
+ bt_dev_err(hdev, "Reading offload usecases failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+ usecases = (void *)skb->data;
+ if (usecases->status)
+ goto error;
+
+ if (usecases->preset[0] & 0x03)
+ set_bit(HCI_QUIRK_HFP_OFFLOAD_CODECS_SUPPORTED, &hdev->quirks);
+error:
+ kfree_skb(skb);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(btintel_read_offload_usecases);
+
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 d184064a5e7c..d561d4899b1b 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -175,6 +175,7 @@ int btintel_read_debug_features(struct hci_dev *hdev,
struct intel_debug_features *features);
int btintel_set_debug_features(struct hci_dev *hdev,
const struct intel_debug_features *features);
+int btintel_read_offload_usecases(struct hci_dev *hdev);
#else
static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -307,4 +308,8 @@ static inline int btintel_set_debug_features(struct hci_dev *hdev,
return -EOPNOTSUPP;
}
+static int btintel_read_offload_usecases(struct hci_dev *hdev)
+{
+ return -EOPNOTSUPP;
+}
#endif
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 5245714dc6d0..ac245df5fa18 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2993,6 +2993,8 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev)
/* Set DDC mask for available debug features */
btintel_set_debug_features(hdev, &features);
+ btintel_read_offload_usecases(hdev);
+
/* Read the Intel version information after loading the FW */
err = btintel_read_version_tlv(hdev, &version);
if (err)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 08508b3d13b4..731d48ca873a 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -246,6 +246,13 @@ enum {
* HCI after resume.
*/
HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+ /* When this quirk is set, then controller supports offload codecs
+ * for HFP.
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_HFP_OFFLOAD_CODECS_SUPPORTED,
};
/* HCI device flags */
--
2.17.1
next prev parent reply other threads:[~2021-05-18 10:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 10:42 [PATCH v8 1/9] Bluetooth: enumerate local supported codec and cache details Kiran K
2021-05-18 10:42 ` [PATCH v8 2/9] Bluetooth: Add support for Read Local Supported Codecs V2 Kiran K
2021-06-03 14:24 ` Marcel Holtmann
2021-05-18 10:42 ` Kiran K [this message]
2021-06-03 14:26 ` [PATCH v8 3/9] Bluetooth: btintel: Add a quirk for hfp offload usecase Marcel Holtmann
2021-05-18 10:42 ` [PATCH v8 4/9] Bluetooth: btitnel: Add a callback function to retireve data path Kiran K
2021-06-03 14:29 ` Marcel Holtmann
2021-06-08 11:56 ` K, Kiran
2021-05-18 10:42 ` [PATCH v8 5/9] Bluetooth: Add BT_CODEC option for getsockopt for SCO socket Kiran K
2021-06-03 14:35 ` Marcel Holtmann
2021-06-08 12:01 ` K, Kiran
2021-05-18 10:42 ` [PATCH v8 6/9] Bluetooth: btintel: Add a callback function to configure data path Kiran K
2021-06-03 14:30 ` Marcel Holtmann
2021-05-18 10:42 ` [PATCH v8 7/9] Bluetooth: Add BT_CODEC option for setsockopt over SCO Kiran K
2021-06-03 14:37 ` Marcel Holtmann
2021-05-18 10:42 ` [PATCH v8 8/9] Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command Kiran K
2021-06-03 14:39 ` Marcel Holtmann
2021-06-08 12:06 ` K, Kiran
2021-05-18 10:42 ` [PATCH v8 9/9] Bluetooth: Add support for msbc coding format Kiran K
2021-05-18 11:12 ` [v8,1/9] Bluetooth: enumerate local supported codec and cache details bluez.test.bot
2021-06-03 14:23 ` [PATCH v8 1/9] " Marcel Holtmann
2021-06-08 11:54 ` K, Kiran
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=20210518104232.5431-3-kiran.k@intel.com \
--to=kiran.k@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).