Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Subject: Re: HCI Set custom bandwidth for AuriStream SCO codec
Date: Sun, 24 Nov 2019 12:13:13 +0100
Message-ID: <20191124111313.gaqjyxmmxigmwmpr@pali> (raw)
In-Reply-To: <390FC814-FBC2-4225-82C2-0CB866F01471@holtmann.org>


[-- Attachment #1: Type: text/plain, Size: 3992 bytes --]

On Sunday 24 November 2019 12:04:39 Marcel Holtmann wrote:
> Hi Pali,
> 
> > I played more with C99 flexible arrays and seems that gcc supports it
> > without any problems. I'm sending another attempt of API implementation,
> > now with more fields which are needed for Enhanced Setup Synchronous
> > Connection command. This command is not supported by kernel yet, but
> > should be easy to add it. So my ioctl API is prepared for it. Enhanced
> > Setup Synchronous Connection command would be needed to use hardware
> > mSBC codec encoder/decoder.
> > 
> > -- 
> > Pali Rohár
> > pali.rohar@gmail.com
> > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> > index fabee6db0abb..29590c6749d5 100644
> > --- a/include/net/bluetooth/bluetooth.h
> > +++ b/include/net/bluetooth/bluetooth.h
> > @@ -116,12 +116,49 @@ struct bt_voice {
> > 	__u16 setting;
> > };
> > 
> > -#define BT_VOICE_TRANSPARENT			0x0003
> > -#define BT_VOICE_CVSD_16BIT			0x0060
> > -
> > #define BT_SNDMTU		12
> > #define BT_RCVMTU		13
> > 
> > +#define BT_VOICE_SETUP		14
> > +#define BT_VOICE_PKT_TYPE_CAP_SCO	BIT(0)
> > +#define BT_VOICE_PKT_TYPE_CAP_ESCO	BIT(1)
> > +struct bt_voice_pkt_type {
> > +	__u8 capability; /* bitmask of BT_VOICE_PKT_TYPE_CAP_* */
> > +	__u8 retrans_effort;
> > +	__u16 pkt_type;
> > +	__u16 max_latency;
> > +};
> > +#define BT_VOICE_SETUP_FEATURE_CONFIG		BIT(0) /* Additional configuration fields after voice_settings are set (including other features) */
> > +#define BT_VOICE_SETUP_FEATURE_ADD_SCO		BIT(1) /* Can use Add Synchronous Connection */
> > +#define BT_VOICE_SETUP_FEATURE_SETUP_SCO	BIT(2) /* Can use Setup Synchronous Connection */
> > +#define BT_VOICE_SETUP_FEATURE_ENH_SETUP_SCO	BIT(3) /* Can use Enhanced Setup Synchronous Connection */
> > +struct bt_voice_setup {
> > +	__u16 voice_setting;
> > +	__u8 features; /* bitmask of BT_VOICE_SETUP_FEATURE_* */
> > +	__u8 pkt_types_count;
> > +	__u32 tx_bandwidth;
> > +	__u32 rx_bandwidth;
> > +	__u32 input_bandwidth;
> > +	__u32 output_bandwidth;
> > +	__u8 tx_coding_format[5];
> > +	__u8 rx_coding_format[5];
> > +	__u8 input_coding_format[5];
> > +	__u8 output_coding_format[5];
> > +	__u16 tx_codec_frame_size;
> > +	__u16 rx_codec_frame_size;
> > +	__u16 input_coded_data_size;
> > +	__u16 output_coded_data_size;
> > +	__u8 input_pcm_data_format;
> > +	__u8 output_pcm_data_format;
> > +	__u8 input_pcm_msb_position;
> > +	__u8 output_pcm_msb_position;
> > +	__u8 input_data_path;
> > +	__u8 output_data_path;
> > +	__u8 input_unit_size;
> > +	__u8 output_unit_size;
> > +	struct bt_voice_pkt_type pkt_types[];
> > +};
> > +
> 
> lets not mush these together. One of these are air codecs and setup defined by a profile, the other are local codec path defined by the platform.

You are right that air codecs are defined by profile and local codecs by
platform / bluetooth adapter. But ...

> You will also not have multiple local codec path. That will be one and they will not be negotiated. The eSCO settings however will be negotiated.

Above structure specify exactly one codec setup and then multiple packet
types. See that flexible array is only for packet types, not for whole
codec structure.

And all above parameters are required for Enhanced Setup Synchronous
Connection command. So kernel needs to know what should put into
Enhanced Setup Synchronous Connection command when creating a new SCO
connection. So for supporting Enhanced Setup Synchronous Connection
command userspace needs to pass all above parameters to kernel.

And usage of Enhanced Setup Synchronous Connection is required when we
want to use in-hardware encoding/decoding of mSBC codec. E.g. new
Thinkpads already have bluetooth adapter which supports encoding and
decoding of mSBC codec in hardware.

So above structure as I define is really needed. Do you see it now?

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply index

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 17:15 Pali Rohár
2019-05-06 15:16 ` Pali Rohár
2019-05-16 18:34   ` Pali Rohár
2019-05-19  8:16     ` Luiz Augusto von Dentz
2019-05-19  8:23       ` Pali Rohár
2019-05-19  8:45         ` Luiz Augusto von Dentz
2019-05-19  8:54           ` Pali Rohár
2019-05-19 21:21           ` Pavel Machek
2019-06-07 13:02             ` Pali Rohár
2019-06-07 15:19               ` Luiz Augusto von Dentz
2019-07-06 13:45               ` Marcel Holtmann
2019-07-08 12:25                 ` Pali Rohár
2019-07-08 13:23                   ` Marcel Holtmann
2019-07-08 21:06                     ` Pali Rohár
2019-07-12 18:59                       ` Marcel Holtmann
2019-07-18 10:09                         ` Pali Rohár
2019-07-18 20:06                           ` Marcel Holtmann
2019-11-21 23:00                             ` Pali Rohár
2019-11-24 11:02                               ` Marcel Holtmann
2019-10-27 22:09                           ` Pali Rohár
2019-11-12 21:06                             ` Pavel Machek
2019-11-13  9:22                               ` Pali Rohár
2019-11-21 22:47                                 ` Pali Rohár
2019-11-19 17:04                             ` Marcel Holtmann
2019-11-19 17:13                               ` Pali Rohár
2019-11-19 23:47                                 ` Marcel Holtmann
2019-11-20  7:44                                   ` Pali Rohár
2019-11-21 22:44                                     ` Pali Rohár
2019-11-24 11:04                                       ` Marcel Holtmann
2019-11-24 11:13                                         ` Pali Rohár [this message]
2019-11-26  7:24                                           ` Marcel Holtmann
2019-11-26  7:46                                             ` Pali Rohár
2019-11-26  7:58                                               ` Marcel Holtmann
2019-11-26  8:00                                                 ` Pali Rohár
2019-11-26  9:41                                                   ` Luiz Augusto von Dentz
2019-11-26  9:58                                                     ` Pali Rohár
2019-12-05  9:28                                                       ` Pali Rohár
2019-12-11 14:40                                                         ` Pali Rohár
2020-01-04 10:04                                                         ` Marcel Holtmann
2020-01-04 10:37                                                           ` Pali Rohár
2020-02-09 12:59                                                             ` Pali Rohár
2020-02-19 12:09                                                           ` David Heidelberg
2020-04-19 23:49                                                             ` Bluetooth: Allow to use configure SCO socket codec parameters Pali Rohár
2020-04-20 23:54                                                               ` Luiz Augusto von Dentz
2020-04-21  8:53                                                                 ` Pali Rohár
2020-05-14 19:49                                                               ` Aleksandar Kostadinov
2020-05-15 22:46                                                                 ` Andrew Fuller
2020-05-15 23:08                                                                   ` Luiz Augusto von Dentz
2020-05-16  7:50                                                                     ` Aleksandar Kostadinov
2020-05-16  7:53                                                                     ` Pali Rohár
2020-05-18 16:43                                                                       ` Luiz Augusto von Dentz
2020-05-18 16:50                                                                         ` Pali Rohár
2020-05-27 12:18                                                                           ` Ujjwal Sharma
2020-05-27 15:48                                                                             ` Luiz Augusto von Dentz
2020-05-27 16:24                                                                               ` Ujjwal Sharma
2020-06-04 20:43                                                                                 ` Pali Rohár

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=20191124111313.gaqjyxmmxigmwmpr@pali \
    --to=pali.rohar@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=pavel@ucw.cz \
    /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

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git