2021-05-19 17:51:11

by K, Kiran

[permalink] [raw]
Subject: [PATCH v8 4/9] Bluetooth: btitnel: Add a callback function to retireve data path

There is no standard HCI command to retrieve data path for transport.
Add a new callback function to retrieve data path which is used
in offload usecase.

Signed-off-by: Kiran K <[email protected]>
Reviewed-by: Chethan T N <[email protected]>
Reviewed-by: Srivatsa Ravishankar <[email protected]>
---

This callback gets called when audio module queries codecs suppoted
on SCO socket. For Intel controllers, data_path is always 1

drivers/bluetooth/btintel.c | 8 ++++++++
drivers/bluetooth/btintel.h | 6 ++++++
drivers/bluetooth/btusb.c | 1 +
include/net/bluetooth/hci_core.h | 1 +
4 files changed, 16 insertions(+)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index e3ad19244054..8407e9736c62 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1300,6 +1300,14 @@ int btintel_read_offload_usecases(struct hci_dev *hdev)
}
EXPORT_SYMBOL_GPL(btintel_read_offload_usecases);

+int btintel_get_data_path_id(struct hci_dev *hdev)
+{
+ if (!test_bit(HCI_QUIRK_HFP_OFFLOAD_CODECS_SUPPORTED, &hdev->quirks))
+ return -EOPNOTSUPP;
+ return 1;
+}
+EXPORT_SYMBOL_GPL(btintel_get_data_path_id);
+
MODULE_AUTHOR("Marcel Holtmann <[email protected]>");
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 d561d4899b1b..6d4edfd16d44 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -176,6 +176,7 @@ int btintel_read_debug_features(struct hci_dev *hdev,
int btintel_set_debug_features(struct hci_dev *hdev,
const struct intel_debug_features *features);
int btintel_read_offload_usecases(struct hci_dev *hdev);
+int btintel_get_data_path_id(struct hci_dev *hdev);
#else

static inline int btintel_check_bdaddr(struct hci_dev *hdev)
@@ -312,4 +313,9 @@ static int btintel_read_offload_usecases(struct hci_dev *hdev)
{
return -EOPNOTSUPP;
}
+
+static int btintel_get_data_path_id(struct hci_dev *hdev)
+{
+ return -EOPNOTSUPP;
+}
#endif
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ac245df5fa18..f7b349db392a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4631,6 +4631,7 @@ static int btusb_probe(struct usb_interface *intf,
hdev->set_diag = btintel_set_diag;
hdev->set_bdaddr = btintel_set_bdaddr;
hdev->cmd_timeout = btusb_intel_cmd_timeout;
+ hdev->get_data_path_id = btintel_get_data_path_id;
set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index cdc9580ff264..78d1ebab58f6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -617,6 +617,7 @@ struct hci_dev {
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
void (*cmd_timeout)(struct hci_dev *hdev);
bool (*prevent_wake)(struct hci_dev *hdev);
+ int (*get_data_path_id)(struct hci_dev *hdev);
};

#define HCI_PHY_HANDLE(handle) (handle & 0xff)
--
2.17.1



2021-06-03 14:30:56

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v8 4/9] Bluetooth: btitnel: Add a callback function to retireve data path

Hi Kiran,

> There is no standard HCI command to retrieve data path for transport.
> Add a new callback function to retrieve data path which is used
> in offload usecase.
>
> Signed-off-by: Kiran K <[email protected]>
> Reviewed-by: Chethan T N <[email protected]>
> Reviewed-by: Srivatsa Ravishankar <[email protected]>
> ---
>
> This callback gets called when audio module queries codecs suppoted
> on SCO socket. For Intel controllers, data_path is always 1
>
> drivers/bluetooth/btintel.c | 8 ++++++++
> drivers/bluetooth/btintel.h | 6 ++++++
> drivers/bluetooth/btusb.c | 1 +
> include/net/bluetooth/hci_core.h | 1 +
> 4 files changed, 16 insertions(+)
>
> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> index e3ad19244054..8407e9736c62 100644
> --- a/drivers/bluetooth/btintel.c
> +++ b/drivers/bluetooth/btintel.c
> @@ -1300,6 +1300,14 @@ int btintel_read_offload_usecases(struct hci_dev *hdev)
> }
> EXPORT_SYMBOL_GPL(btintel_read_offload_usecases);
>
> +int btintel_get_data_path_id(struct hci_dev *hdev)
> +{
> + if (!test_bit(HCI_QUIRK_HFP_OFFLOAD_CODECS_SUPPORTED, &hdev->quirks))
> + return -EOPNOTSUPP;
> + return 1;
> +}
> +EXPORT_SYMBOL_GPL(btintel_get_data_path_id);
> +

actually lets not do it this way. Only set the get_data_path_id callback if offloading is supported and with that we don’t actually need to quirk either. If it is set, we know that we can offload.

Regards

Marcel

2021-06-08 11:59:46

by K, Kiran

[permalink] [raw]
Subject: RE: [PATCH v8 4/9] Bluetooth: btitnel: Add a callback function to retireve data path

Hi Marcel,

> > This callback gets called when audio module queries codecs suppoted on
> > SCO socket. For Intel controllers, data_path is always 1
> >
> > drivers/bluetooth/btintel.c | 8 ++++++++
> > drivers/bluetooth/btintel.h | 6 ++++++
> > drivers/bluetooth/btusb.c | 1 +
> > include/net/bluetooth/hci_core.h | 1 +
> > 4 files changed, 16 insertions(+)
> >
> > diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> > index e3ad19244054..8407e9736c62 100644
> > --- a/drivers/bluetooth/btintel.c
> > +++ b/drivers/bluetooth/btintel.c
> > @@ -1300,6 +1300,14 @@ int btintel_read_offload_usecases(struct
> > hci_dev *hdev) } EXPORT_SYMBOL_GPL(btintel_read_offload_usecases);
> >
> > +int btintel_get_data_path_id(struct hci_dev *hdev) {
> > + if (!test_bit(HCI_QUIRK_HFP_OFFLOAD_CODECS_SUPPORTED,
> &hdev->quirks))
> > + return -EOPNOTSUPP;
> > + return 1;
> > +}
> > +EXPORT_SYMBOL_GPL(btintel_get_data_path_id);
> > +
>
> actually lets not do it this way. Only set the get_data_path_id callback if
> offloading is supported and with that we don’t actually need to quirk either.
> If it is set, we know that we can offload.
>

Ack.

Thanks,
Kiran