summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudha Bheemanna <b.sudha@samsung.com>2016-09-07 16:47:58 +0530
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-09-29 13:32:03 +0900
commitdf04b849a26abbd70c7adb9ee05c306195133b2b (patch)
treef42849e93c027514e79a65d138dd2c683bada78c
parent178c27389782160e462ffa356cb274443c7f854b (diff)
downloadlinux-exynos-df04b849a26abbd70c7adb9ee05c306195133b2b.tar.gz
linux-exynos-df04b849a26abbd70c7adb9ee05c306195133b2b.tar.bz2
linux-exynos-df04b849a26abbd70c7adb9ee05c306195133b2b.zip
Bluetooth: Add H/W TX timeout error MGMT event
This patch sends the H/W TX timeout error MGMT event if HCI command timeout occurs after sending HCI commands. Change-Id: I5eb593f2fe4d31c404dd94ef582790e47d03b10a Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
-rw-r--r--include/net/bluetooth/hci.h4
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--include/net/bluetooth/mgmt_tizen.h4
-rw-r--r--net/bluetooth/hci_core.c11
-rw-r--r--net/bluetooth/mgmt.c5
5 files changed, 25 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index e1b25d48b884..3f69599160d5 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -249,7 +249,11 @@ enum {
#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
+#ifdef TIZEN_BT
+#define HCI_CMD_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
+#else
#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
+#endif
#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 12880db25fc5..fcd6cb407314 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1516,6 +1516,7 @@ int mgmt_le_conn_updated(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
int mgmt_le_conn_update_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status);
void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code);
+void mgmt_tx_timeout_error(struct hci_dev *hdev);
#endif
u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h
index 680ad8b9b1a0..fd5a9fe3f390 100644
--- a/include/net/bluetooth/mgmt_tizen.h
+++ b/include/net/bluetooth/mgmt_tizen.h
@@ -169,6 +169,10 @@ struct mgmt_ev_hardware_error {
} __packed;
/* handling of hardware error event */
+/* For HCI TX Timeout Error */
+#define MGMT_EV_TX_TIMEOUT_ERROR (TIZEN_EV_BASE + 0x03)
+/* HCI TX Timeout Error */
+
/* For handling of RSSI Events */
#define MGMT_EV_RSSI_ALERT (TIZEN_EV_BASE + 0x04)
struct mgmt_ev_vendor_specific_rssi_alert {
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bd6557aa8e3e..dd2cf2ac14d5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1106,6 +1106,13 @@ void hci_le_discovery_set_state(struct hci_dev *hdev, int state)
hdev->le_discovery.state = state;
}
+
+static void hci_tx_timeout_error_evt(struct hci_dev *hdev)
+{
+ BT_ERR("%s H/W TX Timeout error", hdev->name);
+
+ mgmt_tx_timeout_error(hdev);
+}
#endif
void hci_inquiry_cache_flush(struct hci_dev *hdev)
@@ -2581,6 +2588,10 @@ static void hci_cmd_timeout(struct work_struct *work)
BT_ERR("%s command tx timeout", hdev->name);
}
+#ifdef TIZEN_BT
+ hci_tx_timeout_error_evt(hdev);
+#endif
+
atomic_set(&hdev->cmd_cnt, 1);
queue_work(hdev->workqueue, &hdev->cmd_work);
}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f2e6e8858c99..e8bfe58bd8bb 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7169,6 +7169,11 @@ void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code)
ev.error_code = err_code;
mgmt_event(MGMT_EV_HARDWARE_ERROR, hdev, &ev, sizeof(ev), NULL);
}
+
+void mgmt_tx_timeout_error(struct hci_dev *hdev)
+{
+ mgmt_event(MGMT_EV_TX_TIMEOUT_ERROR, hdev, NULL, 0, NULL);
+}
#endif /* TIZEN_BT */
static bool ltk_is_valid(struct mgmt_ltk_info *key)