1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved. */
4 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6 #include <linux/module.h>
7 #include <linux/kernel.h>
9 #include <linux/sched.h>
10 #include <linux/kthread.h>
11 #include <linux/usb/cdc.h>
12 #include <linux/wait.h>
13 #include <linux/if_ether.h>
14 #include <linux/pm_runtime.h>
19 #include "hci_packet.h"
20 #include "gdm_endian.h"
22 #define USB_DEVICE_CDC_DATA(vid, pid) \
23 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
24 USB_DEVICE_ID_MATCH_INT_CLASS | \
25 USB_DEVICE_ID_MATCH_INT_SUBCLASS,\
28 .bInterfaceClass = USB_CLASS_COMM,\
29 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET
31 #define USB_DEVICE_MASS_DATA(vid, pid) \
32 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
33 USB_DEVICE_ID_MATCH_INT_INFO,\
36 .bInterfaceSubClass = USB_SC_SCSI, \
37 .bInterfaceClass = USB_CLASS_MASS_STORAGE,\
38 .bInterfaceProtocol = USB_PR_BULK
40 static const struct usb_device_id id_table[] = {
41 { USB_DEVICE_CDC_DATA(VID_GCT, PID_GDM7240) }, /* GCT GDM7240 */
42 { USB_DEVICE_CDC_DATA(VID_GCT, PID_GDM7243) }, /* GCT GDM7243 */
46 MODULE_DEVICE_TABLE(usb, id_table);
48 static void do_tx(struct work_struct *work);
49 static void do_rx(struct work_struct *work);
51 static int gdm_usb_recv(void *priv_dev,
52 int (*cb)(void *cb_data,
53 void *data, int len, int context),
57 static int request_mac_address(struct lte_udev *udev)
59 struct hci_packet *hci;
60 struct usb_device *usbdev = udev->usbdev;
64 hci = kmalloc(struct_size(hci, data, 1), GFP_KERNEL);
68 hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION);
69 hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1);
70 hci->data[0] = MAC_ADDRESS;
72 ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), hci, 5,
75 udev->request_mac_addr = 1;
81 static struct usb_tx *alloc_tx_struct(int len)
83 struct usb_tx *t = NULL;
86 t = kzalloc(sizeof(*t), GFP_ATOMIC);
92 t->urb = usb_alloc_urb(0, GFP_ATOMIC);
96 t->buf = kmalloc(len, GFP_ATOMIC);
97 if (!t->urb || !t->buf) {
105 usb_free_urb(t->urb);
115 static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
117 struct usb_tx_sdu *t_sdu;
119 t_sdu = kzalloc(sizeof(*t_sdu), GFP_KERNEL);
123 t_sdu->buf = kmalloc(SDU_BUF_SIZE, GFP_KERNEL);
132 static void free_tx_struct(struct usb_tx *t)
135 usb_free_urb(t->urb);
141 static void free_tx_sdu_struct(struct usb_tx_sdu *t_sdu)
149 static struct usb_tx_sdu *get_tx_sdu_struct(struct tx_cxt *tx, int *no_spc)
151 struct usb_tx_sdu *t_sdu;
153 if (list_empty(&tx->free_list))
156 t_sdu = list_entry(tx->free_list.next, struct usb_tx_sdu, list);
157 list_del(&t_sdu->list);
161 *no_spc = list_empty(&tx->free_list) ? 1 : 0;
166 static void put_tx_struct(struct tx_cxt *tx, struct usb_tx_sdu *t_sdu)
168 list_add_tail(&t_sdu->list, &tx->free_list);
172 static struct usb_rx *alloc_rx_struct(void)
174 struct usb_rx *r = NULL;
177 r = kmalloc(sizeof(*r), GFP_KERNEL);
183 r->urb = usb_alloc_urb(0, GFP_KERNEL);
184 r->buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
185 if (!r->urb || !r->buf) {
193 usb_free_urb(r->urb);
203 static void free_rx_struct(struct usb_rx *r)
206 usb_free_urb(r->urb);
212 static struct usb_rx *get_rx_struct(struct rx_cxt *rx, int *no_spc)
217 spin_lock_irqsave(&rx->rx_lock, flags);
219 if (list_empty(&rx->free_list)) {
220 spin_unlock_irqrestore(&rx->rx_lock, flags);
224 r = list_entry(rx->free_list.next, struct usb_rx, free_list);
225 list_del(&r->free_list);
229 *no_spc = list_empty(&rx->free_list) ? 1 : 0;
231 spin_unlock_irqrestore(&rx->rx_lock, flags);
236 static void put_rx_struct(struct rx_cxt *rx, struct usb_rx *r)
240 spin_lock_irqsave(&rx->rx_lock, flags);
242 list_add_tail(&r->free_list, &rx->free_list);
245 spin_unlock_irqrestore(&rx->rx_lock, flags);
248 static void release_usb(struct lte_udev *udev)
250 struct rx_cxt *rx = &udev->rx;
251 struct tx_cxt *tx = &udev->tx;
252 struct usb_tx *t, *t_next;
253 struct usb_rx *r, *r_next;
254 struct usb_tx_sdu *t_sdu, *t_sdu_next;
257 spin_lock_irqsave(&tx->lock, flags);
258 list_for_each_entry_safe(t_sdu, t_sdu_next, &tx->sdu_list, list) {
259 list_del(&t_sdu->list);
260 free_tx_sdu_struct(t_sdu);
263 list_for_each_entry_safe(t, t_next, &tx->hci_list, list) {
268 list_for_each_entry_safe(t_sdu, t_sdu_next, &tx->free_list, list) {
269 list_del(&t_sdu->list);
270 free_tx_sdu_struct(t_sdu);
272 spin_unlock_irqrestore(&tx->lock, flags);
274 spin_lock_irqsave(&rx->submit_lock, flags);
275 list_for_each_entry_safe(r, r_next, &rx->rx_submit_list,
277 spin_unlock_irqrestore(&rx->submit_lock, flags);
278 usb_kill_urb(r->urb);
279 spin_lock_irqsave(&rx->submit_lock, flags);
281 spin_unlock_irqrestore(&rx->submit_lock, flags);
283 spin_lock_irqsave(&rx->rx_lock, flags);
284 list_for_each_entry_safe(r, r_next, &rx->free_list, free_list) {
285 list_del(&r->free_list);
288 spin_unlock_irqrestore(&rx->rx_lock, flags);
290 spin_lock_irqsave(&rx->to_host_lock, flags);
291 list_for_each_entry_safe(r, r_next, &rx->to_host_list, to_host_list) {
292 if (r->index == (void *)udev) {
293 list_del(&r->to_host_list);
297 spin_unlock_irqrestore(&rx->to_host_lock, flags);
300 static int init_usb(struct lte_udev *udev)
304 struct tx_cxt *tx = &udev->tx;
305 struct rx_cxt *rx = &udev->rx;
306 struct usb_tx_sdu *t_sdu = NULL;
307 struct usb_rx *r = NULL;
309 udev->send_complete = 1;
311 udev->request_mac_addr = 0;
312 udev->usb_state = PM_NORMAL;
314 INIT_LIST_HEAD(&tx->sdu_list);
315 INIT_LIST_HEAD(&tx->hci_list);
316 INIT_LIST_HEAD(&tx->free_list);
317 INIT_LIST_HEAD(&rx->rx_submit_list);
318 INIT_LIST_HEAD(&rx->free_list);
319 INIT_LIST_HEAD(&rx->to_host_list);
320 spin_lock_init(&tx->lock);
321 spin_lock_init(&rx->rx_lock);
322 spin_lock_init(&rx->submit_lock);
323 spin_lock_init(&rx->to_host_lock);
330 for (i = 0; i < MAX_NUM_SDU_BUF; i++) {
331 t_sdu = alloc_tx_sdu_struct();
337 list_add(&t_sdu->list, &tx->free_list);
341 for (i = 0; i < MAX_RX_SUBMIT_COUNT * 2; i++) {
342 r = alloc_rx_struct();
348 list_add(&r->free_list, &rx->free_list);
351 INIT_DELAYED_WORK(&udev->work_tx, do_tx);
352 INIT_DELAYED_WORK(&udev->work_rx, do_rx);
359 static int set_mac_address(u8 *data, void *arg)
361 struct phy_dev *phy_dev = arg;
362 struct lte_udev *udev = phy_dev->priv_dev;
363 struct tlv *tlv = (struct tlv *)data;
364 u8 mac_address[ETH_ALEN] = {0, };
366 if (tlv->type == MAC_ADDRESS && udev->request_mac_addr) {
367 memcpy(mac_address, tlv->data, tlv->len);
369 if (register_lte_device(phy_dev,
370 &udev->intf->dev, mac_address) < 0)
371 pr_err("register lte device failed\n");
373 udev->request_mac_addr = 0;
381 static void do_rx(struct work_struct *work)
383 struct lte_udev *udev =
384 container_of(work, struct lte_udev, work_rx.work);
385 struct rx_cxt *rx = &udev->rx;
387 struct hci_packet *hci;
388 struct phy_dev *phy_dev;
394 spin_lock_irqsave(&rx->to_host_lock, flags);
395 if (list_empty(&rx->to_host_list)) {
396 spin_unlock_irqrestore(&rx->to_host_lock, flags);
399 r = list_entry(rx->to_host_list.next,
400 struct usb_rx, to_host_list);
401 list_del(&r->to_host_list);
402 spin_unlock_irqrestore(&rx->to_host_lock, flags);
404 phy_dev = r->cb_data;
405 udev = phy_dev->priv_dev;
406 hci = (struct hci_packet *)r->buf;
407 cmd_evt = gdm_dev16_to_cpu(udev->gdm_ed, hci->cmd_evt);
410 case LTE_GET_INFORMATION_RESULT:
411 if (set_mac_address(hci->data, r->cb_data) == 0) {
412 r->callback(r->cb_data,
414 r->urb->actual_length,
421 ret = r->callback(r->cb_data,
423 r->urb->actual_length,
427 pr_err("failed to send received data\n");
432 put_rx_struct(rx, r);
441 static void remove_rx_submit_list(struct usb_rx *r, struct rx_cxt *rx)
444 struct usb_rx *r_remove, *r_remove_next;
446 spin_lock_irqsave(&rx->submit_lock, flags);
447 list_for_each_entry_safe(r_remove, r_remove_next,
448 &rx->rx_submit_list, rx_submit_list) {
450 list_del(&r->rx_submit_list);
454 spin_unlock_irqrestore(&rx->submit_lock, flags);
457 static void gdm_usb_rcv_complete(struct urb *urb)
459 struct usb_rx *r = urb->context;
460 struct rx_cxt *rx = r->rx;
462 struct lte_udev *udev = container_of(r->rx, struct lte_udev, rx);
463 struct usb_device *usbdev = udev->usbdev;
465 remove_rx_submit_list(r, rx);
467 if (!urb->status && r->callback) {
468 spin_lock_irqsave(&rx->to_host_lock, flags);
469 list_add_tail(&r->to_host_list, &rx->to_host_list);
470 schedule_work(&udev->work_rx.work);
471 spin_unlock_irqrestore(&rx->to_host_lock, flags);
473 if (urb->status && udev->usb_state == PM_NORMAL)
474 dev_err(&urb->dev->dev, "%s: urb status error %d\n",
475 __func__, urb->status);
477 put_rx_struct(rx, r);
480 usb_mark_last_busy(usbdev);
483 static int gdm_usb_recv(void *priv_dev,
484 int (*cb)(void *cb_data,
485 void *data, int len, int context),
489 struct lte_udev *udev = priv_dev;
490 struct usb_device *usbdev = udev->usbdev;
491 struct rx_cxt *rx = &udev->rx;
498 pr_err("invalid device\n");
502 r = get_rx_struct(rx, &no_spc);
504 pr_err("Out of Memory\n");
510 r->cb_data = cb_data;
511 r->index = (void *)udev;
514 usb_fill_bulk_urb(r->urb,
516 usb_rcvbulkpipe(usbdev, 0x83),
519 gdm_usb_rcv_complete,
522 spin_lock_irqsave(&rx->submit_lock, flags);
523 list_add_tail(&r->rx_submit_list, &rx->rx_submit_list);
524 spin_unlock_irqrestore(&rx->submit_lock, flags);
526 if (context == KERNEL_THREAD)
527 ret = usb_submit_urb(r->urb, GFP_KERNEL);
529 ret = usb_submit_urb(r->urb, GFP_ATOMIC);
532 spin_lock_irqsave(&rx->submit_lock, flags);
533 list_del(&r->rx_submit_list);
534 spin_unlock_irqrestore(&rx->submit_lock, flags);
536 pr_err("usb_submit_urb failed (%p)\n", r);
537 put_rx_struct(rx, r);
543 static void gdm_usb_send_complete(struct urb *urb)
545 struct usb_tx *t = urb->context;
546 struct tx_cxt *tx = t->tx;
547 struct lte_udev *udev = container_of(tx, struct lte_udev, tx);
550 if (urb->status == -ECONNRESET) {
551 dev_info(&urb->dev->dev, "CONNRESET\n");
556 t->callback(t->cb_data);
560 spin_lock_irqsave(&tx->lock, flags);
561 udev->send_complete = 1;
562 schedule_work(&udev->work_tx.work);
563 spin_unlock_irqrestore(&tx->lock, flags);
566 static int send_tx_packet(struct usb_device *usbdev, struct usb_tx *t, u32 len)
573 usb_fill_bulk_urb(t->urb,
575 usb_sndbulkpipe(usbdev, 2),
578 gdm_usb_send_complete,
581 ret = usb_submit_urb(t->urb, GFP_ATOMIC);
584 dev_err(&usbdev->dev, "usb_submit_urb failed: %d\n",
587 usb_mark_last_busy(usbdev);
592 static u32 packet_aggregation(struct lte_udev *udev, u8 *send_buf)
594 struct tx_cxt *tx = &udev->tx;
595 struct usb_tx_sdu *t_sdu = NULL;
596 struct multi_sdu *multi_sdu = (struct multi_sdu *)send_buf;
601 multi_sdu->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_TX_MULTI_SDU);
603 while (num_packet < MAX_PACKET_IN_MULTI_SDU) {
604 spin_lock_irqsave(&tx->lock, flags);
605 if (list_empty(&tx->sdu_list)) {
606 spin_unlock_irqrestore(&tx->lock, flags);
610 t_sdu = list_entry(tx->sdu_list.next, struct usb_tx_sdu, list);
611 if (send_len + t_sdu->len > MAX_SDU_SIZE) {
612 spin_unlock_irqrestore(&tx->lock, flags);
616 list_del(&t_sdu->list);
617 spin_unlock_irqrestore(&tx->lock, flags);
619 memcpy(multi_sdu->data + send_len, t_sdu->buf, t_sdu->len);
621 send_len += (t_sdu->len + 3) & 0xfffc;
624 if (tx->avail_count > 10)
625 t_sdu->callback(t_sdu->cb_data);
627 spin_lock_irqsave(&tx->lock, flags);
628 put_tx_struct(tx, t_sdu);
629 spin_unlock_irqrestore(&tx->lock, flags);
632 multi_sdu->len = gdm_cpu_to_dev16(udev->gdm_ed, send_len);
633 multi_sdu->num_packet = gdm_cpu_to_dev16(udev->gdm_ed, num_packet);
635 return send_len + offsetof(struct multi_sdu, data);
638 static void do_tx(struct work_struct *work)
640 struct lte_udev *udev =
641 container_of(work, struct lte_udev, work_tx.work);
642 struct usb_device *usbdev = udev->usbdev;
643 struct tx_cxt *tx = &udev->tx;
644 struct usb_tx *t = NULL;
649 if (!usb_autopm_get_interface(udev->intf))
650 usb_autopm_put_interface(udev->intf);
652 if (udev->usb_state == PM_SUSPEND)
655 spin_lock_irqsave(&tx->lock, flags);
656 if (!udev->send_complete) {
657 spin_unlock_irqrestore(&tx->lock, flags);
660 udev->send_complete = 0;
662 if (!list_empty(&tx->hci_list)) {
663 t = list_entry(tx->hci_list.next, struct usb_tx, list);
668 } else if (!list_empty(&tx->sdu_list)) {
670 udev->send_complete = 1;
671 spin_unlock_irqrestore(&tx->lock, flags);
675 t = alloc_tx_struct(TX_BUF_SIZE);
677 spin_unlock_irqrestore(&tx->lock, flags);
687 udev->send_complete = 1;
688 spin_unlock_irqrestore(&tx->lock, flags);
691 spin_unlock_irqrestore(&tx->lock, flags);
694 len = packet_aggregation(udev, t->buf);
696 if (send_tx_packet(usbdev, t, len)) {
697 pr_err("send_tx_packet failed\n");
699 gdm_usb_send_complete(t->urb);
703 #define SDU_PARAM_LEN 12
704 static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
705 unsigned int dft_eps_ID, unsigned int eps_ID,
706 void (*cb)(void *data), void *cb_data,
707 int dev_idx, int nic_type)
709 struct lte_udev *udev = priv_dev;
710 struct tx_cxt *tx = &udev->tx;
711 struct usb_tx_sdu *t_sdu;
712 struct sdu *sdu = NULL;
718 pr_err("sdu send - invalid device\n");
722 spin_lock_irqsave(&tx->lock, flags);
723 t_sdu = get_tx_sdu_struct(tx, &no_spc);
724 spin_unlock_irqrestore(&tx->lock, flags);
727 pr_err("sdu send - free list empty\n");
731 sdu = (struct sdu *)t_sdu->buf;
732 sdu->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_TX_SDU);
733 if (nic_type == NIC_TYPE_ARP) {
734 send_len = len + SDU_PARAM_LEN;
735 memcpy(sdu->data, data, len);
737 send_len = len - ETH_HLEN;
738 send_len += SDU_PARAM_LEN;
739 memcpy(sdu->data, data + ETH_HLEN, len - ETH_HLEN);
742 sdu->len = gdm_cpu_to_dev16(udev->gdm_ed, send_len);
743 sdu->dft_eps_ID = gdm_cpu_to_dev32(udev->gdm_ed, dft_eps_ID);
744 sdu->bearer_ID = gdm_cpu_to_dev32(udev->gdm_ed, eps_ID);
745 sdu->nic_type = gdm_cpu_to_dev32(udev->gdm_ed, nic_type);
747 t_sdu->len = send_len + HCI_HEADER_SIZE;
748 t_sdu->callback = cb;
749 t_sdu->cb_data = cb_data;
751 spin_lock_irqsave(&tx->lock, flags);
752 list_add_tail(&t_sdu->list, &tx->sdu_list);
753 schedule_work(&udev->work_tx.work);
754 spin_unlock_irqrestore(&tx->lock, flags);
762 static int gdm_usb_hci_send(void *priv_dev, void *data, int len,
763 void (*cb)(void *data), void *cb_data)
765 struct lte_udev *udev = priv_dev;
766 struct tx_cxt *tx = &udev->tx;
771 pr_err("hci send - invalid device\n");
775 t = alloc_tx_struct(len);
777 pr_err("hci_send - out of memory\n");
781 memcpy(t->buf, data, len);
783 t->cb_data = cb_data;
788 spin_lock_irqsave(&tx->lock, flags);
789 list_add_tail(&t->list, &tx->hci_list);
790 schedule_work(&udev->work_tx.work);
791 spin_unlock_irqrestore(&tx->lock, flags);
796 static u8 gdm_usb_get_endian(void *priv_dev)
798 struct lte_udev *udev = priv_dev;
803 static int gdm_usb_probe(struct usb_interface *intf,
804 const struct usb_device_id *id)
807 struct phy_dev *phy_dev = NULL;
808 struct lte_udev *udev = NULL;
809 u16 idVendor, idProduct;
810 int bInterfaceNumber;
811 struct usb_device *usbdev = interface_to_usbdev(intf);
813 bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
814 idVendor = __le16_to_cpu(usbdev->descriptor.idVendor);
815 idProduct = __le16_to_cpu(usbdev->descriptor.idProduct);
817 pr_info("net vid = 0x%04x pid = 0x%04x\n", idVendor, idProduct);
819 if (bInterfaceNumber > NETWORK_INTERFACE) {
820 pr_info("not a network device\n");
824 phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
828 udev = kzalloc(sizeof(*udev), GFP_KERNEL);
834 phy_dev->priv_dev = (void *)udev;
835 phy_dev->send_hci_func = gdm_usb_hci_send;
836 phy_dev->send_sdu_func = gdm_usb_sdu_send;
837 phy_dev->rcv_func = gdm_usb_recv;
838 phy_dev->get_endian = gdm_usb_get_endian;
840 udev->usbdev = usbdev;
841 ret = init_usb(udev);
843 dev_err(intf->usb_dev, "init_usb func failed\n");
848 intf->needs_remote_wakeup = 1;
849 usb_enable_autosuspend(usbdev);
850 pm_runtime_set_autosuspend_delay(&usbdev->dev, AUTO_SUSPEND_TIMER);
852 /* List up hosts with big endians, otherwise,
853 * defaults to little endian
855 if (idProduct == PID_GDM7243)
856 udev->gdm_ed = ENDIANNESS_BIG;
858 udev->gdm_ed = ENDIANNESS_LITTLE;
860 ret = request_mac_address(udev);
862 dev_err(intf->usb_dev, "request Mac address failed\n");
863 goto err_mac_address;
866 start_rx_proc(phy_dev);
868 usb_set_intfdata(intf, phy_dev);
882 static void gdm_usb_disconnect(struct usb_interface *intf)
884 struct phy_dev *phy_dev;
885 struct lte_udev *udev;
886 struct usb_device *usbdev;
888 usbdev = interface_to_usbdev(intf);
889 phy_dev = usb_get_intfdata(intf);
891 udev = phy_dev->priv_dev;
892 unregister_lte_device(phy_dev);
905 static int gdm_usb_suspend(struct usb_interface *intf, pm_message_t pm_msg)
907 struct phy_dev *phy_dev;
908 struct lte_udev *udev;
911 struct usb_rx *r_next;
914 phy_dev = usb_get_intfdata(intf);
915 udev = phy_dev->priv_dev;
917 if (udev->usb_state != PM_NORMAL) {
918 dev_err(intf->usb_dev, "usb suspend - invalid state\n");
922 udev->usb_state = PM_SUSPEND;
924 spin_lock_irqsave(&rx->submit_lock, flags);
925 list_for_each_entry_safe(r, r_next, &rx->rx_submit_list,
927 spin_unlock_irqrestore(&rx->submit_lock, flags);
928 usb_kill_urb(r->urb);
929 spin_lock_irqsave(&rx->submit_lock, flags);
931 spin_unlock_irqrestore(&rx->submit_lock, flags);
933 cancel_work_sync(&udev->work_tx.work);
934 cancel_work_sync(&udev->work_rx.work);
939 static int gdm_usb_resume(struct usb_interface *intf)
941 struct phy_dev *phy_dev;
942 struct lte_udev *udev;
949 phy_dev = usb_get_intfdata(intf);
950 udev = phy_dev->priv_dev;
953 if (udev->usb_state != PM_SUSPEND) {
954 dev_err(intf->usb_dev, "usb resume - invalid state\n");
957 udev->usb_state = PM_NORMAL;
959 spin_lock_irqsave(&rx->rx_lock, flags);
960 issue_count = rx->avail_count - MAX_RX_SUBMIT_COUNT;
961 spin_unlock_irqrestore(&rx->rx_lock, flags);
963 if (issue_count >= 0) {
964 for (i = 0; i < issue_count; i++)
965 gdm_usb_recv(phy_dev->priv_dev,
972 spin_lock_irqsave(&tx->lock, flags);
973 schedule_work(&udev->work_tx.work);
974 spin_unlock_irqrestore(&tx->lock, flags);
979 static struct usb_driver gdm_usb_lte_driver = {
981 .probe = gdm_usb_probe,
982 .disconnect = gdm_usb_disconnect,
983 .id_table = id_table,
984 .supports_autosuspend = 1,
985 .suspend = gdm_usb_suspend,
986 .resume = gdm_usb_resume,
987 .reset_resume = gdm_usb_resume,
990 static int __init gdm_usb_lte_init(void)
992 if (gdm_lte_event_init() < 0) {
993 pr_err("error creating event\n");
997 return usb_register(&gdm_usb_lte_driver);
1000 static void __exit gdm_usb_lte_exit(void)
1002 gdm_lte_event_exit();
1004 usb_deregister(&gdm_usb_lte_driver);
1007 module_init(gdm_usb_lte_init);
1008 module_exit(gdm_usb_lte_exit);
1010 MODULE_VERSION(DRIVER_VERSION);
1011 MODULE_DESCRIPTION("GCT LTE USB Device Driver");
1012 MODULE_LICENSE("GPL");