UPSTREAM: net: qmi_wwan: shorten driver description
[cascardo/linux.git] / drivers / net / usb / qmi_wwan.c
1 /*
2  * Copyright (c) 2012  Bjørn Mork <bjorn@mork.no>
3  *
4  * The probing code is heavily inspired by cdc_ether, which is:
5  * Copyright (C) 2003-2005 by David Brownell
6  * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  */
12
13 #include <linux/module.h>
14 #include <linux/netdevice.h>
15 #include <linux/ethtool.h>
16 #include <linux/mii.h>
17 #include <linux/usb.h>
18 #include <linux/usb/cdc.h>
19 #include <linux/usb/usbnet.h>
20 #include <linux/usb/cdc-wdm.h>
21
22 /* This driver supports wwan (3G/LTE/?) devices using a vendor
23  * specific management protocol called Qualcomm MSM Interface (QMI) -
24  * in addition to the more common AT commands over serial interface
25  * management
26  *
27  * QMI is wrapped in CDC, using CDC encapsulated commands on the
28  * control ("master") interface of a two-interface CDC Union
29  * resembling standard CDC ECM.  The devices do not use the control
30  * interface for any other CDC messages.  Most likely because the
31  * management protocol is used in place of the standard CDC
32  * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
33  *
34  * Alternatively, control and data functions can be combined in a
35  * single USB interface.
36  *
37  * Handling a protocol like QMI is out of the scope for any driver.
38  * It is exported as a character device using the cdc-wdm driver as
39  * a subdriver, enabling userspace applications ("modem managers") to
40  * handle it.
41  *
42  * These devices may alternatively/additionally be configured using AT
43  * commands on a serial interface
44  */
45
46 /* driver specific data */
47 struct qmi_wwan_state {
48         struct usb_driver *subdriver;
49         atomic_t pmcount;
50         unsigned long unused;
51         struct usb_interface *control;
52         struct usb_interface *data;
53 };
54
55 /* using a counter to merge subdriver requests with our own into a combined state */
56 static int qmi_wwan_manage_power(struct usbnet *dev, int on)
57 {
58         struct qmi_wwan_state *info = (void *)&dev->data;
59         int rv = 0;
60
61         dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
62
63         if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
64                 /* need autopm_get/put here to ensure the usbcore sees the new value */
65                 rv = usb_autopm_get_interface(dev->intf);
66                 if (rv < 0)
67                         goto err;
68                 dev->intf->needs_remote_wakeup = on;
69                 usb_autopm_put_interface(dev->intf);
70         }
71 err:
72         return rv;
73 }
74
75 static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
76 {
77         struct usbnet *dev = usb_get_intfdata(intf);
78         return qmi_wwan_manage_power(dev, on);
79 }
80
81 /* collect all three endpoints and register subdriver */
82 static int qmi_wwan_register_subdriver(struct usbnet *dev)
83 {
84         int rv;
85         struct usb_driver *subdriver = NULL;
86         struct qmi_wwan_state *info = (void *)&dev->data;
87
88         /* collect bulk endpoints */
89         rv = usbnet_get_endpoints(dev, info->data);
90         if (rv < 0)
91                 goto err;
92
93         /* update status endpoint if separate control interface */
94         if (info->control != info->data)
95                 dev->status = &info->control->cur_altsetting->endpoint[0];
96
97         /* require interrupt endpoint for subdriver */
98         if (!dev->status) {
99                 rv = -EINVAL;
100                 goto err;
101         }
102
103         /* for subdriver power management */
104         atomic_set(&info->pmcount, 0);
105
106         /* register subdriver */
107         subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
108         if (IS_ERR(subdriver)) {
109                 dev_err(&info->control->dev, "subdriver registration failed\n");
110                 rv = PTR_ERR(subdriver);
111                 goto err;
112         }
113
114         /* prevent usbnet from using status endpoint */
115         dev->status = NULL;
116
117         /* save subdriver struct for suspend/resume wrappers */
118         info->subdriver = subdriver;
119
120 err:
121         return rv;
122 }
123
124 static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
125 {
126         int status = -1;
127         u8 *buf = intf->cur_altsetting->extra;
128         int len = intf->cur_altsetting->extralen;
129         struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
130         struct usb_cdc_union_desc *cdc_union = NULL;
131         struct usb_cdc_ether_desc *cdc_ether = NULL;
132         u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
133         u32 found = 0;
134         struct usb_driver *driver = driver_of(intf);
135         struct qmi_wwan_state *info = (void *)&dev->data;
136
137         BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
138
139         /* require a single interrupt status endpoint for subdriver */
140         if (intf->cur_altsetting->desc.bNumEndpoints != 1)
141                 goto err;
142
143         while (len > 3) {
144                 struct usb_descriptor_header *h = (void *)buf;
145
146                 /* ignore any misplaced descriptors */
147                 if (h->bDescriptorType != USB_DT_CS_INTERFACE)
148                         goto next_desc;
149
150                 /* buf[2] is CDC descriptor subtype */
151                 switch (buf[2]) {
152                 case USB_CDC_HEADER_TYPE:
153                         if (found & 1 << USB_CDC_HEADER_TYPE) {
154                                 dev_dbg(&intf->dev, "extra CDC header\n");
155                                 goto err;
156                         }
157                         if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
158                                 dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
159                                 goto err;
160                         }
161                         break;
162                 case USB_CDC_UNION_TYPE:
163                         if (found & 1 << USB_CDC_UNION_TYPE) {
164                                 dev_dbg(&intf->dev, "extra CDC union\n");
165                                 goto err;
166                         }
167                         if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
168                                 dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
169                                 goto err;
170                         }
171                         cdc_union = (struct usb_cdc_union_desc *)buf;
172                         break;
173                 case USB_CDC_ETHERNET_TYPE:
174                         if (found & 1 << USB_CDC_ETHERNET_TYPE) {
175                                 dev_dbg(&intf->dev, "extra CDC ether\n");
176                                 goto err;
177                         }
178                         if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
179                                 dev_dbg(&intf->dev, "CDC ether len %u\n",  h->bLength);
180                                 goto err;
181                         }
182                         cdc_ether = (struct usb_cdc_ether_desc *)buf;
183                         break;
184                 }
185
186                 /*
187                  * Remember which CDC functional descriptors we've seen.  Works
188                  * for all types we care about, of which USB_CDC_ETHERNET_TYPE
189                  * (0x0f) is the highest numbered
190                  */
191                 if (buf[2] < 32)
192                         found |= 1 << buf[2];
193
194 next_desc:
195                 len -= h->bLength;
196                 buf += h->bLength;
197         }
198
199         /* did we find all the required ones? */
200         if ((found & required) != required) {
201                 dev_err(&intf->dev, "CDC functional descriptors missing\n");
202                 goto err;
203         }
204
205         /* verify CDC Union */
206         if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) {
207                 dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0);
208                 goto err;
209         }
210
211         /* need to save these for unbind */
212         info->control = intf;
213         info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
214         if (!info->data) {
215                 dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0);
216                 goto err;
217         }
218
219         /* errors aren't fatal - we can live with the dynamic address */
220         if (cdc_ether) {
221                 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
222                 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
223         }
224
225         /* claim data interface and set it up */
226         status = usb_driver_claim_interface(driver, info->data, dev);
227         if (status < 0)
228                 goto err;
229
230         status = qmi_wwan_register_subdriver(dev);
231         if (status < 0) {
232                 usb_set_intfdata(info->data, NULL);
233                 usb_driver_release_interface(driver, info->data);
234         }
235
236 err:
237         return status;
238 }
239
240 /* Some devices combine the "control" and "data" functions into a
241  * single interface with all three endpoints: interrupt + bulk in and
242  * out
243  */
244 static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
245 {
246         int rv;
247         struct qmi_wwan_state *info = (void *)&dev->data;
248
249         /* ZTE makes devices where the interface descriptors and endpoint
250          * configurations of two or more interfaces are identical, even
251          * though the functions are completely different.  If set, then
252          * driver_info->data is a bitmap of acceptable interface numbers
253          * allowing us to bind to one such interface without binding to
254          * all of them
255          */
256         if (dev->driver_info->data &&
257             !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) {
258                 dev_info(&intf->dev, "not on our whitelist - ignored");
259                 rv = -ENODEV;
260                 goto err;
261         }
262
263         /*  control and data is shared */
264         info->control = intf;
265         info->data = intf;
266         rv = qmi_wwan_register_subdriver(dev);
267
268 err:
269         return rv;
270 }
271
272 /* Gobi devices uses identical class/protocol codes for all interfaces regardless
273  * of function. Some of these are CDC ACM like and have the exact same endpoints
274  * we are looking for. This leaves two possible strategies for identifying the
275  * correct interface:
276  *   a) hardcoding interface number, or
277  *   b) use the fact that the wwan interface is the only one lacking additional
278  *      (CDC functional) descriptors
279  *
280  * Let's see if we can get away with the generic b) solution.
281  */
282 static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
283 {
284         int rv = -EINVAL;
285
286         /* ignore any interface with additional descriptors */
287         if (intf->cur_altsetting->extralen)
288                 goto err;
289
290         rv = qmi_wwan_bind_shared(dev, intf);
291 err:
292         return rv;
293 }
294
295 static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
296 {
297         struct qmi_wwan_state *info = (void *)&dev->data;
298         struct usb_driver *driver = driver_of(intf);
299         struct usb_interface *other;
300
301         if (info->subdriver && info->subdriver->disconnect)
302                 info->subdriver->disconnect(info->control);
303
304         /* allow user to unbind using either control or data */
305         if (intf == info->control)
306                 other = info->data;
307         else
308                 other = info->control;
309
310         /* only if not shared */
311         if (other && intf != other) {
312                 usb_set_intfdata(other, NULL);
313                 usb_driver_release_interface(driver, other);
314         }
315
316         info->subdriver = NULL;
317         info->data = NULL;
318         info->control = NULL;
319 }
320
321 /* suspend/resume wrappers calling both usbnet and the cdc-wdm
322  * subdriver if present.
323  *
324  * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
325  * wrappers for those without adding usbnet reset support first.
326  */
327 static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
328 {
329         struct usbnet *dev = usb_get_intfdata(intf);
330         struct qmi_wwan_state *info = (void *)&dev->data;
331         int ret;
332
333         ret = usbnet_suspend(intf, message);
334         if (ret < 0)
335                 goto err;
336
337         if (info->subdriver && info->subdriver->suspend)
338                 ret = info->subdriver->suspend(intf, message);
339         if (ret < 0)
340                 usbnet_resume(intf);
341 err:
342         return ret;
343 }
344
345 static int qmi_wwan_resume(struct usb_interface *intf)
346 {
347         struct usbnet *dev = usb_get_intfdata(intf);
348         struct qmi_wwan_state *info = (void *)&dev->data;
349         int ret = 0;
350
351         if (info->subdriver && info->subdriver->resume)
352                 ret = info->subdriver->resume(intf);
353         if (ret < 0)
354                 goto err;
355         ret = usbnet_resume(intf);
356         if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend)
357                 info->subdriver->suspend(intf, PMSG_SUSPEND);
358 err:
359         return ret;
360 }
361
362 static const struct driver_info qmi_wwan_info = {
363         .description    = "WWAN/QMI device",
364         .flags          = FLAG_WWAN,
365         .bind           = qmi_wwan_bind,
366         .unbind         = qmi_wwan_unbind,
367         .manage_power   = qmi_wwan_manage_power,
368 };
369
370 static const struct driver_info qmi_wwan_shared = {
371         .description    = "WWAN/QMI device",
372         .flags          = FLAG_WWAN,
373         .bind           = qmi_wwan_bind_shared,
374         .unbind         = qmi_wwan_unbind,
375         .manage_power   = qmi_wwan_manage_power,
376 };
377
378 static const struct driver_info qmi_wwan_gobi = {
379         .description    = "Qualcomm Gobi wwan/QMI device",
380         .flags          = FLAG_WWAN,
381         .bind           = qmi_wwan_bind_gobi,
382         .unbind         = qmi_wwan_unbind,
383         .manage_power   = qmi_wwan_manage_power,
384 };
385
386 /* ZTE suck at making USB descriptors */
387 static const struct driver_info qmi_wwan_force_int1 = {
388         .description    = "Qualcomm WWAN/QMI device",
389         .flags          = FLAG_WWAN,
390         .bind           = qmi_wwan_bind_shared,
391         .unbind         = qmi_wwan_unbind,
392         .manage_power   = qmi_wwan_manage_power,
393         .data           = BIT(1), /* interface whitelist bitmap */
394 };
395
396 static const struct driver_info qmi_wwan_force_int4 = {
397         .description    = "Qualcomm WWAN/QMI device",
398         .flags          = FLAG_WWAN,
399         .bind           = qmi_wwan_bind_shared,
400         .unbind         = qmi_wwan_unbind,
401         .manage_power   = qmi_wwan_manage_power,
402         .data           = BIT(4), /* interface whitelist bitmap */
403 };
404
405 /* Sierra Wireless provide equally useless interface descriptors
406  * Devices in QMI mode can be switched between two different
407  * configurations:
408  *   a) USB interface #8 is QMI/wwan
409  *   b) USB interfaces #8, #19 and #20 are QMI/wwan
410  *
411  * Both configurations provide a number of other interfaces (serial++),
412  * some of which have the same endpoint configuration as we expect, so
413  * a whitelist or blacklist is necessary.
414  *
415  * FIXME: The below whitelist should include BIT(20).  It does not
416  * because I cannot get it to work...
417  */
418 static const struct driver_info qmi_wwan_sierra = {
419         .description    = "Sierra Wireless wwan/QMI device",
420         .flags          = FLAG_WWAN,
421         .bind           = qmi_wwan_bind_gobi,
422         .unbind         = qmi_wwan_unbind,
423         .manage_power   = qmi_wwan_manage_power,
424         .data           = BIT(8) | BIT(19), /* interface whitelist bitmap */
425 };
426
427 #define HUAWEI_VENDOR_ID        0x12D1
428 #define QMI_GOBI_DEVICE(vend, prod) \
429         USB_DEVICE(vend, prod), \
430         .driver_info = (unsigned long)&qmi_wwan_gobi
431
432 static const struct usb_device_id products[] = {
433         {       /* Huawei E392, E398 and possibly others sharing both device id and more... */
434                 .match_flags        = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
435                 .idVendor           = HUAWEI_VENDOR_ID,
436                 .bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
437                 .bInterfaceSubClass = 1,
438                 .bInterfaceProtocol = 9, /* CDC Ethernet *control* interface */
439                 .driver_info        = (unsigned long)&qmi_wwan_info,
440         },
441         {       /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
442                 .match_flags        = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
443                 .idVendor           = HUAWEI_VENDOR_ID,
444                 .bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
445                 .bInterfaceSubClass = 1,
446                 .bInterfaceProtocol = 57, /* CDC Ethernet *control* interface */
447                 .driver_info        = (unsigned long)&qmi_wwan_info,
448         },
449         {       /* Huawei E392, E398 and possibly others in "Windows mode"
450                  * using a combined control and data interface without any CDC
451                  * functional descriptors
452                  */
453                 .match_flags        = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
454                 .idVendor           = HUAWEI_VENDOR_ID,
455                 .bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
456                 .bInterfaceSubClass = 1,
457                 .bInterfaceProtocol = 17,
458                 .driver_info        = (unsigned long)&qmi_wwan_shared,
459         },
460         {       /* Pantech UML290 */
461                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
462                 .idVendor           = 0x106c,
463                 .idProduct          = 0x3718,
464                 .bInterfaceClass    = 0xff,
465                 .bInterfaceSubClass = 0xf0,
466                 .bInterfaceProtocol = 0xff,
467                 .driver_info        = (unsigned long)&qmi_wwan_shared,
468         },
469         {       /* ZTE MF820D */
470                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
471                 .idVendor           = 0x19d2,
472                 .idProduct          = 0x0167,
473                 .bInterfaceClass    = 0xff,
474                 .bInterfaceSubClass = 0xff,
475                 .bInterfaceProtocol = 0xff,
476                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
477         },
478         {       /* ZTE (Vodafone) K3520-Z */
479                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
480                 .idVendor           = 0x19d2,
481                 .idProduct          = 0x0055,
482                 .bInterfaceClass    = 0xff,
483                 .bInterfaceSubClass = 0xff,
484                 .bInterfaceProtocol = 0xff,
485                 .driver_info        = (unsigned long)&qmi_wwan_force_int1,
486         },
487         {       /* ZTE (Vodafone) K3565-Z */
488                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
489                 .idVendor           = 0x19d2,
490                 .idProduct          = 0x0063,
491                 .bInterfaceClass    = 0xff,
492                 .bInterfaceSubClass = 0xff,
493                 .bInterfaceProtocol = 0xff,
494                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
495         },
496         {       /* ZTE (Vodafone) K3570-Z */
497                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
498                 .idVendor           = 0x19d2,
499                 .idProduct          = 0x1008,
500                 .bInterfaceClass    = 0xff,
501                 .bInterfaceSubClass = 0xff,
502                 .bInterfaceProtocol = 0xff,
503                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
504         },
505         {       /* ZTE (Vodafone) K3571-Z */
506                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
507                 .idVendor           = 0x19d2,
508                 .idProduct          = 0x1010,
509                 .bInterfaceClass    = 0xff,
510                 .bInterfaceSubClass = 0xff,
511                 .bInterfaceProtocol = 0xff,
512                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
513         },
514         {       /* ZTE (Vodafone) K3765-Z */
515                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
516                 .idVendor           = 0x19d2,
517                 .idProduct          = 0x2002,
518                 .bInterfaceClass    = 0xff,
519                 .bInterfaceSubClass = 0xff,
520                 .bInterfaceProtocol = 0xff,
521                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
522         },
523         {       /* ZTE (Vodafone) K4505-Z */
524                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
525                 .idVendor           = 0x19d2,
526                 .idProduct          = 0x0104,
527                 .bInterfaceClass    = 0xff,
528                 .bInterfaceSubClass = 0xff,
529                 .bInterfaceProtocol = 0xff,
530                 .driver_info        = (unsigned long)&qmi_wwan_force_int4,
531         },
532         {       /* Sierra Wireless MC77xx in QMI mode */
533                 .match_flags        = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
534                 .idVendor           = 0x1199,
535                 .idProduct          = 0x68a2,
536                 .bInterfaceClass    = 0xff,
537                 .bInterfaceSubClass = 0xff,
538                 .bInterfaceProtocol = 0xff,
539                 .driver_info        = (unsigned long)&qmi_wwan_sierra,
540         },
541         {QMI_GOBI_DEVICE(0x05c6, 0x9212)},      /* Acer Gobi Modem Device */
542         {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)},      /* HP un2400 Gobi Modem Device */
543         {QMI_GOBI_DEVICE(0x03f0, 0x371d)},      /* HP un2430 Mobile Broadband Module */
544         {QMI_GOBI_DEVICE(0x04da, 0x250d)},      /* Panasonic Gobi Modem device */
545         {QMI_GOBI_DEVICE(0x413c, 0x8172)},      /* Dell Gobi Modem device */
546         {QMI_GOBI_DEVICE(0x1410, 0xa001)},      /* Novatel Gobi Modem device */
547         {QMI_GOBI_DEVICE(0x0b05, 0x1776)},      /* Asus Gobi Modem device */
548         {QMI_GOBI_DEVICE(0x19d2, 0xfff3)},      /* ONDA Gobi Modem device */
549         {QMI_GOBI_DEVICE(0x05c6, 0x9001)},      /* Generic Gobi Modem device */
550         {QMI_GOBI_DEVICE(0x05c6, 0x9002)},      /* Generic Gobi Modem device */
551         {QMI_GOBI_DEVICE(0x05c6, 0x9202)},      /* Generic Gobi Modem device */
552         {QMI_GOBI_DEVICE(0x05c6, 0x9203)},      /* Generic Gobi Modem device */
553         {QMI_GOBI_DEVICE(0x05c6, 0x9222)},      /* Generic Gobi Modem device */
554         {QMI_GOBI_DEVICE(0x05c6, 0x9009)},      /* Generic Gobi Modem device */
555         {QMI_GOBI_DEVICE(0x413c, 0x8186)},      /* Dell Gobi 2000 Modem device (N0218, VU936) */
556         {QMI_GOBI_DEVICE(0x05c6, 0x920b)},      /* Generic Gobi 2000 Modem device */
557         {QMI_GOBI_DEVICE(0x05c6, 0x9225)},      /* Sony Gobi 2000 Modem device (N0279, VU730) */
558         {QMI_GOBI_DEVICE(0x05c6, 0x9245)},      /* Samsung Gobi 2000 Modem device (VL176) */
559         {QMI_GOBI_DEVICE(0x03f0, 0x251d)},      /* HP Gobi 2000 Modem device (VP412) */
560         {QMI_GOBI_DEVICE(0x05c6, 0x9215)},      /* Acer Gobi 2000 Modem device (VP413) */
561         {QMI_GOBI_DEVICE(0x05c6, 0x9265)},      /* Asus Gobi 2000 Modem device (VR305) */
562         {QMI_GOBI_DEVICE(0x05c6, 0x9235)},      /* Top Global Gobi 2000 Modem device (VR306) */
563         {QMI_GOBI_DEVICE(0x05c6, 0x9275)},      /* iRex Technologies Gobi 2000 Modem device (VR307) */
564         {QMI_GOBI_DEVICE(0x1199, 0x9001)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
565         {QMI_GOBI_DEVICE(0x1199, 0x9002)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
566         {QMI_GOBI_DEVICE(0x1199, 0x9003)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
567         {QMI_GOBI_DEVICE(0x1199, 0x9004)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
568         {QMI_GOBI_DEVICE(0x1199, 0x9005)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
569         {QMI_GOBI_DEVICE(0x1199, 0x9006)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
570         {QMI_GOBI_DEVICE(0x1199, 0x9007)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
571         {QMI_GOBI_DEVICE(0x1199, 0x9008)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
572         {QMI_GOBI_DEVICE(0x1199, 0x9009)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
573         {QMI_GOBI_DEVICE(0x1199, 0x900a)},      /* Sierra Wireless Gobi 2000 Modem device (VT773) */
574         {QMI_GOBI_DEVICE(0x1199, 0x9011)},      /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
575         {QMI_GOBI_DEVICE(0x16d8, 0x8002)},      /* CMDTech Gobi 2000 Modem device (VU922) */
576         {QMI_GOBI_DEVICE(0x05c6, 0x9205)},      /* Gobi 2000 Modem device */
577         {QMI_GOBI_DEVICE(0x1199, 0x9013)},      /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
578         {QMI_GOBI_DEVICE(0x1199, 0x9015)},      /* Sierra Wireless Gobi 3000 Modem device */
579         {QMI_GOBI_DEVICE(0x1199, 0x9019)},      /* Sierra Wireless Gobi 3000 Modem device */
580         { }                                     /* END */
581 };
582 MODULE_DEVICE_TABLE(usb, products);
583
584 static struct usb_driver qmi_wwan_driver = {
585         .name                 = "qmi_wwan",
586         .id_table             = products,
587         .probe                = usbnet_probe,
588         .disconnect           = usbnet_disconnect,
589         .suspend              = qmi_wwan_suspend,
590         .resume               = qmi_wwan_resume,
591         .reset_resume         = qmi_wwan_resume,
592         .supports_autosuspend = 1,
593 };
594
595 static int __init qmi_wwan_init(void)
596 {
597         return usb_register(&qmi_wwan_driver);
598 }
599 module_init(qmi_wwan_init);
600
601 static void __exit qmi_wwan_exit(void)
602 {
603         usb_deregister(&qmi_wwan_driver);
604 }
605 module_exit(qmi_wwan_exit);
606
607 MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
608 MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
609 MODULE_LICENSE("GPL");