All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>,
	Mikel Astiz <mikel.astiz.oss@gmail.com>
Subject: [PATCH v0 5/6] Bluetooth: btusb: Dynamic alternate setting
Date: Wed, 11 Apr 2012 08:48:51 +0200	[thread overview]
Message-ID: <1334126932-27327-6-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1334126932-27327-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The alternate setting must be dynamically set according to the number of
active SCO links, and the bit depth of the audio. The possible values
for the alternate setting are described in the Bluetooth Core
Specification, Volume 4, Part B, section 2.1.1.

Signed-off-by: Mikel Astiz <mikel.astiz.oss@gmail.com>
---
 drivers/bluetooth/btusb.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3311b81..10d02fa 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -849,6 +849,7 @@ static void btusb_work(struct work_struct *work)
 {
 	struct btusb_data *data = container_of(work, struct btusb_data, work);
 	struct hci_dev *hdev = data->hdev;
+	int new_alts;
 	int err;
 
 	if (hdev->conn_hash.sco_num > 0) {
@@ -862,11 +863,19 @@ static void btusb_work(struct work_struct *work)
 
 			set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
 		}
-		if (data->isoc_altsetting != 2) {
+
+		if (hdev->voice_setting & 0x0020) {
+			static const int alts[3] = { 2, 4, 5 };
+			new_alts = alts[hdev->conn_hash.sco_num - 1];
+		} else {
+			new_alts = hdev->conn_hash.sco_num;
+		}
+
+		if (data->isoc_altsetting != new_alts) {
 			clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
 			usb_kill_anchored_urbs(&data->isoc_anchor);
 
-			if (__set_isoc_interface(hdev, 2) < 0)
+			if (__set_isoc_interface(hdev, new_alts) < 0)
 				return;
 		}
 
-- 
1.7.7.6


  parent reply	other threads:[~2012-04-11  6:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  6:48 [PATCH v0 0/6] Multiple Bluetooth SCO connections Mikel Astiz
2012-04-11  6:48 ` [PATCH v0 1/6] Bluetooth: Use unsigned int instead of signed int Mikel Astiz
2012-04-11  9:21   ` Marcel Holtmann
2012-04-13 21:59   ` Gustavo Padovan
2012-04-11  6:48 ` [PATCH v0 2/6] Bluetooth: Remove unnecessary check Mikel Astiz
2012-04-11  9:22   ` Marcel Holtmann
2012-04-13 22:01   ` Gustavo Padovan
2012-04-11  6:48 ` [PATCH v0 3/6] Bluetooth: Remove unused HCI event handling Mikel Astiz
2012-04-11  9:23   ` Marcel Holtmann
2012-04-11 15:27     ` Mikel Astiz
2012-04-11  6:48 ` [PATCH v0 4/6] Bluetooth: Simplify outgoing SCO scheduling code Mikel Astiz
2012-04-11  9:24   ` Marcel Holtmann
2012-04-11 11:43     ` Luiz Augusto von Dentz
2012-04-11 15:23       ` Mikel Astiz
2012-04-11 15:34         ` Marcel Holtmann
2012-04-12  5:58           ` Mikel Astiz
2012-04-12  9:52             ` Marcel Holtmann
2012-04-11  6:48 ` Mikel Astiz [this message]
2012-04-11  9:26   ` [PATCH v0 5/6] Bluetooth: btusb: Dynamic alternate setting Marcel Holtmann
2012-04-16 21:46   ` Gustavo Padovan
2012-04-17  9:26     ` Marcel Holtmann
2012-04-17 10:47       ` Gustavo Padovan
2012-04-11  6:48 ` [PATCH v0 6/6] Bluetooth: Remove outgoing MTU check Mikel Astiz

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=1334126932-27327-6-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.