3 * Bluetooth HCI UART driver for Intel devices
5 * Copyright (C) 2015 Intel Corporation
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <linux/kernel.h>
25 #include <linux/errno.h>
26 #include <linux/skbuff.h>
27 #include <linux/firmware.h>
28 #include <linux/module.h>
29 #include <linux/wait.h>
30 #include <linux/tty.h>
31 #include <linux/platform_device.h>
32 #include <linux/gpio/consumer.h>
33 #include <linux/acpi.h>
34 #include <linux/interrupt.h>
36 #include <net/bluetooth/bluetooth.h>
37 #include <net/bluetooth/hci_core.h>
42 #define STATE_BOOTLOADER 0
43 #define STATE_DOWNLOADING 1
44 #define STATE_FIRMWARE_LOADED 2
45 #define STATE_FIRMWARE_FAILED 3
46 #define STATE_BOOTING 4
47 #define STATE_LPM_ENABLED 5
48 #define STATE_TX_ACTIVE 6
50 #define HCI_LPM_PKT 0xf1
51 #define HCI_LPM_MAX_SIZE 10
52 #define HCI_LPM_HDR_SIZE HCI_EVENT_HDR_SIZE
54 #define LPM_OP_TX_NOTIFY 0x00
63 struct list_head list;
64 struct platform_device *pdev;
65 struct gpio_desc *reset;
69 static LIST_HEAD(intel_device_list);
70 static DEFINE_MUTEX(intel_device_list_lock);
73 struct sk_buff *rx_skb;
74 struct sk_buff_head txq;
78 static u8 intel_convert_speed(unsigned int speed)
110 static int intel_wait_booting(struct hci_uart *hu)
112 struct intel_data *intel = hu->priv;
115 err = wait_on_bit_timeout(&intel->flags, STATE_BOOTING,
117 msecs_to_jiffies(1000));
120 bt_dev_err(hu->hdev, "Device boot interrupted");
125 bt_dev_err(hu->hdev, "Device boot timeout");
132 static irqreturn_t intel_irq(int irq, void *dev_id)
134 struct intel_device *idev = dev_id;
136 dev_info(&idev->pdev->dev, "hci_intel irq\n");
141 static int intel_set_power(struct hci_uart *hu, bool powered)
146 mutex_lock(&intel_device_list_lock);
148 list_for_each(p, &intel_device_list) {
149 struct intel_device *idev = list_entry(p, struct intel_device,
152 /* tty device and pdev device should share the same parent
153 * which is the UART port.
155 if (hu->tty->dev->parent != idev->pdev->dev.parent)
163 BT_INFO("hu %p, Switching compatible pm device (%s) to %u",
164 hu, dev_name(&idev->pdev->dev), powered);
166 gpiod_set_value(idev->reset, powered);
171 if (powered && device_can_wakeup(&idev->pdev->dev)) {
172 err = devm_request_threaded_irq(&idev->pdev->dev,
176 "bt-host-wake", idev);
178 BT_ERR("hu %p, unable to allocate irq-%d",
183 device_wakeup_enable(&idev->pdev->dev);
184 } else if (!powered && device_may_wakeup(&idev->pdev->dev)) {
185 devm_free_irq(&idev->pdev->dev, idev->irq, idev);
186 device_wakeup_disable(&idev->pdev->dev);
190 mutex_unlock(&intel_device_list_lock);
195 static int intel_open(struct hci_uart *hu)
197 struct intel_data *intel;
201 intel = kzalloc(sizeof(*intel), GFP_KERNEL);
205 skb_queue_head_init(&intel->txq);
209 if (!intel_set_power(hu, true))
210 set_bit(STATE_BOOTING, &intel->flags);
215 static int intel_close(struct hci_uart *hu)
217 struct intel_data *intel = hu->priv;
221 intel_set_power(hu, false);
223 skb_queue_purge(&intel->txq);
224 kfree_skb(intel->rx_skb);
231 static int intel_flush(struct hci_uart *hu)
233 struct intel_data *intel = hu->priv;
237 skb_queue_purge(&intel->txq);
242 static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
245 struct hci_event_hdr *hdr;
246 struct hci_ev_cmd_complete *evt;
248 skb = bt_skb_alloc(sizeof(*hdr) + sizeof(*evt) + 1, GFP_ATOMIC);
252 hdr = (struct hci_event_hdr *)skb_put(skb, sizeof(*hdr));
253 hdr->evt = HCI_EV_CMD_COMPLETE;
254 hdr->plen = sizeof(*evt) + 1;
256 evt = (struct hci_ev_cmd_complete *)skb_put(skb, sizeof(*evt));
258 evt->opcode = cpu_to_le16(opcode);
260 *skb_put(skb, 1) = 0x00;
262 bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
264 return hci_recv_frame(hdev, skb);
267 static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed)
269 struct intel_data *intel = hu->priv;
270 struct hci_dev *hdev = hu->hdev;
271 u8 speed_cmd[] = { 0x06, 0xfc, 0x01, 0x00 };
275 /* This can be the first command sent to the chip, check
276 * that the controller is ready.
278 err = intel_wait_booting(hu);
280 clear_bit(STATE_BOOTING, &intel->flags);
282 /* In case of timeout, try to continue anyway */
283 if (err && err != ETIMEDOUT)
286 bt_dev_info(hdev, "Change controller speed to %d", speed);
288 speed_cmd[3] = intel_convert_speed(speed);
289 if (speed_cmd[3] == 0xff) {
290 bt_dev_err(hdev, "Unsupported speed");
294 /* Device will not accept speed change if Intel version has not been
295 * previously requested.
297 skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT);
299 bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
305 skb = bt_skb_alloc(sizeof(speed_cmd), GFP_KERNEL);
307 bt_dev_err(hdev, "Failed to alloc memory for baudrate packet");
311 memcpy(skb_put(skb, sizeof(speed_cmd)), speed_cmd, sizeof(speed_cmd));
312 bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
314 hci_uart_set_flow_control(hu, true);
316 skb_queue_tail(&intel->txq, skb);
317 hci_uart_tx_wakeup(hu);
319 /* wait 100ms to change baudrate on controller side */
322 hci_uart_set_baudrate(hu, speed);
323 hci_uart_set_flow_control(hu, false);
328 static int intel_setup(struct hci_uart *hu)
330 static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
331 0x00, 0x08, 0x04, 0x00 };
332 static const u8 lpm_param[] = { 0x03, 0x07, 0x01, 0x0b };
333 struct intel_data *intel = hu->priv;
334 struct intel_device *idev = NULL;
335 struct hci_dev *hdev = hu->hdev;
337 struct intel_version *ver;
338 struct intel_boot_params *params;
340 const struct firmware *fw;
344 ktime_t calltime, delta, rettime;
345 unsigned long long duration;
346 unsigned int init_speed, oper_speed;
347 int speed_change = 0;
350 bt_dev_dbg(hdev, "start intel_setup");
352 hu->hdev->set_bdaddr = btintel_set_bdaddr;
354 calltime = ktime_get();
357 init_speed = hu->init_speed;
359 init_speed = hu->proto->init_speed;
362 oper_speed = hu->oper_speed;
364 oper_speed = hu->proto->oper_speed;
366 if (oper_speed && init_speed && oper_speed != init_speed)
369 /* Check that the controller is ready */
370 err = intel_wait_booting(hu);
372 clear_bit(STATE_BOOTING, &intel->flags);
374 /* In case of timeout, try to continue anyway */
375 if (err && err != ETIMEDOUT)
378 set_bit(STATE_BOOTLOADER, &intel->flags);
380 /* Read the Intel version information to determine if the device
381 * is in bootloader mode or if it already has operational firmware
384 skb = __hci_cmd_sync(hdev, 0xfc05, 0, NULL, HCI_INIT_TIMEOUT);
386 bt_dev_err(hdev, "Reading Intel version information failed (%ld)",
391 if (skb->len != sizeof(*ver)) {
392 bt_dev_err(hdev, "Intel version event size mismatch");
397 ver = (struct intel_version *)skb->data;
399 bt_dev_err(hdev, "Intel version command failure (%02x)",
401 err = -bt_to_errno(ver->status);
406 /* The hardware platform number has a fixed value of 0x37 and
407 * for now only accept this single value.
409 if (ver->hw_platform != 0x37) {
410 bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)",
416 /* At the moment only the hardware variant iBT 3.0 (LnP/SfP) is
417 * supported by this firmware loading method. This check has been
418 * put in place to ensure correct forward compatibility options
419 * when newer hardware variants come along.
421 if (ver->hw_variant != 0x0b) {
422 bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
428 btintel_version_info(hdev, ver);
430 /* The firmware variant determines if the device is in bootloader
431 * mode or is running operational firmware. The value 0x06 identifies
432 * the bootloader and the value 0x23 identifies the operational
435 * When the operational firmware is already present, then only
436 * the check for valid Bluetooth device address is needed. This
437 * determines if the device will be added as configured or
438 * unconfigured controller.
440 * It is not possible to use the Secure Boot Parameters in this
441 * case since that command is only available in bootloader mode.
443 if (ver->fw_variant == 0x23) {
445 clear_bit(STATE_BOOTLOADER, &intel->flags);
446 btintel_check_bdaddr(hdev);
450 /* If the device is not in bootloader mode, then the only possible
451 * choice is to return an error and abort the device initialization.
453 if (ver->fw_variant != 0x06) {
454 bt_dev_err(hdev, "Unsupported Intel firmware variant (%u)",
462 /* Read the secure boot parameters to identify the operating
463 * details of the bootloader.
465 skb = __hci_cmd_sync(hdev, 0xfc0d, 0, NULL, HCI_INIT_TIMEOUT);
467 bt_dev_err(hdev, "Reading Intel boot parameters failed (%ld)",
472 if (skb->len != sizeof(*params)) {
473 bt_dev_err(hdev, "Intel boot parameters size mismatch");
478 params = (struct intel_boot_params *)skb->data;
479 if (params->status) {
480 bt_dev_err(hdev, "Intel boot parameters command failure (%02x)",
482 err = -bt_to_errno(params->status);
487 bt_dev_info(hdev, "Device revision is %u",
488 le16_to_cpu(params->dev_revid));
490 bt_dev_info(hdev, "Secure boot is %s",
491 params->secure_boot ? "enabled" : "disabled");
493 bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
494 params->min_fw_build_nn, params->min_fw_build_cw,
495 2000 + params->min_fw_build_yy);
497 /* It is required that every single firmware fragment is acknowledged
498 * with a command complete event. If the boot parameters indicate
499 * that this bootloader does not send them, then abort the setup.
501 if (params->limited_cce != 0x00) {
502 bt_dev_err(hdev, "Unsupported Intel firmware loading method (%u)",
503 params->limited_cce);
508 /* If the OTP has no valid Bluetooth device address, then there will
509 * also be no valid address for the operational firmware.
511 if (!bacmp(¶ms->otp_bdaddr, BDADDR_ANY)) {
512 bt_dev_info(hdev, "No device address configured");
513 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
516 /* With this Intel bootloader only the hardware variant and device
517 * revision information are used to select the right firmware.
519 * Currently this bootloader support is limited to hardware variant
520 * iBT 3.0 (LnP/SfP) which is identified by the value 11 (0x0b).
522 snprintf(fwname, sizeof(fwname), "intel/ibt-11-%u.sfi",
523 le16_to_cpu(params->dev_revid));
525 err = request_firmware(&fw, fwname, &hdev->dev);
527 bt_dev_err(hdev, "Failed to load Intel firmware file (%d)",
533 bt_dev_info(hdev, "Found device firmware: %s", fwname);
537 if (fw->size < 644) {
538 bt_dev_err(hdev, "Invalid size of firmware file (%zu)",
544 set_bit(STATE_DOWNLOADING, &intel->flags);
546 /* Start the firmware download transaction with the Init fragment
547 * represented by the 128 bytes of CSS header.
549 err = btintel_secure_send(hdev, 0x00, 128, fw->data);
551 bt_dev_err(hdev, "Failed to send firmware header (%d)", err);
555 /* Send the 256 bytes of public key information from the firmware
556 * as the PKey fragment.
558 err = btintel_secure_send(hdev, 0x03, 256, fw->data + 128);
560 bt_dev_err(hdev, "Failed to send firmware public key (%d)",
565 /* Send the 256 bytes of signature information from the firmware
566 * as the Sign fragment.
568 err = btintel_secure_send(hdev, 0x02, 256, fw->data + 388);
570 bt_dev_err(hdev, "Failed to send firmware signature (%d)",
575 fw_ptr = fw->data + 644;
578 while (fw_ptr - fw->data < fw->size) {
579 struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len);
581 frag_len += sizeof(*cmd) + cmd->plen;
583 bt_dev_dbg(hdev, "Patching %td/%zu", (fw_ptr - fw->data),
586 /* The parameter length of the secure send command requires
587 * a 4 byte alignment. It happens so that the firmware file
588 * contains proper Intel_NOP commands to align the fragments
591 * Send set of commands with 4 byte alignment from the
592 * firmware data buffer as a single Data fragement.
597 /* Send each command from the firmware data buffer as
598 * a single Data fragment.
600 err = btintel_secure_send(hdev, 0x01, frag_len, fw_ptr);
602 bt_dev_err(hdev, "Failed to send firmware data (%d)",
611 set_bit(STATE_FIRMWARE_LOADED, &intel->flags);
613 bt_dev_info(hdev, "Waiting for firmware download to complete");
615 /* Before switching the device into operational mode and with that
616 * booting the loaded firmware, wait for the bootloader notification
617 * that all fragments have been successfully received.
619 * When the event processing receives the notification, then the
620 * STATE_DOWNLOADING flag will be cleared.
622 * The firmware loading should not take longer than 5 seconds
623 * and thus just timeout if that happens and fail the setup
626 err = wait_on_bit_timeout(&intel->flags, STATE_DOWNLOADING,
628 msecs_to_jiffies(5000));
630 bt_dev_err(hdev, "Firmware loading interrupted");
636 bt_dev_err(hdev, "Firmware loading timeout");
641 if (test_bit(STATE_FIRMWARE_FAILED, &intel->flags)) {
642 bt_dev_err(hdev, "Firmware loading failed");
647 rettime = ktime_get();
648 delta = ktime_sub(rettime, calltime);
649 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
651 bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
654 release_firmware(fw);
659 /* We need to restore the default speed before Intel reset */
661 err = intel_set_baudrate(hu, init_speed);
666 calltime = ktime_get();
668 set_bit(STATE_BOOTING, &intel->flags);
670 skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param,
677 /* The bootloader will not indicate when the device is ready. This
678 * is done by the operational firmware sending bootup notification.
680 * Booting into operational firmware should not take longer than
681 * 1 second. However if that happens, then just fail the setup
682 * since something went wrong.
684 bt_dev_info(hdev, "Waiting for device to boot");
686 err = intel_wait_booting(hu);
690 clear_bit(STATE_BOOTING, &intel->flags);
692 rettime = ktime_get();
693 delta = ktime_sub(rettime, calltime);
694 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
696 bt_dev_info(hdev, "Device booted in %llu usecs", duration);
698 /* Enable LPM if matching pdev with wakeup enabled */
699 mutex_lock(&intel_device_list_lock);
700 list_for_each(p, &intel_device_list) {
701 struct intel_device *dev = list_entry(p, struct intel_device,
703 if (hu->tty->dev->parent == dev->pdev->dev.parent) {
704 if (device_may_wakeup(&dev->pdev->dev))
709 mutex_unlock(&intel_device_list_lock);
714 bt_dev_info(hdev, "Enabling LPM");
716 skb = __hci_cmd_sync(hdev, 0xfc8b, sizeof(lpm_param), lpm_param,
719 bt_dev_err(hdev, "Failed to enable LPM");
724 set_bit(STATE_LPM_ENABLED, &intel->flags);
727 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_CMD_TIMEOUT);
733 err = intel_set_baudrate(hu, oper_speed);
738 bt_dev_info(hdev, "Setup complete");
740 clear_bit(STATE_BOOTLOADER, &intel->flags);
745 static int intel_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
747 struct hci_uart *hu = hci_get_drvdata(hdev);
748 struct intel_data *intel = hu->priv;
749 struct hci_event_hdr *hdr;
751 if (!test_bit(STATE_BOOTLOADER, &intel->flags) &&
752 !test_bit(STATE_BOOTING, &intel->flags))
755 hdr = (void *)skb->data;
757 /* When the firmware loading completes the device sends
758 * out a vendor specific event indicating the result of
759 * the firmware loading.
761 if (skb->len == 7 && hdr->evt == 0xff && hdr->plen == 0x05 &&
762 skb->data[2] == 0x06) {
763 if (skb->data[3] != 0x00)
764 set_bit(STATE_FIRMWARE_FAILED, &intel->flags);
766 if (test_and_clear_bit(STATE_DOWNLOADING, &intel->flags) &&
767 test_bit(STATE_FIRMWARE_LOADED, &intel->flags)) {
768 smp_mb__after_atomic();
769 wake_up_bit(&intel->flags, STATE_DOWNLOADING);
772 /* When switching to the operational firmware the device
773 * sends a vendor specific event indicating that the bootup
776 } else if (skb->len == 9 && hdr->evt == 0xff && hdr->plen == 0x07 &&
777 skb->data[2] == 0x02) {
778 if (test_and_clear_bit(STATE_BOOTING, &intel->flags)) {
779 smp_mb__after_atomic();
780 wake_up_bit(&intel->flags, STATE_BOOTING);
784 return hci_recv_frame(hdev, skb);
787 static void intel_recv_lpm_notify(struct hci_dev *hdev, int value)
789 struct hci_uart *hu = hci_get_drvdata(hdev);
790 struct intel_data *intel = hu->priv;
792 bt_dev_dbg(hdev, "TX idle notification (%d)", value);
795 set_bit(STATE_TX_ACTIVE, &intel->flags);
797 clear_bit(STATE_TX_ACTIVE, &intel->flags);
800 static int intel_recv_lpm(struct hci_dev *hdev, struct sk_buff *skb)
802 struct hci_lpm_pkt *lpm = (void *)skb->data;
804 switch (lpm->opcode) {
805 case LPM_OP_TX_NOTIFY:
807 intel_recv_lpm_notify(hdev, lpm->data[0]);
810 bt_dev_err(hdev, "Unknown LPM opcode (%02x)", lpm->opcode);
819 #define INTEL_RECV_LPM \
820 .type = HCI_LPM_PKT, \
821 .hlen = HCI_LPM_HDR_SIZE, \
824 .maxlen = HCI_LPM_MAX_SIZE
826 static const struct h4_recv_pkt intel_recv_pkts[] = {
827 { H4_RECV_ACL, .recv = hci_recv_frame },
828 { H4_RECV_SCO, .recv = hci_recv_frame },
829 { H4_RECV_EVENT, .recv = intel_recv_event },
830 { INTEL_RECV_LPM, .recv = intel_recv_lpm },
833 static int intel_recv(struct hci_uart *hu, const void *data, int count)
835 struct intel_data *intel = hu->priv;
837 if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
840 intel->rx_skb = h4_recv_buf(hu->hdev, intel->rx_skb, data, count,
842 ARRAY_SIZE(intel_recv_pkts));
843 if (IS_ERR(intel->rx_skb)) {
844 int err = PTR_ERR(intel->rx_skb);
845 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
846 intel->rx_skb = NULL;
853 static int intel_enqueue(struct hci_uart *hu, struct sk_buff *skb)
855 struct intel_data *intel = hu->priv;
857 BT_DBG("hu %p skb %p", hu, skb);
859 skb_queue_tail(&intel->txq, skb);
864 static struct sk_buff *intel_dequeue(struct hci_uart *hu)
866 struct intel_data *intel = hu->priv;
869 skb = skb_dequeue(&intel->txq);
873 if (test_bit(STATE_BOOTLOADER, &intel->flags) &&
874 (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT)) {
875 struct hci_command_hdr *cmd = (void *)skb->data;
876 __u16 opcode = le16_to_cpu(cmd->opcode);
878 /* When the 0xfc01 command is issued to boot into
879 * the operational firmware, it will actually not
880 * send a command complete event. To keep the flow
881 * control working inject that event here.
883 if (opcode == 0xfc01)
884 inject_cmd_complete(hu->hdev, opcode);
887 /* Prepend skb with frame type */
888 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
893 static const struct hci_uart_proto intel_proto = {
894 .id = HCI_UART_INTEL,
896 .init_speed = 115200,
897 .oper_speed = 3000000,
899 .close = intel_close,
900 .flush = intel_flush,
901 .setup = intel_setup,
902 .set_baudrate = intel_set_baudrate,
904 .enqueue = intel_enqueue,
905 .dequeue = intel_dequeue,
909 static const struct acpi_device_id intel_acpi_match[] = {
913 MODULE_DEVICE_TABLE(acpi, intel_acpi_match);
915 static int intel_acpi_probe(struct intel_device *idev)
917 const struct acpi_device_id *id;
919 id = acpi_match_device(intel_acpi_match, &idev->pdev->dev);
926 static int intel_acpi_probe(struct intel_device *idev)
932 static int intel_probe(struct platform_device *pdev)
934 struct intel_device *idev;
936 idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL);
942 if (ACPI_HANDLE(&pdev->dev)) {
943 int err = intel_acpi_probe(idev);
950 idev->reset = devm_gpiod_get_optional(&pdev->dev, "reset",
952 if (IS_ERR(idev->reset)) {
953 dev_err(&pdev->dev, "Unable to retrieve gpio\n");
954 return PTR_ERR(idev->reset);
957 idev->irq = platform_get_irq(pdev, 0);
959 struct gpio_desc *host_wake;
961 dev_err(&pdev->dev, "No IRQ, falling back to gpio-irq\n");
963 host_wake = devm_gpiod_get_optional(&pdev->dev, "host-wake",
965 if (IS_ERR(host_wake)) {
966 dev_err(&pdev->dev, "Unable to retrieve IRQ\n");
970 idev->irq = gpiod_to_irq(host_wake);
972 dev_err(&pdev->dev, "No corresponding irq for gpio\n");
977 /* Only enable wake-up/irq when controller is powered */
978 device_set_wakeup_capable(&pdev->dev, true);
979 device_wakeup_disable(&pdev->dev);
982 platform_set_drvdata(pdev, idev);
984 /* Place this instance on the device list */
985 mutex_lock(&intel_device_list_lock);
986 list_add_tail(&idev->list, &intel_device_list);
987 mutex_unlock(&intel_device_list_lock);
989 dev_info(&pdev->dev, "registered, gpio(%d)/irq(%d).\n",
990 desc_to_gpio(idev->reset), idev->irq);
995 static int intel_remove(struct platform_device *pdev)
997 struct intel_device *idev = platform_get_drvdata(pdev);
999 device_wakeup_disable(&pdev->dev);
1001 mutex_lock(&intel_device_list_lock);
1002 list_del(&idev->list);
1003 mutex_unlock(&intel_device_list_lock);
1005 dev_info(&pdev->dev, "unregistered.\n");
1010 static struct platform_driver intel_driver = {
1011 .probe = intel_probe,
1012 .remove = intel_remove,
1014 .name = "hci_intel",
1015 .acpi_match_table = ACPI_PTR(intel_acpi_match),
1019 int __init intel_init(void)
1021 platform_driver_register(&intel_driver);
1023 return hci_uart_register_proto(&intel_proto);
1026 int __exit intel_deinit(void)
1028 platform_driver_unregister(&intel_driver);
1030 return hci_uart_unregister_proto(&intel_proto);