aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-09-13 04:40:01 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-09-19 11:20:07 -0400
commit5d4e7e8db0544ec53025383bac49a3328affdad3 (patch)
tree5593027fba948dadfb1628dd10d5b508457ca138
parente793dcf082c847bd2b742c781252c20cbec37986 (diff)
Bluetooth: Add synchronization train parameters reading support
This patch adds support for reading the synchronization train parameters for controllers that support the feature. Since the feature is detectable through the local features page 2, which is retreived only in stage 3 of the HCI init sequence, there is no other option than to add a fourth stage to the init sequence. For now the patch doesn't yet add storing of the parameters, but it is nevertheless convenient to have around to see what kind of parameters various controllers use by default (analyzable e.g. with the btmon user space tool). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--net/bluetooth/hci_core.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 52bd2488ff4a..f7197a0ac759 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -835,6 +835,8 @@ struct hci_cp_write_le_host_supported {
835 __u8 simul; 835 __u8 simul;
836} __packed; 836} __packed;
837 837
838#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
839
838#define HCI_OP_READ_LOCAL_VERSION 0x1001 840#define HCI_OP_READ_LOCAL_VERSION 0x1001
839struct hci_rp_read_local_version { 841struct hci_rp_read_local_version {
840 __u8 status; 842 __u8 status;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b24d2fa02c2f..ea542e07b2e9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -648,6 +648,15 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
648 } 648 }
649} 649}
650 650
651static void hci_init4_req(struct hci_request *req, unsigned long opt)
652{
653 struct hci_dev *hdev = req->hdev;
654
655 /* Check for Synchronization Train support */
656 if (hdev->features[2][0] & 0x04)
657 hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL);
658}
659
651static int __hci_init(struct hci_dev *hdev) 660static int __hci_init(struct hci_dev *hdev)
652{ 661{
653 int err; 662 int err;
@@ -667,7 +676,11 @@ static int __hci_init(struct hci_dev *hdev)
667 if (err < 0) 676 if (err < 0)
668 return err; 677 return err;
669 678
670 return __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT); 679 err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT);
680 if (err < 0)
681 return err;
682
683 return __hci_req_sync(hdev, hci_init4_req, 0, HCI_INIT_TIMEOUT);
671} 684}
672 685
673static void hci_scan_req(struct hci_request *req, unsigned long opt) 686static void hci_scan_req(struct hci_request *req, unsigned long opt)