aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-09-27 10:26:11 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-09-27 16:11:52 -0400
commit3161ae1c72f03b021bc67504c13025626c26d30c (patch)
treedc75cc7e2ddb341aec63cbbabccbc31eb6bbfa13
parentaa09537d80bf7e6282103618eb496f03e76f2953 (diff)
Bluetooth: AMP: Physical link struct and helpers
Define physical link structures. Physical links are represented by hci_conn structure. For BR/EDR we use type ACL_LINK and for AMP we use AMP_LINK. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/amp.h3
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/amp.c29
4 files changed, 34 insertions, 0 deletions
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index e8616751bc81..3414dfdc404c 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -14,6 +14,9 @@
14#ifndef __AMP_H 14#ifndef __AMP_H
15#define __AMP_H 15#define __AMP_H
16 16
17struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
18 u8 remote_id);
19
17void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr); 20void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
18void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle); 21void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
19void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr); 22void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ccc08e57c107..77b6a197a6f6 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -207,6 +207,7 @@ enum {
207#define ESCO_LINK 0x02 207#define ESCO_LINK 0x02
208/* Low Energy links do not have defined link type. Use invented one */ 208/* Low Energy links do not have defined link type. Use invented one */
209#define LE_LINK 0x80 209#define LE_LINK 0x80
210#define AMP_LINK 0x81
210 211
211/* LMP features */ 212/* LMP features */
212#define LMP_3SLOT 0x01 213#define LMP_3SLOT 0x01
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b1c7d0607244..464eae340419 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -318,6 +318,7 @@ struct hci_conn {
318 318
319 __u8 remote_cap; 319 __u8 remote_cap;
320 __u8 remote_auth; 320 __u8 remote_auth;
321 __u8 remote_id;
321 bool flush_key; 322 bool flush_key;
322 323
323 unsigned int sent; 324 unsigned int sent;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 2d4e79ee06a5..50a7b2fb8bf3 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -17,6 +17,35 @@
17#include <net/bluetooth/a2mp.h> 17#include <net/bluetooth/a2mp.h>
18#include <net/bluetooth/amp.h> 18#include <net/bluetooth/amp.h>
19 19
20/* Physical Link interface */
21static u8 __next_handle(struct amp_mgr *mgr)
22{
23 if (++mgr->handle == 0)
24 mgr->handle = 1;
25
26 return mgr->handle;
27}
28
29struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
30 u8 remote_id)
31{
32 bdaddr_t *dst = mgr->l2cap_conn->dst;
33 struct hci_conn *hcon;
34
35 hcon = hci_conn_add(hdev, AMP_LINK, dst);
36 if (!hcon)
37 return NULL;
38
39 hcon->state = BT_CONNECT;
40 hcon->out = true;
41 hcon->attempt++;
42 hcon->handle = __next_handle(mgr);
43 hcon->remote_id = remote_id;
44 hcon->amp_mgr = mgr;
45
46 return hcon;
47}
48
20void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle) 49void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle)
21{ 50{
22 struct hci_cp_read_local_amp_assoc cp; 51 struct hci_cp_read_local_amp_assoc cp;