RE: [PATCH v11 06/10] Bluetooth: Allow setting of codec for HFP offload usecase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcel,

> -----Original Message-----
> From: K, Kiran <kiran.k@xxxxxxxxx>
> Sent: Monday, August 2, 2021 5:16 AM
> To: Marcel Holtmann <marcel@xxxxxxxxxxxx>
> Cc: BlueZ <linux-bluetooth@xxxxxxxxxxxxxxx>; Srivatsa, Ravishankar
> <ravishankar.srivatsa@xxxxxxxxx>; Tumkur Narayan, Chethan
> <chethan.tumkur.narayan@xxxxxxxxx>
> Subject: RE: [PATCH v11 06/10] Bluetooth: Allow setting of codec for HFP
> offload usecase
> 
> Hi Marcel,
> 
> >
> > Hi Kiran,
> >
> > > 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 <kiran.k@xxxxxxxxx>
> > > Reviewed-by: Chethan T N <chethan.tumkur.narayan@xxxxxxxxx>
> > > Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@xxxxxxxxx>
> > > ---
> > > * 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.
> 
> get_data_path_id,  gets called during getsockopt(BT_CODEC,...) when
> populating codec details to user space.
> 
> get_codec_config_data, gets called during setsockopt(BT_CODEC,...)
> 
Not sure if I was clear here. The two callbacks serves different purpose. get_data_path_id gets called during getsockopt(BT_CODEC,...) and fetches data_path_path_id.
get_codec_config_data gets called during setsockopt(BT_CODEC,...) to fetch the vendor specific codec data. This is data is used to configure the codec before opening SCO connection. This data is passed on to controller via HCI_CONFIGURE_DATA_PATH command. 
> >
> > Regards
> >
> > Marcel
> 
> Regards,
> Kiran
> 

Thanks,
Kiran






[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux