32 #include <linux/module.h>
36 #define MAX_BT_CHNL_IDS 3
41 #define BT_REGISTER_TIMEOUT 6000
60 static inline void ti_st_tx_complete(
struct ti_st *hst,
int pkt_type)
86 static void st_reg_completion_cb(
void *priv_data,
char data)
88 struct ti_st *lhst = priv_data;
98 static long st_receive(
void *priv_data,
struct sk_buff *
skb)
100 struct ti_st *lhst = priv_data;
111 skb->
dev = (
void *) lhst->
hdev;
116 BT_ERR(
"Unable to push skb to HCI core(%d)", err);
120 lhst->
hdev->stat.byte_rx += skb->
len;
152 static int ti_st_open(
struct hci_dev *hdev)
154 unsigned long timeleft;
164 hst = hci_get_drvdata(hdev);
169 ti_st_proto[
i].
recv = st_receive;
187 BT_ERR(
"st_register failed %d", err);
194 BT_DBG(
"waiting for registration "
195 "completion signal from ST");
201 BT_ERR(
"Timeout(%d sec),didn't get reg "
202 "completion signal from ST",
211 BT_ERR(
"ST registration completed with invalid "
219 BT_ERR(
"undefined ST write function");
225 BT_ERR(
"st_unregister() failed with "
236 static int ti_st_close(
struct hci_dev *hdev)
239 struct ti_st *hst = hci_get_drvdata(hdev);
244 for (i = MAX_BT_CHNL_IDS-1; i >= 0; i--) {
247 BT_ERR(
"st_unregister(%d) failed with error %d",
248 ti_st_proto[i].chnl_id, err);
256 static int ti_st_send_frame(
struct sk_buff *skb)
267 hst = hci_get_drvdata(hdev);
282 BT_ERR(
"ST write failed (%ld)", len);
288 hdev->
stat.byte_tx += len;
289 ti_st_tx_complete(hst,
bt_cb(skb)->pkt_type);
296 static struct ti_st *hst;
313 hci_set_drvdata(hdev, hst);
314 hdev->
open = ti_st_open;
315 hdev->
close = ti_st_close;
317 hdev->
send = ti_st_send_frame;
321 BT_ERR(
"Can't register HCI device error %d", err);
326 BT_DBG(
"HCI device registered (hdev %p)", hdev);
353 .probe = bt_ti_probe,
354 .remove = bt_ti_remove,