Re: [PATCH v11 06/10] Bluetooth: Allow setting of codec for HFP offload usecase
From: Marcel Holtmann <marcel@holtmann.org>
Date: 2021-07-30 14:18:14
Hi Kiran,
quoted hunk ↗ jump to hunk
For HFP offload usecase, controller needs to be configured with codec data and capabilities. This patch uses Bluetooth SIG defined command HCI_CONFIGURE_DATA_PATH to specify vendor specific data and allows userspace modules to set the codec via setsockopt systemcall. Signed-off-by: Kiran K <redacted> Reviewed-by: Chethan T N <redacted> Reviewed-by: Srivatsa Ravishankar <redacted> --- * changes in v11: - Remove changes related to Kconfig * changes in v10: - patch refactor - having callback definition and usage in the same patch include/net/bluetooth/bluetooth.h | 2 + include/net/bluetooth/hci.h | 8 ++ include/net/bluetooth/hci_core.h | 3 + net/bluetooth/sco.c | 118 ++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+)diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 64cddff0c9c4..1a48b6732eef 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h@@ -173,6 +173,8 @@ struct bt_codecs {struct bt_codec codecs[]; } __packed; +#define CODING_FORMAT_CVSD 0x02 + __printf(1, 2) void bt_info(const char *fmt, ...); __printf(1, 2)diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 22e872e60ff8..c998607fc517 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h@@ -1250,6 +1250,14 @@ struct hci_rp_read_local_oob_ext_data {__u8 rand256[16]; } __packed; +#define HCI_CONFIGURE_DATA_PATH 0x0c83 +struct hci_op_configure_data_path { + __u8 direction; + __u8 data_path_id; + __u8 vnd_len; + __u8 vnd_data[]; +} __packed; + #define HCI_OP_READ_LOCAL_VERSION 0x1001 struct hci_rp_read_local_version { __u8 status;diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 71c409c8ab34..eafa6f8114cb 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h@@ -618,6 +618,9 @@ struct hci_dev {void (*cmd_timeout)(struct hci_dev *hdev); bool (*prevent_wake)(struct hci_dev *hdev); int (*get_data_path_id)(struct hci_dev *hdev, __u8 *data_path); + int (*get_codec_config_data)(struct hci_dev *hdev, __u8 type, + struct bt_codec *codec, __u8 *vnd_len, + __u8 **vnd_data);
why are these two independent callbacks? I seem to remember saying that it looks like we only need one. Regards Marcel