Bluetooth: Add MGMT command to set SCO settings 76/306576/1
authorSudha Bheemanna <b.sudha@samsung.com>
Tue, 6 Sep 2016 11:08:36 +0000 (16:38 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 23 Feb 2024 02:13:41 +0000 (11:13 +0900)
Added code to set sco settings.

Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
[remove sco link policy part]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I5d7a594e50a37b7886dd6b9b9c90ea00c0bc9dda

include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt_tizen.h
include/net/bluetooth/sco.h

index de473e2..4b9df2d 100644 (file)
@@ -2280,6 +2280,29 @@ struct hci_cc_rp_get_raw_rssi {
        __le16  conn_handle;
        __s8    rssi_dbm;
 } __packed;
+
+#define HCI_BCM_ENABLE_WBS_REQ         0xfc7e
+struct hci_cp_bcm_wbs_req {
+       __u8    role;
+       __le16  pkt_type;
+} __packed;
+
+#define HCI_BCM_I2C_PCM_REQ            0xfc6d
+struct hci_cp_i2c_pcm_req {
+       __u8    i2c_enable;
+       __u8    is_master;
+       __u8    pcm_rate;
+       __u8    clock_rate;
+} __packed;
+
+#define HCI_BCM_SCO_PCM_REQ            0xfc1c
+struct hci_cp_sco_pcm_req {
+       __u8    sco_routing;
+       __u8    pcm_rate;
+       __u8    frame_type;
+       __u8    sync_mode;
+       __u8    clock_mode;
+} __packed;
 #endif
 
 /* ---- HCI Events ---- */
index 02588f4..8258305 100644 (file)
@@ -792,6 +792,8 @@ struct hci_conn {
 
 #ifdef TIZEN_BT
        bool            rssi_monitored;
+       __u8            sco_role;
+       __u16           voice_setting;
 #endif
        struct list_head link_list;
        struct hci_conn *parent;
@@ -1529,6 +1531,23 @@ static inline int hci_conn_hash_lookup_rssi_count(struct hci_dev *hdev)
 
 bool hci_le_discovery_active(struct hci_dev *hdev);
 void hci_le_discovery_set_state(struct hci_dev *hdev, int state);
+
+static inline struct hci_conn *hci_conn_hash_lookup_sco(struct hci_dev *hdev)
+{
+       struct hci_conn_hash *h = &hdev->conn_hash;
+       struct hci_conn  *c;
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(c, &h->list, list) {
+               if (c->type == SCO_LINK || c->type == ESCO_LINK) {
+                       rcu_read_unlock();
+                       return c;
+               }
+       }
+       rcu_read_unlock();
+
+       return NULL;
+}
 #endif
 
 int hci_disconnect(struct hci_conn *conn, __u8 reason);
index 504c2d4..4eaa867 100644 (file)
@@ -151,6 +151,16 @@ struct mgmt_cp_le_set_scan_params {
 } __packed;
 #define MGMT_LE_SET_SCAN_PARAMS_SIZE           5
 
+#define MGMT_SCO_ROLE_HANDSFREE                        0x00
+#define MGMT_SCO_ROLE_AUDIO_GATEWAY            0x01
+#define MGMT_OP_SET_VOICE_SETTING              (TIZEN_OP_CODE_BASE + 0x10)
+struct mgmt_cp_set_voice_setting {
+       bdaddr_t        bdaddr;
+       uint8_t         sco_role;
+       uint16_t        voice_setting;
+} __packed;
+#define MGMT_SET_VOICE_SETTING_SIZE            9
+
 /* EVENTS */
 
 /* For device name update changes */
index f40ddb4..bca05bf 100644 (file)
@@ -46,4 +46,11 @@ struct sco_conninfo {
        __u8  dev_class[3];
 };
 
+#ifdef TIZEN_BT
+void sco_connect_set_gw_nbc(struct hci_dev *hdev);
+void sco_connect_set_gw_wbc(struct hci_dev *hdev);
+void sco_connect_set_nbc(struct hci_dev *hdev);
+void sco_connect_set_wbc(struct hci_dev *hdev);
+#endif
+
 #endif /* __SCO_H */