blob: c7b9be81ad0872fb576828634bb2d266fd581ed9 [file] [log] [blame]
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001/*
2 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
7 */
8
9#include <linux/module.h>
10#include <linux/netdevice.h>
11#include <linux/ethtool.h>
12#include <linux/mii.h>
13#include <linux/usb.h>
14#include <linux/usb/cdc.h>
15#include <linux/usb/usbnet.h>
Bjørn Morkc3ecb082012-03-09 12:35:05 +010016#include <linux/usb/cdc-wdm.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000017
18/* The name of the CDC Device Management driver */
19#define DM_DRIVER "cdc_wdm"
20
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 * Handling a protocol like QMI is out of the scope for any driver.
35 * It can be exported as a character device using the cdc-wdm driver,
36 * which will enable userspace applications ("modem managers") to
37 * handle it. This may be required to use the network interface
38 * provided by the driver.
39 *
40 * These devices may alternatively/additionally be configured using AT
41 * commands on any of the serial interfaces driven by the option driver
42 *
43 * This driver binds only to the data ("slave") interface to enable
44 * the cdc-wdm driver to bind to the control interface. It still
45 * parses the CDC functional descriptors on the control interface to
46 * a) verify that this is indeed a handled interface (CDC Union
47 * header lists it as slave)
48 * b) get MAC address and other ethernet config from the CDC Ethernet
49 * header
50 * c) enable user bind requests against the control interface, which
51 * is the common way to bind to CDC Ethernet Control Model type
52 * interfaces
53 * d) provide a hint to the user about which interface is the
54 * corresponding management interface
55 */
56
Bjørn Mork853c24f2012-06-19 00:41:59 +000057/* driver specific data */
58struct qmi_wwan_state {
59 struct usb_driver *subdriver;
60 atomic_t pmcount;
61 unsigned long unused[3];
62};
63
Bjørn Mork423ce8c2012-01-19 15:37:22 +000064static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
65{
66 int status = -1;
67 struct usb_interface *control = NULL;
68 u8 *buf = intf->cur_altsetting->extra;
69 int len = intf->cur_altsetting->extralen;
70 struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
71 struct usb_cdc_union_desc *cdc_union = NULL;
72 struct usb_cdc_ether_desc *cdc_ether = NULL;
73 u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
74 u32 found = 0;
Bjørn Mork853c24f2012-06-19 00:41:59 +000075 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +010076
Bjørn Mork853c24f2012-06-19 00:41:59 +000077 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
78
79 atomic_set(&info->pmcount, 0);
Bjørn Mork423ce8c2012-01-19 15:37:22 +000080
81 /*
82 * assume a data interface has no additional descriptors and
83 * that the control and data interface are numbered
84 * consecutively - this holds for the Huawei device at least
85 */
86 if (len == 0 && desc->bInterfaceNumber > 0) {
87 control = usb_ifnum_to_if(dev->udev, desc->bInterfaceNumber - 1);
88 if (!control)
89 goto err;
90
91 buf = control->cur_altsetting->extra;
92 len = control->cur_altsetting->extralen;
93 dev_dbg(&intf->dev, "guessing \"control\" => %s, \"data\" => this\n",
94 dev_name(&control->dev));
95 }
96
97 while (len > 3) {
98 struct usb_descriptor_header *h = (void *)buf;
99
100 /* ignore any misplaced descriptors */
101 if (h->bDescriptorType != USB_DT_CS_INTERFACE)
102 goto next_desc;
103
104 /* buf[2] is CDC descriptor subtype */
105 switch (buf[2]) {
106 case USB_CDC_HEADER_TYPE:
107 if (found & 1 << USB_CDC_HEADER_TYPE) {
108 dev_dbg(&intf->dev, "extra CDC header\n");
109 goto err;
110 }
111 if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
112 dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
113 goto err;
114 }
115 break;
116 case USB_CDC_UNION_TYPE:
117 if (found & 1 << USB_CDC_UNION_TYPE) {
118 dev_dbg(&intf->dev, "extra CDC union\n");
119 goto err;
120 }
121 if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
122 dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
123 goto err;
124 }
125 cdc_union = (struct usb_cdc_union_desc *)buf;
126 break;
127 case USB_CDC_ETHERNET_TYPE:
128 if (found & 1 << USB_CDC_ETHERNET_TYPE) {
129 dev_dbg(&intf->dev, "extra CDC ether\n");
130 goto err;
131 }
132 if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
133 dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength);
134 goto err;
135 }
136 cdc_ether = (struct usb_cdc_ether_desc *)buf;
137 break;
138 }
139
140 /*
141 * Remember which CDC functional descriptors we've seen. Works
142 * for all types we care about, of which USB_CDC_ETHERNET_TYPE
143 * (0x0f) is the highest numbered
144 */
145 if (buf[2] < 32)
146 found |= 1 << buf[2];
147
148next_desc:
149 len -= h->bLength;
150 buf += h->bLength;
151 }
152
153 /* did we find all the required ones? */
154 if ((found & required) != required) {
155 dev_err(&intf->dev, "CDC functional descriptors missing\n");
156 goto err;
157 }
158
159 /* give the user a helpful hint if trying to bind to the wrong interface */
160 if (cdc_union && desc->bInterfaceNumber == cdc_union->bMasterInterface0) {
161 dev_err(&intf->dev, "leaving \"control\" interface for " DM_DRIVER " - try binding to %s instead!\n",
162 dev_name(&usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0)->dev));
163 goto err;
164 }
165
166 /* errors aren't fatal - we can live with the dynamic address */
167 if (cdc_ether) {
168 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
169 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
170 }
171
172 /* success! point the user to the management interface */
173 if (control)
174 dev_info(&intf->dev, "Use \"" DM_DRIVER "\" for QMI interface %s\n",
175 dev_name(&control->dev));
176
177 /* XXX: add a sysfs symlink somewhere to help management applications find it? */
178
179 /* collect bulk endpoints now that we know intf == "data" interface */
180 status = usbnet_get_endpoints(dev, intf);
181
182err:
183 return status;
184}
185
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100186/* using a counter to merge subdriver requests with our own into a combined state */
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000187static int qmi_wwan_manage_power(struct usbnet *dev, int on)
188{
Bjørn Mork853c24f2012-06-19 00:41:59 +0000189 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100190 int rv = 0;
191
Bjørn Mork853c24f2012-06-19 00:41:59 +0000192 dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100193
Bjørn Mork853c24f2012-06-19 00:41:59 +0000194 if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100195 /* need autopm_get/put here to ensure the usbcore sees the new value */
196 rv = usb_autopm_get_interface(dev->intf);
197 if (rv < 0)
198 goto err;
199 dev->intf->needs_remote_wakeup = on;
200 usb_autopm_put_interface(dev->intf);
201 }
202err:
203 return rv;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000204}
205
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100206static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
207{
208 struct usbnet *dev = usb_get_intfdata(intf);
209 return qmi_wwan_manage_power(dev, on);
210}
211
212/* Some devices combine the "control" and "data" functions into a
213 * single interface with all three endpoints: interrupt + bulk in and
214 * out
215 *
216 * Setting up cdc-wdm as a subdriver owning the interrupt endpoint
217 * will let it provide userspace access to the encapsulated QMI
218 * protocol without interfering with the usbnet operations.
219 */
220static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
221{
222 int rv;
223 struct usb_driver *subdriver = NULL;
Bjørn Mork853c24f2012-06-19 00:41:59 +0000224 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100225
Bjørn Mork11207b62012-03-16 15:41:27 +0100226 /* ZTE makes devices where the interface descriptors and endpoint
227 * configurations of two or more interfaces are identical, even
228 * though the functions are completely different. If set, then
229 * driver_info->data is a bitmap of acceptable interface numbers
230 * allowing us to bind to one such interface without binding to
231 * all of them
232 */
233 if (dev->driver_info->data &&
234 !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) {
235 dev_info(&intf->dev, "not on our whitelist - ignored");
236 rv = -ENODEV;
237 goto err;
238 }
239
Bjørn Mork853c24f2012-06-19 00:41:59 +0000240 atomic_set(&info->pmcount, 0);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100241
242 /* collect all three endpoints */
243 rv = usbnet_get_endpoints(dev, intf);
244 if (rv < 0)
245 goto err;
246
247 /* require interrupt endpoint for subdriver */
248 if (!dev->status) {
249 rv = -EINVAL;
250 goto err;
251 }
252
253 subdriver = usb_cdc_wdm_register(intf, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
254 if (IS_ERR(subdriver)) {
255 rv = PTR_ERR(subdriver);
256 goto err;
257 }
258
259 /* can't let usbnet use the interrupt endpoint */
260 dev->status = NULL;
261
262 /* save subdriver struct for suspend/resume wrappers */
Bjørn Mork853c24f2012-06-19 00:41:59 +0000263 info->subdriver = subdriver;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100264
265err:
266 return rv;
267}
268
Bjørn Morkb086cf02012-03-09 12:35:06 +0100269/* Gobi devices uses identical class/protocol codes for all interfaces regardless
270 * of function. Some of these are CDC ACM like and have the exact same endpoints
271 * we are looking for. This leaves two possible strategies for identifying the
272 * correct interface:
273 * a) hardcoding interface number, or
274 * b) use the fact that the wwan interface is the only one lacking additional
275 * (CDC functional) descriptors
276 *
277 * Let's see if we can get away with the generic b) solution.
278 */
279static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
280{
281 int rv = -EINVAL;
282
283 /* ignore any interface with additional descriptors */
284 if (intf->cur_altsetting->extralen)
285 goto err;
286
287 rv = qmi_wwan_bind_shared(dev, intf);
288err:
289 return rv;
290}
291
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100292static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf)
293{
Bjørn Mork853c24f2012-06-19 00:41:59 +0000294 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100295
Bjørn Mork853c24f2012-06-19 00:41:59 +0000296 if (info->subdriver && info->subdriver->disconnect)
297 info->subdriver->disconnect(intf);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100298
Bjørn Mork853c24f2012-06-19 00:41:59 +0000299 info->subdriver = NULL;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100300}
301
302/* suspend/resume wrappers calling both usbnet and the cdc-wdm
303 * subdriver if present.
304 *
305 * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
306 * wrappers for those without adding usbnet reset support first.
307 */
308static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
309{
310 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000311 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100312 int ret;
313
314 ret = usbnet_suspend(intf, message);
315 if (ret < 0)
316 goto err;
317
Bjørn Mork853c24f2012-06-19 00:41:59 +0000318 if (info->subdriver && info->subdriver->suspend)
319 ret = info->subdriver->suspend(intf, message);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100320 if (ret < 0)
321 usbnet_resume(intf);
322err:
323 return ret;
324}
325
326static int qmi_wwan_resume(struct usb_interface *intf)
327{
328 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000329 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100330 int ret = 0;
331
Bjørn Mork853c24f2012-06-19 00:41:59 +0000332 if (info->subdriver && info->subdriver->resume)
333 ret = info->subdriver->resume(intf);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100334 if (ret < 0)
335 goto err;
336 ret = usbnet_resume(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000337 if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend)
338 info->subdriver->suspend(intf, PMSG_SUSPEND);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100339err:
340 return ret;
341}
342
343
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000344static const struct driver_info qmi_wwan_info = {
345 .description = "QMI speaking wwan device",
346 .flags = FLAG_WWAN,
347 .bind = qmi_wwan_bind,
348 .manage_power = qmi_wwan_manage_power,
349};
350
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100351static const struct driver_info qmi_wwan_shared = {
352 .description = "QMI speaking wwan device with combined interface",
353 .flags = FLAG_WWAN,
354 .bind = qmi_wwan_bind_shared,
355 .unbind = qmi_wwan_unbind_shared,
356 .manage_power = qmi_wwan_manage_power,
357};
358
Bjørn Morkb086cf02012-03-09 12:35:06 +0100359static const struct driver_info qmi_wwan_gobi = {
360 .description = "Qualcomm Gobi wwan/QMI device",
361 .flags = FLAG_WWAN,
362 .bind = qmi_wwan_bind_gobi,
363 .unbind = qmi_wwan_unbind_shared,
364 .manage_power = qmi_wwan_manage_power,
365};
366
Bjørn Mork11207b62012-03-16 15:41:27 +0100367/* ZTE suck at making USB descriptors */
Andrew Bird (Sphere Systems)f7142e62012-05-19 22:28:38 +0000368static const struct driver_info qmi_wwan_force_int1 = {
369 .description = "Qualcomm WWAN/QMI device",
370 .flags = FLAG_WWAN,
371 .bind = qmi_wwan_bind_shared,
372 .unbind = qmi_wwan_unbind_shared,
373 .manage_power = qmi_wwan_manage_power,
374 .data = BIT(1), /* interface whitelist bitmap */
375};
376
Bjørn Mork11207b62012-03-16 15:41:27 +0100377static const struct driver_info qmi_wwan_force_int4 = {
Andrew Bird (Sphere Systems)00001882012-05-19 22:28:36 +0000378 .description = "Qualcomm WWAN/QMI device",
Bjørn Mork11207b62012-03-16 15:41:27 +0100379 .flags = FLAG_WWAN,
Andrew Bird (Sphere Systems)00001882012-05-19 22:28:36 +0000380 .bind = qmi_wwan_bind_shared,
Bjørn Mork11207b62012-03-16 15:41:27 +0100381 .unbind = qmi_wwan_unbind_shared,
382 .manage_power = qmi_wwan_manage_power,
383 .data = BIT(4), /* interface whitelist bitmap */
384};
385
Bjørn Mork3bc17d12012-04-17 09:38:23 +0000386/* Sierra Wireless provide equally useless interface descriptors
387 * Devices in QMI mode can be switched between two different
388 * configurations:
389 * a) USB interface #8 is QMI/wwan
390 * b) USB interfaces #8, #19 and #20 are QMI/wwan
391 *
392 * Both configurations provide a number of other interfaces (serial++),
393 * some of which have the same endpoint configuration as we expect, so
394 * a whitelist or blacklist is necessary.
395 *
396 * FIXME: The below whitelist should include BIT(20). It does not
397 * because I cannot get it to work...
398 */
399static const struct driver_info qmi_wwan_sierra = {
400 .description = "Sierra Wireless wwan/QMI device",
401 .flags = FLAG_WWAN,
402 .bind = qmi_wwan_bind_gobi,
403 .unbind = qmi_wwan_unbind_shared,
404 .manage_power = qmi_wwan_manage_power,
405 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
406};
Bjørn Mork11207b62012-03-16 15:41:27 +0100407
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000408#define HUAWEI_VENDOR_ID 0x12D1
Bjørn Morkb086cf02012-03-09 12:35:06 +0100409#define QMI_GOBI_DEVICE(vend, prod) \
410 USB_DEVICE(vend, prod), \
411 .driver_info = (unsigned long)&qmi_wwan_gobi
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000412
413static const struct usb_device_id products[] = {
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100414 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
415 .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
416 .idVendor = HUAWEI_VENDOR_ID,
417 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
418 .bInterfaceSubClass = 1,
419 .bInterfaceProtocol = 8, /* NOTE: This is the *slave* interface of the CDC Union! */
420 .driver_info = (unsigned long)&qmi_wwan_info,
421 },
Bjørn Mork88c16dc2012-05-19 07:20:31 +0000422 { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
423 .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
424 .idVendor = HUAWEI_VENDOR_ID,
425 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
426 .bInterfaceSubClass = 1,
427 .bInterfaceProtocol = 56, /* NOTE: This is the *slave* interface of the CDC Union! */
428 .driver_info = (unsigned long)&qmi_wwan_info,
429 },
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100430 { /* Huawei E392, E398 and possibly others in "Windows mode"
431 * using a combined control and data interface without any CDC
432 * functional descriptors
433 */
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 = 17,
439 .driver_info = (unsigned long)&qmi_wwan_shared,
440 },
Bjørn Morkb086cf02012-03-09 12:35:06 +0100441 { /* Pantech UML290 */
442 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
443 .idVendor = 0x106c,
444 .idProduct = 0x3718,
445 .bInterfaceClass = 0xff,
446 .bInterfaceSubClass = 0xf0,
447 .bInterfaceProtocol = 0xff,
448 .driver_info = (unsigned long)&qmi_wwan_shared,
449 },
Bjørn Mork11207b62012-03-16 15:41:27 +0100450 { /* ZTE MF820D */
451 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
452 .idVendor = 0x19d2,
453 .idProduct = 0x0167,
454 .bInterfaceClass = 0xff,
455 .bInterfaceSubClass = 0xff,
456 .bInterfaceProtocol = 0xff,
457 .driver_info = (unsigned long)&qmi_wwan_force_int4,
458 },
Andrew Bird (Sphere Systems)f7142e62012-05-19 22:28:38 +0000459 { /* ZTE (Vodafone) K3520-Z */
460 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
461 .idVendor = 0x19d2,
462 .idProduct = 0x0055,
463 .bInterfaceClass = 0xff,
464 .bInterfaceSubClass = 0xff,
465 .bInterfaceProtocol = 0xff,
466 .driver_info = (unsigned long)&qmi_wwan_force_int1,
467 },
Andrew Bird (Sphere Systems)1aa35a22012-03-25 00:10:27 +0000468 { /* ZTE (Vodafone) K3565-Z */
469 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
470 .idVendor = 0x19d2,
471 .idProduct = 0x0063,
472 .bInterfaceClass = 0xff,
473 .bInterfaceSubClass = 0xff,
474 .bInterfaceProtocol = 0xff,
475 .driver_info = (unsigned long)&qmi_wwan_force_int4,
476 },
Andrew Bird (Sphere Systems)dbb6d092012-03-25 00:10:29 +0000477 { /* ZTE (Vodafone) K3570-Z */
478 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
479 .idVendor = 0x19d2,
480 .idProduct = 0x1008,
481 .bInterfaceClass = 0xff,
482 .bInterfaceSubClass = 0xff,
483 .bInterfaceProtocol = 0xff,
484 .driver_info = (unsigned long)&qmi_wwan_force_int4,
485 },
486 { /* ZTE (Vodafone) K3571-Z */
487 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
488 .idVendor = 0x19d2,
489 .idProduct = 0x1010,
490 .bInterfaceClass = 0xff,
491 .bInterfaceSubClass = 0xff,
492 .bInterfaceProtocol = 0xff,
493 .driver_info = (unsigned long)&qmi_wwan_force_int4,
494 },
Andrew Bird (Sphere Systems)8965c982012-05-19 22:28:37 +0000495 { /* ZTE (Vodafone) K3765-Z */
496 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
497 .idVendor = 0x19d2,
498 .idProduct = 0x2002,
499 .bInterfaceClass = 0xff,
500 .bInterfaceSubClass = 0xff,
501 .bInterfaceProtocol = 0xff,
502 .driver_info = (unsigned long)&qmi_wwan_force_int4,
503 },
Andrew Bird (Sphere Systems)1aa35a22012-03-25 00:10:27 +0000504 { /* ZTE (Vodafone) K4505-Z */
505 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
506 .idVendor = 0x19d2,
507 .idProduct = 0x0104,
508 .bInterfaceClass = 0xff,
509 .bInterfaceSubClass = 0xff,
510 .bInterfaceProtocol = 0xff,
511 .driver_info = (unsigned long)&qmi_wwan_force_int4,
512 },
Bjørn Mork3bc17d12012-04-17 09:38:23 +0000513 { /* Sierra Wireless MC77xx in QMI mode */
514 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
515 .idVendor = 0x1199,
516 .idProduct = 0x68a2,
517 .bInterfaceClass = 0xff,
518 .bInterfaceSubClass = 0xff,
519 .bInterfaceProtocol = 0xff,
520 .driver_info = (unsigned long)&qmi_wwan_sierra,
521 },
Bjørn Morkb086cf02012-03-09 12:35:06 +0100522 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
523 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
524 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
525 {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
526 {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
527 {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
528 {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
529 {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
530 {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
531 {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
532 {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
533 {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
534 {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
535 {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
536 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
537 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
538 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
539 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
540 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
541 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
542 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
543 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
544 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
545 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
546 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
547 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
548 {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
549 {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
550 {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
551 {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
552 {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
553 {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
554 {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
555 {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
556 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
557 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
558 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
Bjørn Mork5e071b52012-05-23 23:19:32 +0000559 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
560 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100561 { } /* END */
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000562};
563MODULE_DEVICE_TABLE(usb, products);
564
565static struct usb_driver qmi_wwan_driver = {
566 .name = "qmi_wwan",
567 .id_table = products,
568 .probe = usbnet_probe,
569 .disconnect = usbnet_disconnect,
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100570 .suspend = qmi_wwan_suspend,
571 .resume = qmi_wwan_resume,
572 .reset_resume = qmi_wwan_resume,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000573 .supports_autosuspend = 1,
Sarah Sharpe1f12eb2012-04-23 10:08:51 -0700574 .disable_hub_initiated_lpm = 1,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000575};
576
577static int __init qmi_wwan_init(void)
578{
579 return usb_register(&qmi_wwan_driver);
580}
581module_init(qmi_wwan_init);
582
583static void __exit qmi_wwan_exit(void)
584{
585 usb_deregister(&qmi_wwan_driver);
586}
587module_exit(qmi_wwan_exit);
588
589MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
590MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
591MODULE_LICENSE("GPL");