public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-bluetooth@vger.kernel.org, linux-usb@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [rfc]btusb with SCO support
Date: Tue, 19 Aug 2008 09:52:49 +0200	[thread overview]
Message-ID: <1219132369.7591.98.camel@violet.holtmann.net> (raw)
In-Reply-To: <200808190930.59698.oliver@neukum.org>

Hi Alan,

> > example have the USB core queue submitted URBs until the new alternate
> > setting has been selected?
> 
> this one's for you. Is there a deeper reason we enable and disable endpoints
> therein?

just let me give you details on rational behind my question. A Bluetooth
USB device uses two interfaces. The first one for control (commands),
interrupt (event) and bulk (ACL data) endpoints. The second interface
contains the isoc (SCO data) endpoints.

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0bf8 ProdID=1003 Rev=53.42
C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)

The second interface contains 6 alternate settings and you have to
select them based on your voice setting (8-bit or 16-bit) and the number
of SCO connections (0-3).

The Bluetooth specification has the details, but when using 16-bit input
data and one SCO connection, you have to select alternate setting #2. If
no SCO connections are open, we have to go with setting #0.

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0bf8 ProdID=1003 Rev=53.42
C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:* If#= 1 Alt= 2 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)

So we can't have isoc URBs running all them time since that would drain
power. The old hci_usb did it this way and was an obvious issue showing
up on powertop.

The Bluetooth subsystem calls our notify() callback when the number of
connection or the voice setting changes. However this context can't
sleep and thus we can't call usb_set_interface(). Right now are using a
workqueue, but that is not an optimal solution since as Oliver pointed
correctly out, we have no idea when this gets scheduled.

My question is if we can have a usb_set_interface() version that we can
call from interrupt context and that will queue the URBs that we submit
in between until the new alternate setting has been selected.

I personally think the Bluetooth USB specification is broken and a bad
design, but that is what we have at the moment.

Regards

Marcel



  reply	other threads:[~2008-08-19  7:52 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31 12:52 [rfc]btusb with SCO support Oliver Neukum
2008-07-31 14:03 ` Marcel Holtmann
2008-07-31 15:21   ` Oliver Neukum
2008-08-01 17:42     ` Marcel Holtmann
2008-08-02 23:47       ` Alan Stern
2008-08-01 10:32   ` Oliver Neukum
2008-08-01 17:43     ` Marcel Holtmann
2008-08-01 11:57   ` Oliver Neukum
2008-08-01 17:45     ` Marcel Holtmann
2008-08-04  8:33       ` Oliver Neukum
2008-08-04 16:05         ` Marcel Holtmann
2008-08-04 16:23           ` Oliver Neukum
2008-08-04 16:33             ` Marcel Holtmann
2008-08-04 17:01               ` Oliver Neukum
2008-08-04 17:25                 ` Marcel Holtmann
2008-08-04 18:32                   ` Oliver Neukum
2008-08-04 20:24                     ` Marcel Holtmann
2008-08-05 11:15                       ` Oliver Neukum
2008-08-08 21:14 ` Marcel Holtmann
2008-08-12 20:53   ` Oliver Neukum
2008-08-12 21:36     ` Marcel Holtmann
2008-08-13 15:16       ` Oliver Neukum
2008-08-13 18:23         ` Marcel Holtmann
2008-08-18 10:13     ` Marcel Holtmann
2008-08-18 12:57       ` Oliver Neukum
2008-08-18 13:38         ` Marcel Holtmann
2008-08-18 13:52           ` Oliver Neukum
2008-08-18 14:10             ` Marcel Holtmann
2008-08-18 14:27               ` Oliver Neukum
2008-08-18 14:36                 ` Marcel Holtmann
2008-08-18 14:38                   ` Oliver Neukum
2008-08-18 15:12                     ` Marcel Holtmann
2008-08-18 16:03                       ` Oliver Neukum
2008-08-18 17:07                         ` Marcel Holtmann
2008-08-18 21:26                           ` Oliver Neukum
2008-08-19  4:05                             ` Marcel Holtmann
2008-08-19  7:03                               ` Oliver Neukum
2008-08-19  7:19                                 ` Marcel Holtmann
2008-08-19  7:30                                   ` Oliver Neukum
2008-08-19  7:52                                     ` Marcel Holtmann [this message]
2008-08-19 14:49                                       ` Alan Stern
2008-08-19 15:18                                         ` Marcel Holtmann
2008-08-19 15:53                                           ` Alan Stern
2008-08-19 18:19                                             ` Marcel Holtmann
2008-08-19 18:57                                               ` Alan Stern
2008-08-20  6:39                                                 ` Dave Higton
2008-08-20 13:50                                                   ` Alan Stern

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=1219132369.7591.98.camel@violet.holtmann.net \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=stern@rowland.harvard.edu \
    /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