aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-04-11 02:48:51 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 00:40:35 -0400
commitf4001d28464d92db5cae7702d65cf18162043a12 (patch)
tree00b83db23f1ab1a88268570551ed9682d164fd52
parent2d8b3a11623cf5203bc063927b6fc742625f1ebf (diff)
Bluetooth: btusb: Dynamic alternate setting
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> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
-rw-r--r--drivers/bluetooth/btusb.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 9217121362e1..de171211a1c8 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -855,6 +855,7 @@ static void btusb_work(struct work_struct *work)
855{ 855{
856 struct btusb_data *data = container_of(work, struct btusb_data, work); 856 struct btusb_data *data = container_of(work, struct btusb_data, work);
857 struct hci_dev *hdev = data->hdev; 857 struct hci_dev *hdev = data->hdev;
858 int new_alts;
858 int err; 859 int err;
859 860
860 if (hdev->conn_hash.sco_num > 0) { 861 if (hdev->conn_hash.sco_num > 0) {
@@ -868,11 +869,19 @@ static void btusb_work(struct work_struct *work)
868 869
869 set_bit(BTUSB_DID_ISO_RESUME, &data->flags); 870 set_bit(BTUSB_DID_ISO_RESUME, &data->flags);
870 } 871 }
871 if (data->isoc_altsetting != 2) { 872
873 if (hdev->voice_setting & 0x0020) {
874 static const int alts[3] = { 2, 4, 5 };
875 new_alts = alts[hdev->conn_hash.sco_num - 1];
876 } else {
877 new_alts = hdev->conn_hash.sco_num;
878 }
879
880 if (data->isoc_altsetting != new_alts) {
872 clear_bit(BTUSB_ISOC_RUNNING, &data->flags); 881 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
873 usb_kill_anchored_urbs(&data->isoc_anchor); 882 usb_kill_anchored_urbs(&data->isoc_anchor);
874 883
875 if (__set_isoc_interface(hdev, 2) < 0) 884 if (__set_isoc_interface(hdev, new_alts) < 0)
876 return; 885 return;
877 } 886 }
878 887