Loading drivers/bluetooth/ath3k.c +279 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,30 @@ #define VERSION "1.0" #define VERSION "1.0" #define ATH3K_DNLOAD 0x01 #define ATH3K_GETSTATE 0x05 #define ATH3K_SET_NORMAL_MODE 0x07 #define ATH3K_GETVERSION 0x09 #define USB_REG_SWITCH_VID_PID 0x0a #define ATH3K_MODE_MASK 0x3F #define ATH3K_NORMAL_MODE 0x0E #define ATH3K_PATCH_UPDATE 0x80 #define ATH3K_SYSCFG_UPDATE 0x40 #define ATH3K_XTAL_FREQ_26M 0x00 #define ATH3K_XTAL_FREQ_40M 0x01 #define ATH3K_XTAL_FREQ_19P2 0x02 #define ATH3K_NAME_LEN 0xFF struct ath3k_version { unsigned int rom_version; unsigned int build_version; unsigned int ram_version; unsigned char ref_clock; unsigned char reserved[0x07]; }; static struct usb_device_id ath3k_table[] = { static struct usb_device_id ath3k_table[] = { /* Atheros AR3011 */ /* Atheros AR3011 */ Loading @@ -41,13 +65,29 @@ static struct usb_device_id ath3k_table[] = { /* Atheros AR9285 Malbec with sflash firmware */ /* Atheros AR9285 Malbec with sflash firmware */ { USB_DEVICE(0x03F0, 0x311D) }, { USB_DEVICE(0x03F0, 0x311D) }, /* Atheros AR3012 with sflash firmware*/ { USB_DEVICE(0x0CF3, 0x3004) }, { } /* Terminating entry */ { } /* Terminating entry */ }; }; MODULE_DEVICE_TABLE(usb, ath3k_table); MODULE_DEVICE_TABLE(usb, ath3k_table); #define BTUSB_ATH3012 0x80 /* This table is to load patch and sysconfig files * for AR3012 */ static struct usb_device_id ath3k_blist_tbl[] = { /* Atheros AR3012 with sflash firmware*/ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, { } /* Terminating entry */ }; #define USB_REQ_DFU_DNLOAD 1 #define USB_REQ_DFU_DNLOAD 1 #define BULK_SIZE 4096 #define BULK_SIZE 4096 #define FW_HDR_SIZE 20 static int ath3k_load_firmware(struct usb_device *udev, static int ath3k_load_firmware(struct usb_device *udev, const struct firmware *firmware) const struct firmware *firmware) Loading Loading @@ -103,6 +143,215 @@ error: return err; return err; } } static int ath3k_get_state(struct usb_device *udev, unsigned char *state) { int pipe = 0; pipe = usb_rcvctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_GETSTATE, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, state, 0x01, USB_CTRL_SET_TIMEOUT); } static int ath3k_get_version(struct usb_device *udev, struct ath3k_version *version) { int pipe = 0; pipe = usb_rcvctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_GETVERSION, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, sizeof(struct ath3k_version), USB_CTRL_SET_TIMEOUT); } static int ath3k_load_fwfile(struct usb_device *udev, const struct firmware *firmware) { u8 *send_buf; int err, pipe, len, size, count, sent = 0; int ret; count = firmware->size; send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); if (!send_buf) { BT_ERR("Can't allocate memory chunk for firmware"); return -ENOMEM; } size = min_t(uint, count, FW_HDR_SIZE); memcpy(send_buf, firmware->data, size); pipe = usb_sndctrlpipe(udev, 0); ret = usb_control_msg(udev, pipe, ATH3K_DNLOAD, USB_TYPE_VENDOR, 0, 0, send_buf, size, USB_CTRL_SET_TIMEOUT); if (ret < 0) { BT_ERR("Can't change to loading configuration err"); kfree(send_buf); return ret; } sent += size; count -= size; while (count) { size = min_t(uint, count, BULK_SIZE); pipe = usb_sndbulkpipe(udev, 0x02); memcpy(send_buf, firmware->data + sent, size); err = usb_bulk_msg(udev, pipe, send_buf, size, &len, 3000); if (err || (len != size)) { BT_ERR("Error in firmware loading err = %d," "len = %d, size = %d", err, len, size); kfree(send_buf); return err; } sent += size; count -= size; } kfree(send_buf); return 0; } static int ath3k_switch_pid(struct usb_device *udev) { int pipe = 0; pipe = usb_sndctrlpipe(udev, 0); return usb_control_msg(udev, pipe, USB_REG_SWITCH_VID_PID, USB_TYPE_VENDOR, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); } static int ath3k_set_normal_mode(struct usb_device *udev) { unsigned char fw_state; int pipe = 0, ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to normal mode err"); return ret; } if ((fw_state & ATH3K_MODE_MASK) == ATH3K_NORMAL_MODE) { BT_DBG("firmware was already in normal mode"); return 0; } pipe = usb_sndctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_SET_NORMAL_MODE, USB_TYPE_VENDOR, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); } static int ath3k_load_patch(struct usb_device *udev) { unsigned char fw_state; char filename[ATH3K_NAME_LEN] = {0}; const struct firmware *firmware; struct ath3k_version fw_version, pt_version; int ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to load ram patch err"); return ret; } if (fw_state & ATH3K_PATCH_UPDATE) { BT_DBG("Patch was already downloaded"); return 0; } ret = ath3k_get_version(udev, &fw_version); if (ret < 0) { BT_ERR("Can't get version to change to load ram patch err"); return ret; } snprintf(filename, ATH3K_NAME_LEN, "ar3k/AthrBT_0x%08x.dfu", fw_version.rom_version); ret = request_firmware(&firmware, filename, &udev->dev); if (ret < 0) { BT_ERR("Patch file not found %s", filename); return ret; } pt_version.rom_version = *(int *)(firmware->data + firmware->size - 8); pt_version.build_version = *(int *) (firmware->data + firmware->size - 4); if ((pt_version.rom_version != fw_version.rom_version) || (pt_version.build_version <= fw_version.build_version)) { BT_ERR("Patch file version did not match with firmware"); release_firmware(firmware); return -EINVAL; } ret = ath3k_load_fwfile(udev, firmware); release_firmware(firmware); return ret; } static int ath3k_load_syscfg(struct usb_device *udev) { unsigned char fw_state; char filename[ATH3K_NAME_LEN] = {0}; const struct firmware *firmware; struct ath3k_version fw_version; int clk_value, ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to load configration err"); return -EBUSY; } ret = ath3k_get_version(udev, &fw_version); if (ret < 0) { BT_ERR("Can't get version to change to load ram patch err"); return ret; } switch (fw_version.ref_clock) { case ATH3K_XTAL_FREQ_26M: clk_value = 26; break; case ATH3K_XTAL_FREQ_40M: clk_value = 40; break; case ATH3K_XTAL_FREQ_19P2: clk_value = 19; break; default: clk_value = 0; break; } snprintf(filename, ATH3K_NAME_LEN, "ar3k/ramps_0x%08x_%d%s", fw_version.rom_version, clk_value, ".dfu"); ret = request_firmware(&firmware, filename, &udev->dev); if (ret < 0) { BT_ERR("Configuration file not found %s", filename); return ret; } ret = ath3k_load_fwfile(udev, firmware); release_firmware(firmware); return ret; } static int ath3k_probe(struct usb_interface *intf, static int ath3k_probe(struct usb_interface *intf, const struct usb_device_id *id) const struct usb_device_id *id) { { Loading @@ -115,7 +364,37 @@ static int ath3k_probe(struct usb_interface *intf, if (intf->cur_altsetting->desc.bInterfaceNumber != 0) if (intf->cur_altsetting->desc.bInterfaceNumber != 0) return -ENODEV; return -ENODEV; /* match device ID in ath3k blacklist table */ if (!id->driver_info) { const struct usb_device_id *match; match = usb_match_id(intf, ath3k_blist_tbl); if (match) id = match; } /* load patch and sysconfig files for AR3012 */ if (id->driver_info & BTUSB_ATH3012) { ret = ath3k_load_patch(udev); if (ret < 0) { BT_ERR("Loading patch file failed"); return ret; } ret = ath3k_load_syscfg(udev); if (ret < 0) { BT_ERR("Loading sysconfig file failed"); return ret; } ret = ath3k_set_normal_mode(udev); if (ret < 0) { BT_ERR("Set normal mode failed"); return ret; } ath3k_switch_pid(udev); return 0; } if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { BT_ERR("Error loading firmware"); return -EIO; return -EIO; } } Loading drivers/bluetooth/btusb.c +6 −7 Original line number Original line Diff line number Diff line Loading @@ -105,6 +105,9 @@ static struct usb_device_id blacklist_table[] = { /* Atheros AR9285 Malbec with sflash firmware */ /* Atheros AR9285 Malbec with sflash firmware */ { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, /* Atheros 3012 with sflash firmware */ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_IGNORE }, /* Broadcom BCM2035 */ /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, Loading Loading @@ -711,15 +714,11 @@ static int btusb_send_frame(struct sk_buff *skb) pipe = usb_sndisocpipe(data->udev, pipe = usb_sndisocpipe(data->udev, data->isoc_tx_ep->bEndpointAddress); data->isoc_tx_ep->bEndpointAddress); urb->dev = data->udev; usb_fill_int_urb(urb, data->udev, pipe, urb->pipe = pipe; skb->data, skb->len, btusb_isoc_tx_complete, urb->context = skb; skb, data->isoc_tx_ep->bInterval); urb->complete = btusb_isoc_tx_complete; urb->interval = data->isoc_tx_ep->bInterval; urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP; urb->transfer_buffer = skb->data; urb->transfer_buffer_length = skb->len; __fill_isoc_descriptor(urb, skb->len, __fill_isoc_descriptor(urb, skb->len, le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); Loading drivers/bluetooth/hci_ldisc.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -398,6 +398,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) hdev->flush = hci_uart_flush; hdev->flush = hci_uart_flush; hdev->send = hci_uart_send_frame; hdev->send = hci_uart_send_frame; hdev->destruct = hci_uart_destruct; hdev->destruct = hci_uart_destruct; hdev->parent = hu->tty->dev; hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE; Loading include/net/bluetooth/bluetooth.h +28 −0 Original line number Original line Diff line number Diff line Loading @@ -205,4 +205,32 @@ extern void bt_sysfs_cleanup(void); extern struct dentry *bt_debugfs; extern struct dentry *bt_debugfs; #ifdef CONFIG_BT_L2CAP int l2cap_init(void); void l2cap_exit(void); #else static inline int l2cap_init(void) { return 0; } static inline void l2cap_exit(void) { } #endif #ifdef CONFIG_BT_SCO int sco_init(void); void sco_exit(void); #else static inline int sco_init(void) { return 0; } static inline void sco_exit(void) { } #endif #endif /* __BLUETOOTH_H */ #endif /* __BLUETOOTH_H */ include/net/bluetooth/hci.h +65 −0 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ enum { #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ /* HCI data types */ /* HCI data types */ #define HCI_COMMAND_PKT 0x01 #define HCI_COMMAND_PKT 0x01 Loading Loading @@ -168,6 +169,8 @@ enum { #define SCO_LINK 0x00 #define SCO_LINK 0x00 #define ACL_LINK 0x01 #define ACL_LINK 0x01 #define ESCO_LINK 0x02 #define ESCO_LINK 0x02 /* Low Energy links do not have defined link type. Use invented one */ #define LE_LINK 0x80 /* LMP features */ /* LMP features */ #define LMP_3SLOT 0x01 #define LMP_3SLOT 0x01 Loading Loading @@ -242,6 +245,8 @@ enum { #define HCI_AT_GENERAL_BONDING_MITM 0x05 #define HCI_AT_GENERAL_BONDING_MITM 0x05 /* ----- HCI Commands ---- */ /* ----- HCI Commands ---- */ #define HCI_OP_NOP 0x0000 #define HCI_OP_INQUIRY 0x0401 #define HCI_OP_INQUIRY 0x0401 struct hci_cp_inquiry { struct hci_cp_inquiry { __u8 lap[3]; __u8 lap[3]; Loading Loading @@ -642,6 +647,47 @@ struct hci_rp_read_bd_addr { bdaddr_t bdaddr; bdaddr_t bdaddr; } __packed; } __packed; #define HCI_OP_LE_SET_EVENT_MASK 0x2001 struct hci_cp_le_set_event_mask { __u8 mask[8]; } __packed; #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 struct hci_rp_le_read_buffer_size { __u8 status; __le16 le_mtu; __u8 le_max_pkt; } __packed; #define HCI_OP_LE_CREATE_CONN 0x200d struct hci_cp_le_create_conn { __le16 scan_interval; __le16 scan_window; __u8 filter_policy; __u8 peer_addr_type; bdaddr_t peer_addr; __u8 own_address_type; __le16 conn_interval_min; __le16 conn_interval_max; __le16 conn_latency; __le16 supervision_timeout; __le16 min_ce_len; __le16 max_ce_len; } __packed; #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e #define HCI_OP_LE_CONN_UPDATE 0x2013 struct hci_cp_le_conn_update { __le16 handle; __le16 conn_interval_min; __le16 conn_interval_max; __le16 conn_latency; __le16 supervision_timeout; __le16 min_ce_len; __le16 max_ce_len; } __packed; /* ---- HCI Events ---- */ /* ---- HCI Events ---- */ #define HCI_EV_INQUIRY_COMPLETE 0x01 #define HCI_EV_INQUIRY_COMPLETE 0x01 Loading Loading @@ -902,6 +948,25 @@ struct hci_ev_remote_host_features { __u8 features[8]; __u8 features[8]; } __packed; } __packed; #define HCI_EV_LE_META 0x3e struct hci_ev_le_meta { __u8 subevent; } __packed; /* Low energy meta events */ #define HCI_EV_LE_CONN_COMPLETE 0x01 struct hci_ev_le_conn_complete { __u8 status; __le16 handle; __u8 role; __u8 bdaddr_type; bdaddr_t bdaddr; __le16 interval; __le16 latency; __le16 supervision_timeout; __u8 clk_accurancy; } __packed; /* Internal events generated by Bluetooth stack */ /* Internal events generated by Bluetooth stack */ #define HCI_EV_STACK_INTERNAL 0xfd #define HCI_EV_STACK_INTERNAL 0xfd struct hci_ev_stack_internal { struct hci_ev_stack_internal { Loading Loading
drivers/bluetooth/ath3k.c +279 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,30 @@ #define VERSION "1.0" #define VERSION "1.0" #define ATH3K_DNLOAD 0x01 #define ATH3K_GETSTATE 0x05 #define ATH3K_SET_NORMAL_MODE 0x07 #define ATH3K_GETVERSION 0x09 #define USB_REG_SWITCH_VID_PID 0x0a #define ATH3K_MODE_MASK 0x3F #define ATH3K_NORMAL_MODE 0x0E #define ATH3K_PATCH_UPDATE 0x80 #define ATH3K_SYSCFG_UPDATE 0x40 #define ATH3K_XTAL_FREQ_26M 0x00 #define ATH3K_XTAL_FREQ_40M 0x01 #define ATH3K_XTAL_FREQ_19P2 0x02 #define ATH3K_NAME_LEN 0xFF struct ath3k_version { unsigned int rom_version; unsigned int build_version; unsigned int ram_version; unsigned char ref_clock; unsigned char reserved[0x07]; }; static struct usb_device_id ath3k_table[] = { static struct usb_device_id ath3k_table[] = { /* Atheros AR3011 */ /* Atheros AR3011 */ Loading @@ -41,13 +65,29 @@ static struct usb_device_id ath3k_table[] = { /* Atheros AR9285 Malbec with sflash firmware */ /* Atheros AR9285 Malbec with sflash firmware */ { USB_DEVICE(0x03F0, 0x311D) }, { USB_DEVICE(0x03F0, 0x311D) }, /* Atheros AR3012 with sflash firmware*/ { USB_DEVICE(0x0CF3, 0x3004) }, { } /* Terminating entry */ { } /* Terminating entry */ }; }; MODULE_DEVICE_TABLE(usb, ath3k_table); MODULE_DEVICE_TABLE(usb, ath3k_table); #define BTUSB_ATH3012 0x80 /* This table is to load patch and sysconfig files * for AR3012 */ static struct usb_device_id ath3k_blist_tbl[] = { /* Atheros AR3012 with sflash firmware*/ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, { } /* Terminating entry */ }; #define USB_REQ_DFU_DNLOAD 1 #define USB_REQ_DFU_DNLOAD 1 #define BULK_SIZE 4096 #define BULK_SIZE 4096 #define FW_HDR_SIZE 20 static int ath3k_load_firmware(struct usb_device *udev, static int ath3k_load_firmware(struct usb_device *udev, const struct firmware *firmware) const struct firmware *firmware) Loading Loading @@ -103,6 +143,215 @@ error: return err; return err; } } static int ath3k_get_state(struct usb_device *udev, unsigned char *state) { int pipe = 0; pipe = usb_rcvctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_GETSTATE, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, state, 0x01, USB_CTRL_SET_TIMEOUT); } static int ath3k_get_version(struct usb_device *udev, struct ath3k_version *version) { int pipe = 0; pipe = usb_rcvctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_GETVERSION, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, sizeof(struct ath3k_version), USB_CTRL_SET_TIMEOUT); } static int ath3k_load_fwfile(struct usb_device *udev, const struct firmware *firmware) { u8 *send_buf; int err, pipe, len, size, count, sent = 0; int ret; count = firmware->size; send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); if (!send_buf) { BT_ERR("Can't allocate memory chunk for firmware"); return -ENOMEM; } size = min_t(uint, count, FW_HDR_SIZE); memcpy(send_buf, firmware->data, size); pipe = usb_sndctrlpipe(udev, 0); ret = usb_control_msg(udev, pipe, ATH3K_DNLOAD, USB_TYPE_VENDOR, 0, 0, send_buf, size, USB_CTRL_SET_TIMEOUT); if (ret < 0) { BT_ERR("Can't change to loading configuration err"); kfree(send_buf); return ret; } sent += size; count -= size; while (count) { size = min_t(uint, count, BULK_SIZE); pipe = usb_sndbulkpipe(udev, 0x02); memcpy(send_buf, firmware->data + sent, size); err = usb_bulk_msg(udev, pipe, send_buf, size, &len, 3000); if (err || (len != size)) { BT_ERR("Error in firmware loading err = %d," "len = %d, size = %d", err, len, size); kfree(send_buf); return err; } sent += size; count -= size; } kfree(send_buf); return 0; } static int ath3k_switch_pid(struct usb_device *udev) { int pipe = 0; pipe = usb_sndctrlpipe(udev, 0); return usb_control_msg(udev, pipe, USB_REG_SWITCH_VID_PID, USB_TYPE_VENDOR, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); } static int ath3k_set_normal_mode(struct usb_device *udev) { unsigned char fw_state; int pipe = 0, ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to normal mode err"); return ret; } if ((fw_state & ATH3K_MODE_MASK) == ATH3K_NORMAL_MODE) { BT_DBG("firmware was already in normal mode"); return 0; } pipe = usb_sndctrlpipe(udev, 0); return usb_control_msg(udev, pipe, ATH3K_SET_NORMAL_MODE, USB_TYPE_VENDOR, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); } static int ath3k_load_patch(struct usb_device *udev) { unsigned char fw_state; char filename[ATH3K_NAME_LEN] = {0}; const struct firmware *firmware; struct ath3k_version fw_version, pt_version; int ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to load ram patch err"); return ret; } if (fw_state & ATH3K_PATCH_UPDATE) { BT_DBG("Patch was already downloaded"); return 0; } ret = ath3k_get_version(udev, &fw_version); if (ret < 0) { BT_ERR("Can't get version to change to load ram patch err"); return ret; } snprintf(filename, ATH3K_NAME_LEN, "ar3k/AthrBT_0x%08x.dfu", fw_version.rom_version); ret = request_firmware(&firmware, filename, &udev->dev); if (ret < 0) { BT_ERR("Patch file not found %s", filename); return ret; } pt_version.rom_version = *(int *)(firmware->data + firmware->size - 8); pt_version.build_version = *(int *) (firmware->data + firmware->size - 4); if ((pt_version.rom_version != fw_version.rom_version) || (pt_version.build_version <= fw_version.build_version)) { BT_ERR("Patch file version did not match with firmware"); release_firmware(firmware); return -EINVAL; } ret = ath3k_load_fwfile(udev, firmware); release_firmware(firmware); return ret; } static int ath3k_load_syscfg(struct usb_device *udev) { unsigned char fw_state; char filename[ATH3K_NAME_LEN] = {0}; const struct firmware *firmware; struct ath3k_version fw_version; int clk_value, ret; ret = ath3k_get_state(udev, &fw_state); if (ret < 0) { BT_ERR("Can't get state to change to load configration err"); return -EBUSY; } ret = ath3k_get_version(udev, &fw_version); if (ret < 0) { BT_ERR("Can't get version to change to load ram patch err"); return ret; } switch (fw_version.ref_clock) { case ATH3K_XTAL_FREQ_26M: clk_value = 26; break; case ATH3K_XTAL_FREQ_40M: clk_value = 40; break; case ATH3K_XTAL_FREQ_19P2: clk_value = 19; break; default: clk_value = 0; break; } snprintf(filename, ATH3K_NAME_LEN, "ar3k/ramps_0x%08x_%d%s", fw_version.rom_version, clk_value, ".dfu"); ret = request_firmware(&firmware, filename, &udev->dev); if (ret < 0) { BT_ERR("Configuration file not found %s", filename); return ret; } ret = ath3k_load_fwfile(udev, firmware); release_firmware(firmware); return ret; } static int ath3k_probe(struct usb_interface *intf, static int ath3k_probe(struct usb_interface *intf, const struct usb_device_id *id) const struct usb_device_id *id) { { Loading @@ -115,7 +364,37 @@ static int ath3k_probe(struct usb_interface *intf, if (intf->cur_altsetting->desc.bInterfaceNumber != 0) if (intf->cur_altsetting->desc.bInterfaceNumber != 0) return -ENODEV; return -ENODEV; /* match device ID in ath3k blacklist table */ if (!id->driver_info) { const struct usb_device_id *match; match = usb_match_id(intf, ath3k_blist_tbl); if (match) id = match; } /* load patch and sysconfig files for AR3012 */ if (id->driver_info & BTUSB_ATH3012) { ret = ath3k_load_patch(udev); if (ret < 0) { BT_ERR("Loading patch file failed"); return ret; } ret = ath3k_load_syscfg(udev); if (ret < 0) { BT_ERR("Loading sysconfig file failed"); return ret; } ret = ath3k_set_normal_mode(udev); if (ret < 0) { BT_ERR("Set normal mode failed"); return ret; } ath3k_switch_pid(udev); return 0; } if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { BT_ERR("Error loading firmware"); return -EIO; return -EIO; } } Loading
drivers/bluetooth/btusb.c +6 −7 Original line number Original line Diff line number Diff line Loading @@ -105,6 +105,9 @@ static struct usb_device_id blacklist_table[] = { /* Atheros AR9285 Malbec with sflash firmware */ /* Atheros AR9285 Malbec with sflash firmware */ { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, /* Atheros 3012 with sflash firmware */ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_IGNORE }, /* Broadcom BCM2035 */ /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, Loading Loading @@ -711,15 +714,11 @@ static int btusb_send_frame(struct sk_buff *skb) pipe = usb_sndisocpipe(data->udev, pipe = usb_sndisocpipe(data->udev, data->isoc_tx_ep->bEndpointAddress); data->isoc_tx_ep->bEndpointAddress); urb->dev = data->udev; usb_fill_int_urb(urb, data->udev, pipe, urb->pipe = pipe; skb->data, skb->len, btusb_isoc_tx_complete, urb->context = skb; skb, data->isoc_tx_ep->bInterval); urb->complete = btusb_isoc_tx_complete; urb->interval = data->isoc_tx_ep->bInterval; urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP; urb->transfer_buffer = skb->data; urb->transfer_buffer_length = skb->len; __fill_isoc_descriptor(urb, skb->len, __fill_isoc_descriptor(urb, skb->len, le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); Loading
drivers/bluetooth/hci_ldisc.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -398,6 +398,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) hdev->flush = hci_uart_flush; hdev->flush = hci_uart_flush; hdev->send = hci_uart_send_frame; hdev->send = hci_uart_send_frame; hdev->destruct = hci_uart_destruct; hdev->destruct = hci_uart_destruct; hdev->parent = hu->tty->dev; hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE; Loading
include/net/bluetooth/bluetooth.h +28 −0 Original line number Original line Diff line number Diff line Loading @@ -205,4 +205,32 @@ extern void bt_sysfs_cleanup(void); extern struct dentry *bt_debugfs; extern struct dentry *bt_debugfs; #ifdef CONFIG_BT_L2CAP int l2cap_init(void); void l2cap_exit(void); #else static inline int l2cap_init(void) { return 0; } static inline void l2cap_exit(void) { } #endif #ifdef CONFIG_BT_SCO int sco_init(void); void sco_exit(void); #else static inline int sco_init(void) { return 0; } static inline void sco_exit(void) { } #endif #endif /* __BLUETOOTH_H */ #endif /* __BLUETOOTH_H */
include/net/bluetooth/hci.h +65 −0 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ enum { #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ #define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ #define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ #define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ #define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ /* HCI data types */ /* HCI data types */ #define HCI_COMMAND_PKT 0x01 #define HCI_COMMAND_PKT 0x01 Loading Loading @@ -168,6 +169,8 @@ enum { #define SCO_LINK 0x00 #define SCO_LINK 0x00 #define ACL_LINK 0x01 #define ACL_LINK 0x01 #define ESCO_LINK 0x02 #define ESCO_LINK 0x02 /* Low Energy links do not have defined link type. Use invented one */ #define LE_LINK 0x80 /* LMP features */ /* LMP features */ #define LMP_3SLOT 0x01 #define LMP_3SLOT 0x01 Loading Loading @@ -242,6 +245,8 @@ enum { #define HCI_AT_GENERAL_BONDING_MITM 0x05 #define HCI_AT_GENERAL_BONDING_MITM 0x05 /* ----- HCI Commands ---- */ /* ----- HCI Commands ---- */ #define HCI_OP_NOP 0x0000 #define HCI_OP_INQUIRY 0x0401 #define HCI_OP_INQUIRY 0x0401 struct hci_cp_inquiry { struct hci_cp_inquiry { __u8 lap[3]; __u8 lap[3]; Loading Loading @@ -642,6 +647,47 @@ struct hci_rp_read_bd_addr { bdaddr_t bdaddr; bdaddr_t bdaddr; } __packed; } __packed; #define HCI_OP_LE_SET_EVENT_MASK 0x2001 struct hci_cp_le_set_event_mask { __u8 mask[8]; } __packed; #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 struct hci_rp_le_read_buffer_size { __u8 status; __le16 le_mtu; __u8 le_max_pkt; } __packed; #define HCI_OP_LE_CREATE_CONN 0x200d struct hci_cp_le_create_conn { __le16 scan_interval; __le16 scan_window; __u8 filter_policy; __u8 peer_addr_type; bdaddr_t peer_addr; __u8 own_address_type; __le16 conn_interval_min; __le16 conn_interval_max; __le16 conn_latency; __le16 supervision_timeout; __le16 min_ce_len; __le16 max_ce_len; } __packed; #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e #define HCI_OP_LE_CONN_UPDATE 0x2013 struct hci_cp_le_conn_update { __le16 handle; __le16 conn_interval_min; __le16 conn_interval_max; __le16 conn_latency; __le16 supervision_timeout; __le16 min_ce_len; __le16 max_ce_len; } __packed; /* ---- HCI Events ---- */ /* ---- HCI Events ---- */ #define HCI_EV_INQUIRY_COMPLETE 0x01 #define HCI_EV_INQUIRY_COMPLETE 0x01 Loading Loading @@ -902,6 +948,25 @@ struct hci_ev_remote_host_features { __u8 features[8]; __u8 features[8]; } __packed; } __packed; #define HCI_EV_LE_META 0x3e struct hci_ev_le_meta { __u8 subevent; } __packed; /* Low energy meta events */ #define HCI_EV_LE_CONN_COMPLETE 0x01 struct hci_ev_le_conn_complete { __u8 status; __le16 handle; __u8 role; __u8 bdaddr_type; bdaddr_t bdaddr; __le16 interval; __le16 latency; __le16 supervision_timeout; __u8 clk_accurancy; } __packed; /* Internal events generated by Bluetooth stack */ /* Internal events generated by Bluetooth stack */ #define HCI_EV_STACK_INTERNAL 0xfd #define HCI_EV_STACK_INTERNAL 0xfd struct hci_ev_stack_internal { struct hci_ev_stack_internal { Loading