From cca20365f85a272c284fc91e901a7da6180ca876 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Thu, 17 Mar 2011 12:17:30 +0100 Subject: bluetooth: Add SCO parameters support for socket Adds ability to setup SCO connection parameters through socket option. ST-Ericsson Linux next: Not tested, ER 256277 ST-Ericsson ID: 256277 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10137 Change-Id: If859341019fd9f7cc7c0efe95750779e84fac801 Signed-off-by: Andrzej Kaczmarek Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30136 Reviewed-by: Par-Gunnar HJALMDAHL Tested-by: Par-Gunnar HJALMDAHL Reviewed-by: Srinidhi KASAGAR Signed-off-by: Robert Marklund --- include/net/bluetooth/bluetooth.h | 12 ++++++++++++ include/net/bluetooth/hci.h | 17 +++++++++++++++++ include/net/bluetooth/hci_core.h | 9 +++++++-- include/net/bluetooth/sco.h | 4 +++- 4 files changed, 39 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index a65910bda38..e386498b347 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -118,6 +118,18 @@ int bt_err(const char *fmt, ...); #define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) #define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) +#define BT_SCO_PARAMETERS 8 +struct bt_sco_parameters { + __u32 tx_bandwidth; + __u32 rx_bandwidth; + __u16 max_latency; + __u16 voice_setting; + __u8 retrans_effort; + __u16 pkt_type; +} __packed; + +#define BT_NO_AUTORETRY 9 + /* Connection and socket states */ enum { BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index d47e523c9d8..15da4460f24 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -176,6 +176,8 @@ enum { #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) +#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \ + EDR_ESCO_MASK) /* ACL flags */ #define ACL_START_NO_FLUSH 0x00 @@ -458,6 +460,21 @@ struct hci_cp_setup_sync_conn { __le16 pkt_type; } __packed; +/* Air coding format types */ +#define HCI_SYNC_AIR_CODING_CVSD 0x00 +#define HCI_SYNC_AIR_CODING_ULAW 0x01 +#define HCI_SYNC_AIR_CODING_ALAW 0x02 +#define HCI_SYNC_AIR_CODING_TRANSPARENT 0x03 + +/* Max latency constants */ +#define HCI_SYNC_MAX_LATENCY_DONTCARE 0xffff + +/* Retransmission effort constants */ +#define HCI_SYNC_RETRANS_EFFORT_NO 0x00 +#define HCI_SYNC_RETRANS_EFFORT_POWER 0x01 +#define HCI_SYNC_RETRANS_EFFORT_QUALITY 0x02 +#define HCI_SYNC_RETRANS_EFFORT_DONTCARE 0xff + #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 struct hci_cp_accept_sync_conn_req { bdaddr_t bdaddr; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index db1c5df4522..096ac5ec898 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -296,6 +296,7 @@ struct hci_conn { __u8 type; bool out; __u8 attempt; + __u8 no_autoretry; __u8 dev_class[3]; __u8 features[8]; __u16 interval; @@ -333,6 +334,8 @@ struct hci_conn { void *sco_data; void *smp_conn; + struct bt_sco_parameters *sco_parameters; + struct hci_conn *link; void (*connect_cfm_cb) (struct hci_conn *conn, u8 status); @@ -561,7 +564,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle); void hci_setup_sync(struct hci_conn *conn, __u16 handle); void hci_sco_setup(struct hci_conn *conn, __u8 status); -struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); +struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, + bdaddr_t *dst); int hci_conn_del(struct hci_conn *conn); void hci_conn_hash_flush(struct hci_dev *hdev); void hci_conn_check_pending(struct hci_dev *hdev); @@ -571,7 +575,8 @@ int hci_chan_del(struct hci_chan *chan); void hci_chan_list_flush(struct hci_conn *conn); struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, - __u8 sec_level, __u8 auth_type); + __u8 sec_level, __u8 auth_type, + struct bt_sco_parameters *sco_parameters); int hci_conn_check_link_mode(struct hci_conn *conn); int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index 1e35c43657c..e6b5a94f7e8 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h @@ -72,7 +72,9 @@ struct sco_conn { struct sco_pinfo { struct bt_sock bt; - __u32 flags; + struct bt_sco_parameters param; + __u8 no_autoretry; + struct sco_conn *conn; }; -- cgit v1.2.3